当前位置: 首页>>代码示例>>Golang>>正文


Golang DOHLCV.C方法代码示例

本文整理汇总了Golang中github.com/thetruetrade/gotrade.DOHLCV.C方法的典型用法代码示例。如果您正苦于以下问题:Golang DOHLCV.C方法的具体用法?Golang DOHLCV.C怎么用?Golang DOHLCV.C使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/thetruetrade/gotrade.DOHLCV的用法示例。


在下文中一共展示了DOHLCV.C方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: ReceiveDOHLCVTick

// ReceiveDOHLCVTick consumes a source data DOHLCV price tick
func (ind *AdlWithoutStorage) ReceiveDOHLCVTick(tickData gotrade.DOHLCV, streamBarIndex int) {

	moneyFlowMultiplier := ((tickData.C() - tickData.L()) - (tickData.H() - tickData.C())) / (tickData.H() - tickData.L())
	moneyFlowVolume := moneyFlowMultiplier * tickData.V()
	result := ind.previousAdl + moneyFlowVolume

	ind.UpdateIndicatorWithNewValue(result, streamBarIndex)

	ind.previousAdl = result
}
开发者ID:jmptrader,项目名称:gotrade,代码行数:11,代码来源:adl.go

示例2: ReceiveDOHLCVTick

// ReceiveDOHLCVTick consumes a source data DOHLCV price tick
func (ind *StochOscWithoutStorage) ReceiveDOHLCVTick(tickData gotrade.DOHLCV, streamBarIndex int) {
	ind.periodCounter += 1
	ind.hhv.ReceiveTick(tickData.H(), streamBarIndex)
	ind.llv.ReceiveTick(tickData.L(), streamBarIndex)

	if ind.periodCounter >= 0 {
		ind.currentFastK = 100.0 * ((tickData.C() - ind.currentPeriodLow) / (ind.currentPeriodHigh - ind.currentPeriodLow))
		ind.slowKMA.ReceiveTick(ind.currentFastK, streamBarIndex)
	}
}
开发者ID:jmptrader,项目名称:gotrade,代码行数:11,代码来源:stochosc.go

示例3: ReceiveDOHLCVTick

// ReceiveDOHLCVTick consumes a source data DOHLCV price tick
func (ind *TrueRangeWithoutStorage) ReceiveDOHLCVTick(tickData gotrade.DOHLCV, streamBarIndex int) {
	ind.periodCounter += 1

	if ind.periodCounter > 0 {

		high := math.Max(tickData.H(), ind.previousClose)
		low := math.Min(tickData.L(), ind.previousClose)
		result := high - low

		ind.UpdateIndicatorWithNewValue(result, streamBarIndex)
	}

	ind.previousClose = tickData.C()
}
开发者ID:jmptrader,项目名称:gotrade,代码行数:15,代码来源:truerange.go

示例4: ReceiveDOHLCVTick

// ReceiveDOHLCVTick consumes a source data DOHLCV price tick
func (ind *Cci) ReceiveDOHLCVTick(tickData gotrade.DOHLCV, streamBarIndex int) {
	ind.periodCounter += 1

	// calculate the typical price
	typicalPrice := (tickData.H() + tickData.L() + tickData.C()) / 3.0
	ind.currentTypicalPrice = typicalPrice

	// push it to the history
	ind.typicalPriceHistory.PushBack(typicalPrice)

	// trim the history
	if ind.typicalPriceHistory.Len() > ind.timePeriod {
		var first = ind.typicalPriceHistory.Front()
		ind.typicalPriceHistory.Remove(first)
	}

	// add it to the average
	ind.typicalPriceAvg.ReceiveTick(typicalPrice, streamBarIndex)
}
开发者ID:jmptrader,项目名称:gotrade,代码行数:20,代码来源:cci.go

示例5: ReceiveDOHLCVTick

// ReceiveDOHLCVTick consumes a source data DOHLCV price tick
func (ind *ObvWithoutStorage) ReceiveDOHLCVTick(tickData gotrade.DOHLCV, streamBarIndex int) {
	ind.periodCounter += 1

	if ind.periodCounter <= 0 {
		ind.previousObv = tickData.V()
		ind.previousClose = tickData.C()

		result := ind.previousObv

		ind.UpdateIndicatorWithNewValue(result, streamBarIndex)
	}

	if ind.periodCounter > 0 {
		closePrice := tickData.C()
		if closePrice > ind.previousClose {
			ind.previousObv += tickData.V()
		} else if closePrice < ind.previousClose {
			ind.previousObv -= tickData.V()
		}

		result := ind.previousObv

		ind.UpdateIndicatorWithNewValue(result, streamBarIndex)

		ind.previousClose = tickData.C()
	}
}
开发者ID:jmptrader,项目名称:gotrade,代码行数:28,代码来源:obv.go

示例6: ReceiveDOHLCVTick

// ReceiveDOHLCVTick consumes a source data DOHLCV price tick
func (ind *AvgPriceWithoutStorage) ReceiveDOHLCVTick(tickData gotrade.DOHLCV, streamBarIndex int) {

	result := (tickData.O() + tickData.H() + tickData.L() + tickData.C()) / float64(4.0)

	ind.UpdateIndicatorWithNewValue(result, streamBarIndex)
}
开发者ID:jmptrader,项目名称:gotrade,代码行数:7,代码来源:avgprice.go

示例7: ReceiveDOHLCVTick

// ReceiveDOHLCVTick consumes a source data DOHLCV price tick
func (ind *StochRsiWithoutStorage) ReceiveDOHLCVTick(tickData gotrade.DOHLCV, streamBarIndex int) {

	ind.rsi.ReceiveTick(tickData.C(), streamBarIndex)
}
开发者ID:jmptrader,项目名称:gotrade,代码行数:5,代码来源:stochrsi.go


注:本文中的github.com/thetruetrade/gotrade.DOHLCV.C方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。