Documentation
¶
Index ¶
- Constants
- func CalculateKLinesEMA(allKLines []types.KLine, priceF KLinePriceMapper, window int) float64
- func KLineClosePriceMapper(k types.KLine) float64
- func KLineHighPriceMapper(k types.KLine) float64
- func KLineLowPriceMapper(k types.KLine) float64
- func KLineOpenPriceMapper(k types.KLine) float64
- func KLinePriceVolumeMapper(k types.KLine) float64
- func KLineTypicalPriceMapper(k types.KLine) float64
- func KLineVolumeMapper(k types.KLine) float64
- func MapKLinePrice(kLines []types.KLine, f KLinePriceMapper) (prices []float64)
- type AD
- func (inc *AD) Bind(updater KLineWindowUpdater)
- func (inc *AD) CalculateAndUpdate(kLines []types.KLine)
- func (inc *AD) EmitUpdate(value float64)
- func (inc *AD) Index(i int) float64
- func (inc *AD) Last() float64
- func (inc *AD) Length() int
- func (inc *AD) OnUpdate(cb func(value float64))
- func (inc *AD) Update(high, low, cloze, volume float64)
- type ALMA
- func (inc *ALMA) Bind(updater KLineWindowUpdater)
- func (inc *ALMA) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *ALMA) EmitUpdate(value float64)
- func (inc *ALMA) Index(i int) float64
- func (inc *ALMA) Last() float64
- func (inc *ALMA) Length() int
- func (inc *ALMA) OnUpdate(cb func(value float64))
- func (inc *ALMA) Update(value float64)
- type ATR
- func (inc *ATR) Clone() *ATR
- func (inc *ATR) EmitUpdate(value float64)
- func (inc *ATR) Index(i int) float64
- func (inc *ATR) Last() float64
- func (inc *ATR) Length() int
- func (inc *ATR) OnUpdate(cb func(value float64))
- func (inc *ATR) PushK(k types.KLine)
- func (inc *ATR) TestUpdate(high, low, cloze float64) *ATR
- func (inc *ATR) Update(high, low, cloze float64)
- type ATRP
- func (inc *ATRP) Bind(updater KLineWindowUpdater)
- func (inc *ATRP) CalculateAndUpdate(kLines []types.KLine)
- func (inc *ATRP) EmitUpdate(value float64)
- func (inc *ATRP) Index(i int) float64
- func (inc *ATRP) Last() float64
- func (inc *ATRP) Length() int
- func (inc *ATRP) OnUpdate(cb func(value float64))
- func (inc *ATRP) PushK(k types.KLine)
- func (inc *ATRP) Update(high, low, cloze float64)
- type BOLL
- func (inc *BOLL) Bind(updater KLineWindowUpdater)
- func (inc *BOLL) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)
- func (inc *BOLL) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *BOLL) EmitUpdate(sma float64, upBand float64, downBand float64)
- func (inc *BOLL) GetDownBand() types.SeriesExtend
- func (inc *BOLL) GetSMA() types.SeriesExtend
- func (inc *BOLL) GetStdDev() types.SeriesExtend
- func (inc *BOLL) GetUpBand() types.SeriesExtend
- func (inc *BOLL) LastDownBand() float64
- func (inc *BOLL) LastUpBand() float64
- func (inc *BOLL) LoadK(allKLines []types.KLine)
- func (inc *BOLL) OnUpdate(cb func(sma float64, upBand float64, downBand float64))
- func (inc *BOLL) PushK(k types.KLine)
- func (inc *BOLL) Update(value float64)
- type BandType
- type CA
- func (inc *CA) Bind(updater KLineWindowUpdater)
- func (inc *CA) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *CA) EmitUpdate(value float64)
- func (inc *CA) Index(i int) float64
- func (inc *CA) Last() float64
- func (inc *CA) Length() int
- func (inc *CA) OnUpdate(cb func(value float64))
- func (inc *CA) PushK(k types.KLine)
- func (inc *CA) Update(x float64)
- type CCI
- func (inc *CCI) Bind(updater KLineWindowUpdater)
- func (inc *CCI) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *CCI) EmitUpdate(value float64)
- func (inc *CCI) Index(i int) float64
- func (inc *CCI) Last() float64
- func (inc *CCI) Length() int
- func (inc *CCI) OnUpdate(cb func(value float64))
- func (inc *CCI) PushK(k types.KLine)
- func (inc *CCI) Update(value float64)
- type DEMA
- func (inc *DEMA) Bind(updater KLineWindowUpdater)
- func (inc *DEMA) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *DEMA) Clone() *DEMA
- func (inc *DEMA) EmitUpdate(value float64)
- func (inc *DEMA) Index(i int) float64
- func (inc *DEMA) Last() float64
- func (inc *DEMA) Length() int
- func (inc *DEMA) OnUpdate(cb func(value float64))
- func (inc *DEMA) PushK(k types.KLine)
- func (inc *DEMA) TestUpdate(value float64) *DEMA
- func (inc *DEMA) Update(value float64)
- type DMI
- func (inc *DMI) Bind(updater KLineWindowUpdater)
- func (inc *DMI) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *DMI) EmitUpdate(diplus float64, diminus float64, adx float64)
- func (inc *DMI) GetADX() types.SeriesExtend
- func (inc *DMI) GetDIMinus() types.SeriesExtend
- func (inc *DMI) GetDIPlus() types.SeriesExtend
- func (inc *DMI) Length() int
- func (inc *DMI) OnUpdate(cb func(diplus float64, diminus float64, adx float64))
- func (inc *DMI) PushK(k types.KLine)
- func (inc *DMI) Update(high, low, cloze float64)
- type Drift
- func (inc *Drift) Bind(updater KLineWindowUpdater)
- func (inc *Drift) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *Drift) Clone() (out *Drift)
- func (inc *Drift) EmitUpdate(value float64)
- func (inc *Drift) Index(i int) float64
- func (inc *Drift) Last() float64
- func (inc *Drift) Length() int
- func (inc *Drift) OnUpdate(cb func(value float64))
- func (inc *Drift) PushK(k types.KLine)
- func (inc *Drift) TestUpdate(value float64) *Drift
- func (inc *Drift) Update(value float64)
- func (inc *Drift) ZeroPoint() float64
- type EMV
- type EWMA
- func (inc *EWMA) Clone() *EWMA
- func (inc *EWMA) EmitUpdate(value float64)
- func (inc *EWMA) Index(i int) float64
- func (inc *EWMA) Last() float64
- func (inc *EWMA) Length() int
- func (inc *EWMA) OnUpdate(cb func(value float64))
- func (inc *EWMA) PushK(k types.KLine)
- func (inc *EWMA) TestUpdate(value float64) *EWMA
- func (inc *EWMA) Update(value float64)
- type FisherTransform
- func (inc *FisherTransform) Clone() types.UpdatableSeriesExtend
- func (inc *FisherTransform) EmitUpdate(value float64)
- func (inc *FisherTransform) Index(i int) float64
- func (inc *FisherTransform) Last() float64
- func (inc *FisherTransform) Length() int
- func (inc *FisherTransform) OnUpdate(cb func(value float64))
- func (inc *FisherTransform) Update(value float64)
- type HULL
- type KLineCalculateUpdater
- type KLineClosedBinder
- type KLineClosedEmitter
- type KLinePriceMapper
- type KLinePusher
- type KLineValueMapper
- type KLineWindowUpdater
- type Line
- type Low
- type MACD
- func (inc *MACD) EmitUpdate(value float64)
- func (inc *MACD) Last() float64
- func (inc *MACD) Length() int
- func (inc *MACD) MACD() types.SeriesExtend
- func (inc *MACD) OnUpdate(cb func(value float64))
- func (inc *MACD) PushK(k types.KLine)
- func (inc *MACD) Singals() types.SeriesExtend
- func (inc *MACD) Update(x float64)
- type MACDValues
- type OBV
- func (inc *OBV) Bind(updater KLineWindowUpdater)
- func (inc *OBV) CalculateAndUpdate(kLines []types.KLine)
- func (inc *OBV) EmitUpdate(value float64)
- func (inc *OBV) Index(i int) float64
- func (inc *OBV) Last() float64
- func (inc *OBV) OnUpdate(cb func(value float64))
- func (inc *OBV) PushK(k types.KLine)
- func (inc *OBV) Update(price, volume float64)
- type Pivot
- func (inc *Pivot) Bind(updater KLineWindowUpdater)
- func (inc *Pivot) CalculateAndUpdate(klines []types.KLine)
- func (inc *Pivot) EmitUpdate(valueLow float64, valueHigh float64)
- func (inc *Pivot) LastHigh() float64
- func (inc *Pivot) LastLow() float64
- func (inc *Pivot) OnUpdate(cb func(valueLow float64, valueHigh float64))
- type PivotLow
- type RMA
- func (inc *RMA) Bind(updater KLineWindowUpdater)
- func (inc *RMA) CalculateAndUpdate(kLines []types.KLine)
- func (inc *RMA) Clone() types.UpdatableSeriesExtend
- func (inc *RMA) EmitUpdate(value float64)
- func (inc *RMA) Index(i int) float64
- func (inc *RMA) Last() float64
- func (inc *RMA) Length() int
- func (inc *RMA) OnUpdate(cb func(value float64))
- func (inc *RMA) PushK(k types.KLine)
- func (inc *RMA) Update(x float64)
- type RSI
- func (inc *RSI) Bind(updater KLineWindowUpdater)
- func (inc *RSI) CalculateAndUpdate(kLines []types.KLine)
- func (inc *RSI) EmitUpdate(value float64)
- func (inc *RSI) Index(i int) float64
- func (inc *RSI) Last() float64
- func (inc *RSI) Length() int
- func (inc *RSI) OnUpdate(cb func(value float64))
- func (inc *RSI) PushK(k types.KLine)
- func (inc *RSI) Update(price float64)
- type SMA
- func (inc *SMA) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)
- func (inc *SMA) Clone() types.UpdatableSeriesExtend
- func (inc *SMA) EmitUpdate(value float64)
- func (inc *SMA) Index(i int) float64
- func (inc *SMA) Last() float64
- func (inc *SMA) Length() int
- func (inc *SMA) LoadK(allKLines []types.KLine)
- func (inc *SMA) OnUpdate(cb func(value float64))
- func (inc *SMA) PushK(k types.KLine)
- func (inc *SMA) Update(value float64)
- type SSF
- func (inc *SSF) Bind(updater KLineWindowUpdater)
- func (inc *SSF) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *SSF) EmitUpdate(value float64)
- func (inc *SSF) Index(i int) float64
- func (inc *SSF) Last() float64
- func (inc *SSF) Length() int
- func (inc *SSF) OnUpdate(cb func(value float64))
- func (inc *SSF) PushK(k types.KLine)
- func (inc *SSF) Update(value float64)
- type STOCH
- func (inc *STOCH) EmitUpdate(k float64, d float64)
- func (inc *STOCH) GetD() types.Series
- func (inc *STOCH) GetK() types.Series
- func (inc *STOCH) LastD() float64
- func (inc *STOCH) LastK() float64
- func (inc *STOCH) OnUpdate(cb func(k float64, d float64))
- func (inc *STOCH) PushK(k types.KLine)
- func (inc *STOCH) Update(high, low, cloze float64)
- type Simple
- type StdDev
- func (inc *StdDev) Bind(updater KLineWindowUpdater)
- func (inc *StdDev) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *StdDev) EmitUpdate(value float64)
- func (inc *StdDev) Index(i int) float64
- func (inc *StdDev) Last() float64
- func (inc *StdDev) Length() int
- func (inc *StdDev) OnUpdate(cb func(value float64))
- func (inc *StdDev) PushK(k types.KLine)
- func (inc *StdDev) Update(value float64)
- type Supertrend
- func (inc *Supertrend) Bind(updater KLineWindowUpdater)
- func (inc *Supertrend) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)
- func (inc *Supertrend) CalculateAndUpdate(kLines []types.KLine)
- func (inc *Supertrend) EmitUpdate(value float64)
- func (inc *Supertrend) GetSignal() types.Direction
- func (inc *Supertrend) Index(i int) float64
- func (inc *Supertrend) Last() float64
- func (inc *Supertrend) Length() int
- func (inc *Supertrend) LoadK(allKLines []types.KLine)
- func (inc *Supertrend) OnUpdate(cb func(value float64))
- func (inc *Supertrend) PushK(k types.KLine)
- func (inc *Supertrend) Update(highPrice, lowPrice, closePrice float64)
- type TEMA
- func (inc *TEMA) Bind(updater KLineWindowUpdater)
- func (inc *TEMA) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *TEMA) EmitUpdate(value float64)
- func (inc *TEMA) Index(i int) float64
- func (inc *TEMA) Last() float64
- func (inc *TEMA) Length() int
- func (inc *TEMA) OnUpdate(cb func(value float64))
- func (inc *TEMA) PushK(k types.KLine)
- func (inc *TEMA) Update(value float64)
- type TILL
- func (inc *TILL) Bind(updater KLineWindowUpdater)
- func (inc *TILL) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)
- func (inc *TILL) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *TILL) EmitUpdate(value float64)
- func (inc *TILL) Index(i int) float64
- func (inc *TILL) Last() float64
- func (inc *TILL) Length() int
- func (inc *TILL) LoadK(allKLines []types.KLine)
- func (inc *TILL) OnUpdate(cb func(value float64))
- func (inc *TILL) PushK(k types.KLine)
- func (inc *TILL) Update(value float64)
- type TMA
- func (inc *TMA) Bind(updater KLineWindowUpdater)
- func (inc *TMA) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *TMA) EmitUpdate(value float64)
- func (inc *TMA) Index(i int) float64
- func (inc *TMA) Last() float64
- func (inc *TMA) Length() int
- func (inc *TMA) OnUpdate(cb func(value float64))
- func (inc *TMA) PushK(k types.KLine)
- func (inc *TMA) Update(value float64)
- type VIDYA
- func (inc *VIDYA) Bind(updater KLineWindowUpdater)
- func (inc *VIDYA) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *VIDYA) EmitUpdate(value float64)
- func (inc *VIDYA) Index(i int) float64
- func (inc *VIDYA) Last() float64
- func (inc *VIDYA) Length() int
- func (inc *VIDYA) OnUpdate(cb func(value float64))
- func (inc *VIDYA) PushK(k types.KLine)
- func (inc *VIDYA) Update(value float64)
- type VWAP
- func (inc *VWAP) Bind(updater KLineWindowUpdater)
- func (inc *VWAP) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *VWAP) EmitUpdate(value float64)
- func (inc *VWAP) Index(i int) float64
- func (inc *VWAP) Last() float64
- func (inc *VWAP) Length() int
- func (inc *VWAP) OnUpdate(cb func(value float64))
- func (inc *VWAP) PushK(k types.KLine)
- func (inc *VWAP) Update(price, volume float64)
- type VWMA
- func (inc *VWMA) Bind(updater KLineWindowUpdater)
- func (inc *VWMA) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *VWMA) EmitUpdate(value float64)
- func (inc *VWMA) Index(i int) float64
- func (inc *VWMA) Last() float64
- func (inc *VWMA) Length() int
- func (inc *VWMA) OnUpdate(cb func(value float64))
- func (inc *VWMA) Update(price, volume float64)
- type Volatility
- func (inc *Volatility) Bind(updater KLineWindowUpdater)
- func (inc *Volatility) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *Volatility) EmitUpdate(value float64)
- func (inc *Volatility) Index(i int) float64
- func (inc *Volatility) Last() float64
- func (inc *Volatility) Length() int
- func (inc *Volatility) OnUpdate(cb func(value float64))
- type WWMA
- func (inc *WWMA) Bind(updater KLineWindowUpdater)
- func (inc *WWMA) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *WWMA) EmitUpdate(value float64)
- func (inc *WWMA) Index(i int) float64
- func (inc *WWMA) Last() float64
- func (inc *WWMA) Length() int
- func (inc *WWMA) OnUpdate(cb func(value float64))
- func (inc *WWMA) PushK(k types.KLine)
- func (inc *WWMA) Update(value float64)
- type ZLEMA
- func (inc *ZLEMA) Bind(updater KLineWindowUpdater)
- func (inc *ZLEMA) CalculateAndUpdate(allKLines []types.KLine)
- func (inc *ZLEMA) EmitUpdate(value float64)
- func (inc *ZLEMA) Index(i int) float64
- func (inc *ZLEMA) Last() float64
- func (inc *ZLEMA) Length() int
- func (inc *ZLEMA) OnUpdate(cb func(value float64))
- func (inc *ZLEMA) PushK(k types.KLine)
- func (inc *ZLEMA) Update(value float64)
Constants ¶
const DPeriod int = 3
const DefaultEMVScale float64 = 100000000.
const MaxNumOfALMA = 5_000
const MaxNumOfALMATruncateSize = 100
const MaxNumOfEWMA = 5_000
These numbers should be aligned with bbgo MaxNumOfKLines and MaxNumOfKLinesTruncate
const MaxNumOfEWMATruncateSize = 100
const MaxNumOfSMA = 5_000
const MaxNumOfSMATruncateSize = 100
const MaxNumOfVOL = 5_000
const MaxNumOfVOLTruncateSize = 100
const MaxNumOfWWMA = 5_000
const MaxNumOfWWMATruncateSize = 100
Variables ¶
This section is empty.
Functions ¶
func CalculateKLinesEMA ¶ added in v1.3.1
func CalculateKLinesEMA(allKLines []types.KLine, priceF KLinePriceMapper, window int) float64
func KLineClosePriceMapper ¶ added in v1.2.1
func KLineHighPriceMapper ¶ added in v1.33.0
func KLineLowPriceMapper ¶ added in v1.33.0
func KLineOpenPriceMapper ¶ added in v1.2.1
func KLinePriceVolumeMapper ¶ added in v1.21.0
func KLineTypicalPriceMapper ¶ added in v1.16.0
func KLineVolumeMapper ¶ added in v1.21.0
func MapKLinePrice ¶ added in v1.2.1
func MapKLinePrice(kLines []types.KLine, f KLinePriceMapper) (prices []float64)
Types ¶
type AD ¶ added in v1.16.0
type AD struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
PrePrice float64
EndTime time.Time
UpdateCallbacks []func(value float64)
}
ad implements accumulation/distribution indicator
Accumulation/Distribution Indicator (A/D) - https://www.investopedia.com/terms/a/accumulationdistribution.asp
func (*AD) Bind ¶ added in v1.16.0
func (inc *AD) Bind(updater KLineWindowUpdater)
func (*AD) CalculateAndUpdate ¶ added in v1.37.0
func (*AD) EmitUpdate ¶ added in v1.16.0
type ALMA ¶ added in v1.34.0
type ALMA struct {
types.SeriesBase
types.IntervalWindow // required
Offset float64 // required: recommend to be 0.5
Sigma int // required: recommend to be 5
Values types.Float64Slice
UpdateCallbacks []func(value float64)
// contains filtered or unexported fields
}
Refer: Arnaud Legoux Moving Average Refer: https://capital.com/arnaud-legoux-moving-average Also check https://github.com/DaveSkender/Stock.Indicators/blob/main/src/a-d/Alma/Alma.cs @param offset: Gaussian applied to the combo line. 1->ema, 0->sma @param sigma: the standard deviation applied to the combo line. This makes the combo line sharper
func (*ALMA) Bind ¶ added in v1.34.0
func (inc *ALMA) Bind(updater KLineWindowUpdater)
func (*ALMA) CalculateAndUpdate ¶ added in v1.37.0
func (*ALMA) EmitUpdate ¶ added in v1.34.0
type ATR ¶ added in v1.31.0
type ATR struct {
types.SeriesBase
types.IntervalWindow
PercentageVolatility types.Float64Slice
PreviousClose float64
RMA *RMA
EndTime time.Time
UpdateCallbacks []func(value float64)
}
func (*ATR) EmitUpdate ¶ added in v1.31.0
func (*ATR) TestUpdate ¶ added in v1.38.0
type ATRP ¶ added in v1.37.0
type ATRP struct {
types.SeriesBase
types.IntervalWindow
PercentageVolatility types.Float64Slice
PreviousClose float64
RMA *RMA
EndTime time.Time
UpdateCallbacks []func(value float64)
}
ATRP is the average true range percentage See also https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/atrp
Calculation:
ATRP = (Average True Range / Close) * 100
func (*ATRP) Bind ¶ added in v1.37.0
func (inc *ATRP) Bind(updater KLineWindowUpdater)
func (*ATRP) CalculateAndUpdate ¶ added in v1.37.0
func (*ATRP) EmitUpdate ¶ added in v1.37.0
type BOLL ¶
type BOLL struct {
types.IntervalWindow
// K is the multiplier of Std, generally it's 2
K float64
SMA *SMA
StdDev *StdDev
UpBand types.Float64Slice
DownBand types.Float64Slice
EndTime time.Time
// contains filtered or unexported fields
}
func (*BOLL) Bind ¶
func (inc *BOLL) Bind(updater KLineWindowUpdater)
func (*BOLL) BindK ¶ added in v1.38.0
func (inc *BOLL) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)
func (*BOLL) CalculateAndUpdate ¶ added in v1.37.0
func (*BOLL) EmitUpdate ¶
func (*BOLL) GetDownBand ¶ added in v1.30.2
func (inc *BOLL) GetDownBand() types.SeriesExtend
func (*BOLL) GetSMA ¶ added in v1.30.2
func (inc *BOLL) GetSMA() types.SeriesExtend
func (*BOLL) GetStdDev ¶ added in v1.30.2
func (inc *BOLL) GetStdDev() types.SeriesExtend
func (*BOLL) GetUpBand ¶ added in v1.30.2
func (inc *BOLL) GetUpBand() types.SeriesExtend
func (*BOLL) LastDownBand ¶
func (*BOLL) LastUpBand ¶
type CA ¶ added in v1.31.0
type CA struct {
types.SeriesBase
Interval types.Interval
Values types.Float64Slice
UpdateCallbacks []func(value float64)
// contains filtered or unexported fields
}
Refer: Cumulative Moving Average, Cumulative Average Refer: https://en.wikipedia.org/wiki/Moving_average
func (*CA) Bind ¶ added in v1.31.0
func (inc *CA) Bind(updater KLineWindowUpdater)
func (*CA) CalculateAndUpdate ¶ added in v1.37.0
func (*CA) EmitUpdate ¶ added in v1.31.0
type CCI ¶ added in v1.33.0
type CCI struct {
types.SeriesBase
types.IntervalWindow
Input types.Float64Slice
TypicalPrice types.Float64Slice
MA types.Float64Slice
Values types.Float64Slice
UpdateCallbacks []func(value float64)
}
Refer: Commodity Channel Index Refer URL: http://www.andrewshamlet.net/2017/07/08/python-tutorial-cci with modification of ddof=0 to let standard deviation to be divided by N instead of N-1
func (*CCI) Bind ¶ added in v1.33.0
func (inc *CCI) Bind(updater KLineWindowUpdater)
func (*CCI) CalculateAndUpdate ¶ added in v1.37.0
func (*CCI) EmitUpdate ¶ added in v1.33.0
type DEMA ¶ added in v1.31.0
type DEMA struct {
types.IntervalWindow
types.SeriesBase
Values types.Float64Slice
UpdateCallbacks []func(value float64)
// contains filtered or unexported fields
}
func (*DEMA) Bind ¶ added in v1.31.0
func (inc *DEMA) Bind(updater KLineWindowUpdater)
func (*DEMA) CalculateAndUpdate ¶ added in v1.37.0
func (*DEMA) EmitUpdate ¶ added in v1.31.0
func (*DEMA) TestUpdate ¶ added in v1.38.0
type DMI ¶ added in v1.35.0
type DMI struct {
types.IntervalWindow
ADXSmoothing int
DMP types.UpdatableSeriesExtend
DMN types.UpdatableSeriesExtend
DIPlus *types.Queue
DIMinus *types.Queue
ADX types.UpdatableSeriesExtend
PrevHigh, PrevLow float64
// contains filtered or unexported fields
}
Refer: https://www.investopedia.com/terms/d/dmi.asp Refer: https://github.com/twopirllc/pandas-ta/blob/main/pandas_ta/trend/adx.py
Directional Movement Index an indicator developed by J. Welles Wilder in 1978 that identifies in which direction the price of an asset is moving.
func (*DMI) Bind ¶ added in v1.35.0
func (inc *DMI) Bind(updater KLineWindowUpdater)
func (*DMI) CalculateAndUpdate ¶ added in v1.37.0
func (*DMI) EmitUpdate ¶ added in v1.35.0
func (*DMI) GetADX ¶ added in v1.35.0
func (inc *DMI) GetADX() types.SeriesExtend
func (*DMI) GetDIMinus ¶ added in v1.35.0
func (inc *DMI) GetDIMinus() types.SeriesExtend
func (*DMI) GetDIPlus ¶ added in v1.35.0
func (inc *DMI) GetDIPlus() types.SeriesExtend
type Drift ¶ added in v1.33.1
type Drift struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
MA types.UpdatableSeriesExtend
LastValue float64
UpdateCallbacks []func(value float64)
// contains filtered or unexported fields
}
Refer: https://tradingview.com/script/aDymGrFx-Drift-Study-Inspired-by-Monte-Carlo-Simulations-with-BM-KL/ Brownian Motion's drift factor could be used in Monte Carlo Simulations
func (*Drift) Bind ¶ added in v1.33.1
func (inc *Drift) Bind(updater KLineWindowUpdater)
func (*Drift) CalculateAndUpdate ¶ added in v1.37.0
func (*Drift) EmitUpdate ¶ added in v1.33.1
func (*Drift) TestUpdate ¶ added in v1.38.0
type EMV ¶ added in v1.33.0
type EMV struct {
types.SeriesBase
types.IntervalWindow
Values *SMA
EMVScale float64
UpdateCallbacks []func(value float64)
// contains filtered or unexported fields
}
func (*EMV) EmitUpdate ¶ added in v1.33.0
type EWMA ¶
type EWMA struct {
types.IntervalWindow
types.SeriesBase
Values types.Float64Slice
EndTime time.Time
// contains filtered or unexported fields
}
func (*EWMA) EmitUpdate ¶ added in v1.2.1
func (*EWMA) TestUpdate ¶ added in v1.38.0
type FisherTransform ¶ added in v1.38.0
type FisherTransform struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
UpdateCallbacks []func(value float64)
// contains filtered or unexported fields
}
func (*FisherTransform) Clone ¶ added in v1.38.0
func (inc *FisherTransform) Clone() types.UpdatableSeriesExtend
func (*FisherTransform) EmitUpdate ¶ added in v1.38.0
func (inc *FisherTransform) EmitUpdate(value float64)
func (*FisherTransform) Index ¶ added in v1.38.0
func (inc *FisherTransform) Index(i int) float64
func (*FisherTransform) Last ¶ added in v1.38.0
func (inc *FisherTransform) Last() float64
func (*FisherTransform) Length ¶ added in v1.38.0
func (inc *FisherTransform) Length() int
func (*FisherTransform) OnUpdate ¶ added in v1.38.0
func (inc *FisherTransform) OnUpdate(cb func(value float64))
func (*FisherTransform) Update ¶ added in v1.38.0
func (inc *FisherTransform) Update(value float64)
type HULL ¶ added in v1.31.0
type HULL struct {
types.SeriesBase
types.IntervalWindow
// contains filtered or unexported fields
}
Refer: Hull Moving Average Refer URL: https://fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/hull-moving-average
func (*HULL) EmitUpdate ¶ added in v1.31.0
type KLineCalculateUpdater ¶ added in v1.37.0
type KLineClosedBinder ¶ added in v1.37.0
type KLineClosedBinder interface {
BindK(target KLineClosedEmitter, symbol string, interval types.Interval)
}
type KLineClosedEmitter ¶ added in v1.37.0
KLineClosedEmitter is currently applied to the market data stream the market data stream emits the KLine closed event to the listeners.
type KLinePriceMapper ¶ added in v1.2.1
type KLinePusher ¶ added in v1.37.0
KLinePusher provides an interface for API user to push kline value to the indicator. The indicator implements its own way to calculate the value from the given kline object.
type KLineValueMapper ¶ added in v1.33.0
type KLineWindowUpdater ¶
type KLineWindowUpdater interface {
OnKLineWindowUpdate(func(interval types.Interval, window types.KLineWindow))
}
type Line ¶ added in v1.30.2
type Line struct {
types.SeriesBase
types.IntervalWindow
Interval types.Interval
// contains filtered or unexported fields
}
Line indicator is a utility that helps to simulate either the 1. trend 2. support 3. resistance of the market data, defined with series interface
func (*Line) Bind ¶ added in v1.30.2
func (l *Line) Bind(updater KLineWindowUpdater)
type Low ¶ added in v1.38.0
type Low struct {
types.IntervalWindow
types.SeriesBase
Values types.Float64Slice
EndTime time.Time
// contains filtered or unexported fields
}
func (*Low) EmitUpdate ¶ added in v1.38.0
type MACD ¶ added in v1.16.0
type MACD struct {
types.IntervalWindow // 9
ShortPeriod int // 12
LongPeriod int // 26
Values types.Float64Slice
FastEWMA *EWMA
SlowEWMA *EWMA
SignalLine *EWMA
Histogram types.Float64Slice
EndTime time.Time
// contains filtered or unexported fields
}
func (*MACD) EmitUpdate ¶ added in v1.16.0
func (*MACD) MACD ¶ added in v1.30.2
func (inc *MACD) MACD() types.SeriesExtend
func (*MACD) Singals ¶ added in v1.30.2
func (inc *MACD) Singals() types.SeriesExtend
type MACDValues ¶ added in v1.30.2
type MACDValues struct {
types.SeriesBase
*MACD
}
func (*MACDValues) Index ¶ added in v1.30.2
func (inc *MACDValues) Index(i int) float64
func (*MACDValues) Last ¶ added in v1.30.2
func (inc *MACDValues) Last() float64
func (*MACDValues) Length ¶ added in v1.30.2
func (inc *MACDValues) Length() int
type OBV ¶ added in v1.16.0
type OBV struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
PrePrice float64
EndTime time.Time
// contains filtered or unexported fields
}
obv implements on-balance volume indicator
On-Balance Volume (OBV) Definition - https://www.investopedia.com/terms/o/onbalancevolume.asp
func (*OBV) Bind ¶ added in v1.16.0
func (inc *OBV) Bind(updater KLineWindowUpdater)
func (*OBV) CalculateAndUpdate ¶ added in v1.37.0
func (*OBV) EmitUpdate ¶ added in v1.16.0
type Pivot ¶ added in v1.33.0
type Pivot struct {
types.IntervalWindow
// Values
Lows types.Float64Slice // higher low
Highs types.Float64Slice // lower high
EndTime time.Time
// contains filtered or unexported fields
}
func (*Pivot) Bind ¶ added in v1.33.0
func (inc *Pivot) Bind(updater KLineWindowUpdater)
func (*Pivot) CalculateAndUpdate ¶ added in v1.37.0
func (*Pivot) EmitUpdate ¶ added in v1.33.0
type PivotLow ¶ added in v1.38.0
type PivotLow struct {
types.SeriesBase
types.IntervalWindow
Lows types.Float64Slice
Values types.Float64Slice
EndTime time.Time
// contains filtered or unexported fields
}
func (*PivotLow) EmitUpdate ¶ added in v1.38.0
type RMA ¶ added in v1.31.0
type RMA struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
EndTime time.Time
Adjust bool
// contains filtered or unexported fields
}
Running Moving Average Refer: https://github.com/twopirllc/pandas-ta/blob/main/pandas_ta/overlap/rma.py#L5 Refer: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.ewm.html#pandas-dataframe-ewm
func (*RMA) Bind ¶ added in v1.31.0
func (inc *RMA) Bind(updater KLineWindowUpdater)
func (*RMA) CalculateAndUpdate ¶ added in v1.37.0
func (*RMA) Clone ¶ added in v1.38.0
func (inc *RMA) Clone() types.UpdatableSeriesExtend
func (*RMA) EmitUpdate ¶ added in v1.31.0
type RSI ¶ added in v1.29.0
type RSI struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
Prices types.Float64Slice
PreviousAvgLoss float64
PreviousAvgGain float64
EndTime time.Time
// contains filtered or unexported fields
}
rsi implements Relative Strength Index (RSI)
https://www.investopedia.com/terms/r/rsi.asp
func (*RSI) Bind ¶ added in v1.29.0
func (inc *RSI) Bind(updater KLineWindowUpdater)
func (*RSI) CalculateAndUpdate ¶ added in v1.37.0
func (*RSI) EmitUpdate ¶ added in v1.29.0
type SMA ¶
type SMA struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
EndTime time.Time
UpdateCallbacks []func(value float64)
// contains filtered or unexported fields
}
func (*SMA) BindK ¶ added in v1.37.0
func (inc *SMA) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)
func (*SMA) Clone ¶ added in v1.38.0
func (inc *SMA) Clone() types.UpdatableSeriesExtend
func (*SMA) EmitUpdate ¶ added in v1.2.1
type SSF ¶ added in v1.34.0
type SSF struct {
types.SeriesBase
types.IntervalWindow
Poles int
Values types.Float64Slice
UpdateCallbacks []func(value float64)
// contains filtered or unexported fields
}
Refer: https://easylanguagemastery.com/indicators/predictive-indicators/ Refer: https://github.com/twopirllc/pandas-ta/blob/main/pandas_ta/overlap/ssf.py Ehler's Super Smoother Filter
John F. Ehlers's solution to reduce lag and remove aliasing noise with his research in aerospace analog filter design. This indicator comes with two versions determined by the keyword poles. By default, it uses two poles but there is an option for three poles. Since SSF is a (Resursive) Digital Filter, the number of poles determine how many prior recursive SSF bars to include in the design of the filter. So two poles uses two prior SSF bars and three poles uses three prior SSF bars for their filter calculations.
func (*SSF) Bind ¶ added in v1.34.0
func (inc *SSF) Bind(updater KLineWindowUpdater)
func (*SSF) CalculateAndUpdate ¶ added in v1.37.0
func (*SSF) EmitUpdate ¶ added in v1.34.0
type STOCH ¶ added in v1.17.0
type STOCH struct {
types.IntervalWindow
K types.Float64Slice
D types.Float64Slice
HighValues types.Float64Slice
LowValues types.Float64Slice
EndTime time.Time
UpdateCallbacks []func(k float64, d float64)
}
stoch implements stochastic oscillator indicator
Stochastic Oscillator - https://www.investopedia.com/terms/s/stochasticoscillator.asp
func (*STOCH) EmitUpdate ¶ added in v1.17.0
type Simple ¶ added in v1.38.0
type Simple interface {
KLinePusher
Last() float64
OnUpdate(f func(value float64))
}
Simple is the simple indicator that only returns one float64 value
type StdDev ¶ added in v1.37.0
type StdDev struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
EndTime time.Time
// contains filtered or unexported fields
}
func (*StdDev) Bind ¶ added in v1.37.0
func (inc *StdDev) Bind(updater KLineWindowUpdater)
func (*StdDev) CalculateAndUpdate ¶ added in v1.37.0
func (*StdDev) EmitUpdate ¶ added in v1.37.0
type Supertrend ¶ added in v1.33.0
type Supertrend struct {
types.SeriesBase
types.IntervalWindow
ATRMultiplier float64 `json:"atrMultiplier"`
AverageTrueRange *ATR
EndTime time.Time
UpdateCallbacks []func(value float64)
// contains filtered or unexported fields
}
func (*Supertrend) Bind ¶ added in v1.33.0
func (inc *Supertrend) Bind(updater KLineWindowUpdater)
func (*Supertrend) BindK ¶ added in v1.39.0
func (inc *Supertrend) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)
func (*Supertrend) CalculateAndUpdate ¶ added in v1.37.0
func (inc *Supertrend) CalculateAndUpdate(kLines []types.KLine)
func (*Supertrend) EmitUpdate ¶ added in v1.33.0
func (inc *Supertrend) EmitUpdate(value float64)
func (*Supertrend) GetSignal ¶ added in v1.33.0
func (inc *Supertrend) GetSignal() types.Direction
func (*Supertrend) Index ¶ added in v1.33.0
func (inc *Supertrend) Index(i int) float64
func (*Supertrend) Last ¶ added in v1.33.0
func (inc *Supertrend) Last() float64
func (*Supertrend) Length ¶ added in v1.33.0
func (inc *Supertrend) Length() int
func (*Supertrend) LoadK ¶ added in v1.39.0
func (inc *Supertrend) LoadK(allKLines []types.KLine)
func (*Supertrend) OnUpdate ¶ added in v1.33.0
func (inc *Supertrend) OnUpdate(cb func(value float64))
func (*Supertrend) PushK ¶ added in v1.37.0
func (inc *Supertrend) PushK(k types.KLine)
func (*Supertrend) Update ¶ added in v1.33.0
func (inc *Supertrend) Update(highPrice, lowPrice, closePrice float64)
type TEMA ¶ added in v1.31.0
type TEMA struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
A1 *EWMA
A2 *EWMA
A3 *EWMA
UpdateCallbacks []func(value float64)
}
func (*TEMA) Bind ¶ added in v1.31.0
func (inc *TEMA) Bind(updater KLineWindowUpdater)
func (*TEMA) CalculateAndUpdate ¶ added in v1.37.0
func (*TEMA) EmitUpdate ¶ added in v1.31.0
type TILL ¶ added in v1.31.0
type TILL struct {
types.SeriesBase
types.IntervalWindow
VolumeFactor float64
// contains filtered or unexported fields
}
Refer: Tillson T3 Moving Average Refer URL: https://tradingpedia.com/forex-trading-indicator/t3-moving-average-indicator/
func (*TILL) Bind ¶ added in v1.31.0
func (inc *TILL) Bind(updater KLineWindowUpdater)
func (*TILL) BindK ¶ added in v1.38.0
func (inc *TILL) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)
func (*TILL) CalculateAndUpdate ¶ added in v1.37.0
func (*TILL) EmitUpdate ¶ added in v1.31.0
type TMA ¶ added in v1.31.0
type TMA struct {
types.SeriesBase
types.IntervalWindow
UpdateCallbacks []func(value float64)
// contains filtered or unexported fields
}
Refer: Triangular Moving Average Refer URL: https://ja.wikipedia.org/wiki/移動平均
func (*TMA) Bind ¶ added in v1.31.0
func (inc *TMA) Bind(updater KLineWindowUpdater)
func (*TMA) CalculateAndUpdate ¶ added in v1.37.0
func (*TMA) EmitUpdate ¶ added in v1.31.0
type VIDYA ¶ added in v1.31.0
type VIDYA struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
// contains filtered or unexported fields
}
Refer: Variable Index Dynamic Average Refer URL: https://metatrader5.com/en/terminal/help/indicators/trend_indicators/vida
func (*VIDYA) Bind ¶ added in v1.31.0
func (inc *VIDYA) Bind(updater KLineWindowUpdater)
func (*VIDYA) CalculateAndUpdate ¶ added in v1.37.0
func (*VIDYA) EmitUpdate ¶ added in v1.31.0
type VWAP ¶ added in v1.16.0
type VWAP struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
Prices types.Float64Slice
Volumes types.Float64Slice
WeightedSum float64
VolumeSum float64
EndTime time.Time
UpdateCallbacks []func(value float64)
}
vwap implements the volume weighted average price (VWAP) indicator:
Volume Weighted Average Price (VWAP) Definition - https://www.investopedia.com/terms/v/vwap.asp
Volume-Weighted Average Price (VWAP) Explained - https://academy.binance.com/en/articles/volume-weighted-average-price-vwap-explained
func (*VWAP) Bind ¶ added in v1.16.0
func (inc *VWAP) Bind(updater KLineWindowUpdater)
func (*VWAP) CalculateAndUpdate ¶ added in v1.37.0
func (*VWAP) EmitUpdate ¶ added in v1.16.0
type VWMA ¶ added in v1.21.0
type VWMA struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
PriceVolumeSMA *SMA
VolumeSMA *SMA
EndTime time.Time
// contains filtered or unexported fields
}
vwma implements the volume weighted moving average (VWMA) indicator:
Calculation:
pv = element-wise multiplication of close prices and volumes VWMA = SMA(pv, window) / SMA(volumes, window)
Volume Weighted Moving Average - https://www.motivewave.com/studies/volume_weighted_moving_average.htm
func (*VWMA) Bind ¶ added in v1.21.0
func (inc *VWMA) Bind(updater KLineWindowUpdater)
func (*VWMA) CalculateAndUpdate ¶ added in v1.37.0
func (*VWMA) EmitUpdate ¶ added in v1.21.0
type Volatility ¶ added in v1.37.0
type Volatility struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
EndTime time.Time
UpdateCallbacks []func(value float64)
}
func (*Volatility) Bind ¶ added in v1.37.0
func (inc *Volatility) Bind(updater KLineWindowUpdater)
func (*Volatility) CalculateAndUpdate ¶ added in v1.37.0
func (inc *Volatility) CalculateAndUpdate(allKLines []types.KLine)
func (*Volatility) EmitUpdate ¶ added in v1.37.0
func (inc *Volatility) EmitUpdate(value float64)
func (*Volatility) Index ¶ added in v1.37.0
func (inc *Volatility) Index(i int) float64
func (*Volatility) Last ¶ added in v1.37.0
func (inc *Volatility) Last() float64
func (*Volatility) Length ¶ added in v1.37.0
func (inc *Volatility) Length() int
func (*Volatility) OnUpdate ¶ added in v1.37.0
func (inc *Volatility) OnUpdate(cb func(value float64))
type WWMA ¶ added in v1.31.0
type WWMA struct {
types.SeriesBase
types.IntervalWindow
Values types.Float64Slice
LastOpenTime time.Time
UpdateCallbacks []func(value float64)
}
func (*WWMA) Bind ¶ added in v1.31.0
func (inc *WWMA) Bind(updater KLineWindowUpdater)
func (*WWMA) CalculateAndUpdate ¶ added in v1.37.0
func (*WWMA) EmitUpdate ¶ added in v1.31.0
type ZLEMA ¶ added in v1.31.0
type ZLEMA struct {
types.SeriesBase
types.IntervalWindow
// contains filtered or unexported fields
}
func (*ZLEMA) Bind ¶ added in v1.31.0
func (inc *ZLEMA) Bind(updater KLineWindowUpdater)
func (*ZLEMA) CalculateAndUpdate ¶ added in v1.37.0
func (*ZLEMA) EmitUpdate ¶ added in v1.31.0
Source Files
¶
- ad.go
- ad_callbacks.go
- alma.go
- alma_callbacks.go
- atr.go
- atr_callbacks.go
- atrp.go
- atrp_callbacks.go
- boll.go
- boll_callbacks.go
- ca_callbacks.go
- cci.go
- cci_callbacks.go
- cma.go
- const.go
- dema.go
- dema_callbacks.go
- dmi.go
- dmi_callbacks.go
- drift.go
- drift_callbacks.go
- emv.go
- emv_callbacks.go
- ewma.go
- ewma_callbacks.go
- fisher.go
- fishertransform_callbacks.go
- hull.go
- hull_callbacks.go
- interface.go
- line.go
- low.go
- low_callbacks.go
- macd.go
- macd_callbacks.go
- mapper.go
- obv.go
- obv_callbacks.go
- pivot.go
- pivot_callbacks.go
- pivot_low.go
- pivotlow_callbacks.go
- rma.go
- rma_callbacks.go
- rsi.go
- rsi_callbacks.go
- sma.go
- sma_callbacks.go
- ssf.go
- ssf_callbacks.go
- stddev.go
- stddev_callbacks.go
- stoch.go
- stoch_callbacks.go
- supertrend.go
- supertrend_callbacks.go
- tema.go
- tema_callbacks.go
- till.go
- till_callbacks.go
- tma.go
- tma_callbacks.go
- util.go
- vidya.go
- vidya_callbacks.go
- volatility.go
- volatility_callbacks.go
- vwap.go
- vwap_callbacks.go
- vwma.go
- vwma_callbacks.go
- wwma.go
- wwma_callbacks.go
- zlema.go
- zlema_callbacks.go