indicator

package
v1.46.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2023 License: AGPL-3.0 Imports: 8 Imported by: 28

Documentation

Index

Constants

View Source
const DPeriod int = 3
View Source
const DefaultEMVScale float64 = 100000000.
View Source
const MaxNumOfALMA = 5_000
View Source
const MaxNumOfALMATruncateSize = 100
View Source
const MaxNumOfATR = 1000
View Source
const MaxNumOfATRTruncateSize = 500
View Source
const MaxNumOfEWMA = 1_000

These numbers should be aligned with bbgo MaxNumOfKLines and MaxNumOfKLinesTruncate

View Source
const MaxNumOfEWMATruncateSize = 500
View Source
const MaxNumOfRMA = 1000
View Source
const MaxNumOfRMATruncateSize = 500
View Source
const MaxNumOfSMA = 5_000
View Source
const MaxNumOfSMATruncateSize = 100
View Source
const MaxNumOfStdev = 600
View Source
const MaxNumOfStdevTruncateSize = 300
View Source
const MaxNumOfVOL = 5_000
View Source
const MaxNumOfVOLTruncateSize = 100
View Source
const MaxNumOfWWMA = 5_000
View Source
const MaxNumOfWWMATruncateSize = 100

Variables

This section is empty.

Functions

func CalculateKLinesEMA added in v1.3.1

func CalculateKLinesEMA(allKLines []types.KLine, priceF KLineValueMapper, window int) float64

func KLineClosePriceMapper added in v1.2.1

func KLineClosePriceMapper(k types.KLine) float64

func KLineHighPriceMapper added in v1.33.0

func KLineHighPriceMapper(k types.KLine) float64

func KLineLowPriceMapper added in v1.33.0

func KLineLowPriceMapper(k types.KLine) float64

func KLineOpenPriceMapper added in v1.2.1

func KLineOpenPriceMapper(k types.KLine) float64

func KLinePriceVolumeMapper added in v1.21.0

func KLinePriceVolumeMapper(k types.KLine) float64

func KLineTypicalPriceMapper added in v1.16.0

func KLineTypicalPriceMapper(k types.KLine) float64

func KLineVolumeMapper added in v1.21.0

func KLineVolumeMapper(k types.KLine) float64

func MapKLinePrice added in v1.2.1

func MapKLinePrice(kLines []types.KLine, f KLineValueMapper) (prices []float64)

Types

type AD struct {
	types.SeriesBase
	types.IntervalWindow
	Values   floats.Slice
	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 (inc *AD) CalculateAndUpdate(kLines []types.KLine)

func (*AD) EmitUpdate added in v1.16.0

func (inc *AD) EmitUpdate(value float64)

func (*AD) Index added in v1.30.2

func (inc *AD) Index(i int) float64

func (*AD) Last added in v1.16.0

func (inc *AD) Last() float64

func (*AD) Length added in v1.30.2

func (inc *AD) Length() int

func (*AD) OnUpdate added in v1.16.0

func (inc *AD) OnUpdate(cb func(value float64))

func (*AD) Update added in v1.29.0

func (inc *AD) Update(high, low, cloze, volume float64)

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          floats.Slice
	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

The Arnaud Legoux Moving Average (ALMA) is a technical analysis indicator that is used to smooth price data and reduce the lag associated with traditional moving averages. It was developed by Arnaud Legoux and is based on the weighted moving average, with the weighting factors determined using a Gaussian function. The ALMA is calculated by taking the weighted moving average of the input data using weighting factors that are based on the standard deviation of the data and the specified length of the moving average. This resulting average is then plotted on the price chart as a line, which can be used to make predictions about future price movements. The ALMA is typically more responsive to changes in the underlying data than a simple moving average, but may be less reliable in trending markets.

@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 (inc *ALMA) CalculateAndUpdate(allKLines []types.KLine)

func (*ALMA) EmitUpdate added in v1.34.0

func (inc *ALMA) EmitUpdate(value float64)

func (*ALMA) Index added in v1.34.0

func (inc *ALMA) Index(i int) float64

func (*ALMA) Last added in v1.34.0

func (inc *ALMA) Last() float64

func (*ALMA) Length added in v1.34.0

func (inc *ALMA) Length() int

func (*ALMA) OnUpdate added in v1.34.0

func (inc *ALMA) OnUpdate(cb func(value float64))

func (*ALMA) Update added in v1.34.0

func (inc *ALMA) Update(value float64)

type ATR added in v1.31.0

type ATR struct {
	types.SeriesBase
	types.IntervalWindow
	PercentageVolatility floats.Slice

	PreviousClose float64
	RMA           *RMA

	EndTime         time.Time
	UpdateCallbacks []func(value float64)
}

func (*ATR) Clone added in v1.38.0

func (inc *ATR) Clone() *ATR

func (*ATR) EmitUpdate added in v1.31.0

func (inc *ATR) EmitUpdate(value float64)

func (*ATR) Index added in v1.31.0

func (inc *ATR) Index(i int) float64

func (*ATR) Last added in v1.31.0

func (inc *ATR) Last() float64

func (*ATR) Length added in v1.31.0

func (inc *ATR) Length() int

func (*ATR) OnUpdate added in v1.31.0

func (inc *ATR) OnUpdate(cb func(value float64))

func (*ATR) PushK added in v1.37.0

func (inc *ATR) PushK(k types.KLine)

func (*ATR) TestUpdate added in v1.38.0

func (inc *ATR) TestUpdate(high, low, cloze float64) *ATR

func (*ATR) Update added in v1.31.0

func (inc *ATR) Update(high, low, cloze float64)

type ATRP added in v1.37.0

type ATRP struct {
	types.SeriesBase
	types.IntervalWindow
	PercentageVolatility floats.Slice

	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

The Average True Range Percentage (ATRP) is a technical analysis indicator that measures the volatility of a security's price. It is calculated by dividing the Average True Range (ATR) of the security by its closing price, and then multiplying the result by 100 to convert it to a percentage. The ATR is a measure of the range of a security's price, taking into account gaps between trading periods and any limit moves (sharp price movements that are allowed under certain exchange rules). The ATR is typically smoothed using a moving average to make it more responsive to changes in the underlying price data. The ATRP is a useful indicator for traders because it provides a way to compare the volatility of different securities, regardless of their individual prices. It can also be used to identify potential entry and exit points for trades based on changes in the security's volatility.

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 (inc *ATRP) CalculateAndUpdate(kLines []types.KLine)

func (*ATRP) EmitUpdate added in v1.37.0

func (inc *ATRP) EmitUpdate(value float64)

func (*ATRP) Index added in v1.37.0

func (inc *ATRP) Index(i int) float64

func (*ATRP) Last added in v1.37.0

func (inc *ATRP) Last() float64

func (*ATRP) Length added in v1.37.0

func (inc *ATRP) Length() int

func (*ATRP) OnUpdate added in v1.37.0

func (inc *ATRP) OnUpdate(cb func(value float64))

func (*ATRP) PushK added in v1.37.0

func (inc *ATRP) PushK(k types.KLine)

func (*ATRP) Update added in v1.37.0

func (inc *ATRP) Update(high, low, cloze float64)

type BOLL

type BOLL struct {
	types.IntervalWindow

	// K is the multiplier of Std, generally it's 2
	K float64

	SMA    *SMA
	StdDev *StdDev

	UpBand   floats.Slice
	DownBand floats.Slice

	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 (inc *BOLL) CalculateAndUpdate(allKLines []types.KLine)

func (*BOLL) EmitUpdate

func (inc *BOLL) EmitUpdate(sma float64, upBand float64, downBand float64)

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 (inc *BOLL) LastDownBand() float64

func (*BOLL) LastUpBand

func (inc *BOLL) LastUpBand() float64

func (*BOLL) LoadK added in v1.38.0

func (inc *BOLL) LoadK(allKLines []types.KLine)

func (*BOLL) OnUpdate

func (inc *BOLL) OnUpdate(cb func(sma float64, upBand float64, downBand float64))

func (*BOLL) PushK added in v1.37.0

func (inc *BOLL) PushK(k types.KLine)

func (*BOLL) Update added in v1.34.0

func (inc *BOLL) Update(value float64)

type BandType added in v1.30.2

type BandType int

type CA added in v1.31.0

type CA struct {
	types.SeriesBase
	Interval types.Interval
	Values   floats.Slice

	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 (inc *CA) CalculateAndUpdate(allKLines []types.KLine)

func (*CA) EmitUpdate added in v1.31.0

func (inc *CA) EmitUpdate(value float64)

func (*CA) Index added in v1.31.0

func (inc *CA) Index(i int) float64

func (*CA) Last added in v1.31.0

func (inc *CA) Last() float64

func (*CA) Length added in v1.31.0

func (inc *CA) Length() int

func (*CA) OnUpdate added in v1.31.0

func (inc *CA) OnUpdate(cb func(value float64))

func (*CA) PushK added in v1.37.0

func (inc *CA) PushK(k types.KLine)

func (*CA) Update added in v1.31.0

func (inc *CA) Update(x float64)

type CCI added in v1.33.0

type CCI struct {
	types.SeriesBase
	types.IntervalWindow
	Input        floats.Slice
	TypicalPrice floats.Slice
	MA           floats.Slice
	Values       floats.Slice

	UpdateCallbacks []func(value float64)
}

func (*CCI) Bind added in v1.33.0

func (inc *CCI) Bind(updater KLineWindowUpdater)

func (*CCI) CalculateAndUpdate added in v1.37.0

func (inc *CCI) CalculateAndUpdate(allKLines []types.KLine)

func (*CCI) EmitUpdate added in v1.33.0

func (inc *CCI) EmitUpdate(value float64)

func (*CCI) Index added in v1.33.0

func (inc *CCI) Index(i int) float64

func (*CCI) Last added in v1.33.0

func (inc *CCI) Last() float64

func (*CCI) Length added in v1.33.0

func (inc *CCI) Length() int

func (*CCI) OnUpdate added in v1.33.0

func (inc *CCI) OnUpdate(cb func(value float64))

func (*CCI) PushK added in v1.37.0

func (inc *CCI) PushK(k types.KLine)

func (*CCI) Update added in v1.33.0

func (inc *CCI) Update(value float64)

type DEMA added in v1.31.0

type DEMA struct {
	types.IntervalWindow
	types.SeriesBase
	Values floats.Slice

	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 (inc *DEMA) CalculateAndUpdate(allKLines []types.KLine)

func (*DEMA) Clone added in v1.38.0

func (inc *DEMA) Clone() *DEMA

func (*DEMA) EmitUpdate added in v1.31.0

func (inc *DEMA) EmitUpdate(value float64)

func (*DEMA) Index added in v1.31.0

func (inc *DEMA) Index(i int) float64

func (*DEMA) Last added in v1.31.0

func (inc *DEMA) Last() float64

func (*DEMA) Length added in v1.31.0

func (inc *DEMA) Length() int

func (*DEMA) OnUpdate added in v1.31.0

func (inc *DEMA) OnUpdate(cb func(value float64))

func (*DEMA) PushK added in v1.37.0

func (inc *DEMA) PushK(k types.KLine)

func (*DEMA) TestUpdate added in v1.38.0

func (inc *DEMA) TestUpdate(value float64) *DEMA

func (*DEMA) Update added in v1.31.0

func (inc *DEMA) Update(value float64)

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
}

func (*DMI) Bind added in v1.35.0

func (inc *DMI) Bind(updater KLineWindowUpdater)

func (*DMI) CalculateAndUpdate added in v1.37.0

func (inc *DMI) CalculateAndUpdate(allKLines []types.KLine)

func (*DMI) EmitUpdate added in v1.35.0

func (inc *DMI) EmitUpdate(diplus float64, diminus float64, adx float64)

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

func (*DMI) Length added in v1.35.0

func (inc *DMI) Length() int

func (*DMI) OnUpdate added in v1.35.0

func (inc *DMI) OnUpdate(cb func(diplus float64, diminus float64, adx float64))

func (*DMI) PushK added in v1.37.0

func (inc *DMI) PushK(k types.KLine)

func (*DMI) Update added in v1.35.0

func (inc *DMI) Update(high, low, cloze float64)

type Drift added in v1.33.1

type Drift struct {
	types.SeriesBase
	types.IntervalWindow

	Values    floats.Slice
	MA        types.UpdatableSeriesExtend
	LastValue float64

	UpdateCallbacks []func(value float64)
	// contains filtered or unexported fields
}

func (*Drift) Bind added in v1.33.1

func (inc *Drift) Bind(updater KLineWindowUpdater)

func (*Drift) CalculateAndUpdate added in v1.37.0

func (inc *Drift) CalculateAndUpdate(allKLines []types.KLine)

func (*Drift) Clone added in v1.38.0

func (inc *Drift) Clone() (out *Drift)

func (*Drift) EmitUpdate added in v1.33.1

func (inc *Drift) EmitUpdate(value float64)

func (*Drift) Index added in v1.33.1

func (inc *Drift) Index(i int) float64

func (*Drift) Last added in v1.33.1

func (inc *Drift) Last() float64

func (*Drift) Length added in v1.33.1

func (inc *Drift) Length() int

func (*Drift) OnUpdate added in v1.33.1

func (inc *Drift) OnUpdate(cb func(value float64))

func (*Drift) PushK added in v1.37.0

func (inc *Drift) PushK(k types.KLine)

func (*Drift) TestUpdate added in v1.38.0

func (inc *Drift) TestUpdate(value float64) *Drift

func (*Drift) Update added in v1.33.1

func (inc *Drift) Update(value float64)

func (*Drift) ZeroPoint added in v1.38.0

func (inc *Drift) ZeroPoint() float64

Assume that MA is SMA

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

func (inc *EMV) EmitUpdate(value float64)

func (*EMV) Index added in v1.33.0

func (inc *EMV) Index(i int) float64

func (*EMV) Last added in v1.33.0

func (inc *EMV) Last() float64

func (*EMV) Length added in v1.33.0

func (inc *EMV) Length() int

func (*EMV) OnUpdate added in v1.33.0

func (inc *EMV) OnUpdate(cb func(value float64))

func (*EMV) PushK added in v1.37.0

func (inc *EMV) PushK(k types.KLine)

func (*EMV) Update added in v1.33.0

func (inc *EMV) Update(high, low, vol float64)

type EWMA

type EWMA struct {
	types.IntervalWindow
	types.SeriesBase

	Values  floats.Slice
	EndTime time.Time
	// contains filtered or unexported fields
}

func (*EWMA) Clone added in v1.38.0

func (inc *EWMA) Clone() *EWMA

func (*EWMA) EmitUpdate added in v1.2.1

func (inc *EWMA) EmitUpdate(value float64)

func (*EWMA) Index added in v1.30.2

func (inc *EWMA) Index(i int) float64

func (*EWMA) Last

func (inc *EWMA) Last() float64

func (*EWMA) Length added in v1.30.2

func (inc *EWMA) Length() int

func (*EWMA) OnUpdate added in v1.2.1

func (inc *EWMA) OnUpdate(cb func(value float64))

func (*EWMA) PushK added in v1.37.0

func (inc *EWMA) PushK(k types.KLine)

func (*EWMA) TestUpdate added in v1.38.0

func (inc *EWMA) TestUpdate(value float64) *EWMA

func (*EWMA) Update added in v1.16.0

func (inc *EWMA) Update(value float64)

type FisherTransform added in v1.38.0

type FisherTransform struct {
	types.SeriesBase
	types.IntervalWindow

	Values floats.Slice

	UpdateCallbacks []func(value float64)
	// contains filtered or unexported fields
}

Fisher Transform

The Fisher Transform is a technical analysis indicator that is used to identify potential turning points in the price of a security. It is based on the idea that prices tend to be normally distributed, with most price movements being small and relatively insignificant. The Fisher Transform converts this normal distribution into a symmetrical, Gaussian distribution, with a peak at zero and a range of -1 to +1. This transformation allows for more accurate identification of price extremes, which can be used to make predictions about potential trend reversals. The Fisher Transform is calculated by taking the natural logarithm of the ratio of the security's current price to its moving average, and then double-smoothing the result. This resulting line is called the Fisher Transform line, and can be plotted on the price chart along with the security's price.

func (*FisherTransform) Clone added in v1.38.0

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 GHFilter added in v1.40.2

type GHFilter struct {
	types.SeriesBase
	types.IntervalWindow

	Values floats.Slice

	UpdateCallbacks []func(value float64)
	// contains filtered or unexported fields
}

func (*GHFilter) EmitUpdate added in v1.40.2

func (inc *GHFilter) EmitUpdate(value float64)

func (*GHFilter) Index added in v1.40.2

func (inc *GHFilter) Index(i int) float64

func (*GHFilter) Last added in v1.40.2

func (inc *GHFilter) Last() float64

func (*GHFilter) Length added in v1.40.2

func (inc *GHFilter) Length() int

func (*GHFilter) OnUpdate added in v1.40.2

func (inc *GHFilter) OnUpdate(cb func(value float64))

func (*GHFilter) PushK added in v1.40.2

func (inc *GHFilter) PushK(k types.KLine)

func (*GHFilter) Update added in v1.40.2

func (inc *GHFilter) Update(value float64)

type GMA added in v1.40.0

type GMA struct {
	types.SeriesBase
	types.IntervalWindow
	SMA             *SMA
	UpdateCallbacks []func(value float64)
}

func (*GMA) BindK added in v1.40.0

func (inc *GMA) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)

func (*GMA) Clone added in v1.40.0

func (inc *GMA) Clone() (out *GMA)

func (*GMA) EmitUpdate added in v1.40.0

func (inc *GMA) EmitUpdate(value float64)

func (*GMA) Index added in v1.40.0

func (inc *GMA) Index(i int) float64

func (*GMA) Last added in v1.40.0

func (inc *GMA) Last() float64

func (*GMA) Length added in v1.40.0

func (inc *GMA) Length() int

func (*GMA) LoadK added in v1.40.0

func (inc *GMA) LoadK(allKLines []types.KLine)

func (*GMA) OnUpdate added in v1.40.0

func (inc *GMA) OnUpdate(cb func(value float64))

func (*GMA) PushK added in v1.40.0

func (inc *GMA) PushK(k types.KLine)

func (*GMA) TestUpdate added in v1.40.0

func (inc *GMA) TestUpdate(value float64) *GMA

func (*GMA) Update added in v1.40.0

func (inc *GMA) 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

The Hull Moving Average (HMA) is a technical analysis indicator that uses a weighted moving average to reduce the lag in simple moving averages. It was developed by Alan Hull, who sought to create a moving average that was both fast and smooth. The HMA is calculated by first taking the weighted moving average of the input data using a weighting factor of W, where W is the square root of the length of the moving average. The result is then double-smoothed by taking the weighted moving average of this result using a weighting factor of W/2. This final average forms the HMA line, which can be used to make predictions about future price movements.

func (*HULL) EmitUpdate added in v1.31.0

func (inc *HULL) EmitUpdate(value float64)

func (*HULL) Index added in v1.31.0

func (inc *HULL) Index(i int) float64

func (*HULL) Last added in v1.31.0

func (inc *HULL) Last() float64

func (*HULL) Length added in v1.31.0

func (inc *HULL) Length() int

func (*HULL) OnUpdate added in v1.31.0

func (inc *HULL) OnUpdate(cb func(value float64))

func (*HULL) PushK added in v1.38.0

func (inc *HULL) PushK(k types.KLine)

func (*HULL) Update added in v1.31.0

func (inc *HULL) Update(value float64)

type KLineCalculateUpdater added in v1.37.0

type KLineCalculateUpdater interface {
	CalculateAndUpdate(allKLines []types.KLine)
}

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

type KLineClosedEmitter interface {
	OnKLineClosed(func(k types.KLine))
}

KLineClosedEmitter is currently applied to the market data stream the market data stream emits the KLine closed event to the listeners.

type KLinePusher added in v1.37.0

type KLinePusher interface {
	PushK(k types.KLine)
}

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 KLineValueMapper func(k types.KLine) float64

type KLineWindowUpdater

type KLineWindowUpdater interface {
	OnKLineWindowUpdate(func(interval types.Interval, window types.KLineWindow))
}

type KalmanFilter added in v1.40.2

type KalmanFilter struct {
	types.SeriesBase
	types.IntervalWindow
	AdditionalSmoothWindow uint

	Values floats.Slice

	UpdateCallbacks []func(value float64)
	// contains filtered or unexported fields
}

func (*KalmanFilter) EmitUpdate added in v1.40.2

func (inc *KalmanFilter) EmitUpdate(value float64)

func (*KalmanFilter) Index added in v1.40.2

func (inc *KalmanFilter) Index(i int) float64

func (*KalmanFilter) Last added in v1.40.2

func (inc *KalmanFilter) Last() float64

func (*KalmanFilter) Length added in v1.40.2

func (inc *KalmanFilter) Length() int

func (*KalmanFilter) OnUpdate added in v1.40.2

func (inc *KalmanFilter) OnUpdate(cb func(value float64))

func (*KalmanFilter) PushK added in v1.40.2

func (inc *KalmanFilter) PushK(k types.KLine)

func (*KalmanFilter) Update added in v1.40.2

func (inc *KalmanFilter) Update(value float64)

type KlingerOscillator added in v1.44.0

type KlingerOscillator struct {
	types.SeriesBase
	types.IntervalWindow
	Fast types.UpdatableSeries
	Slow types.UpdatableSeries
	VF   VolumeForce
	// contains filtered or unexported fields
}

Refer: Klinger Oscillator Refer URL: https://www.investopedia.com/terms/k/klingeroscillator.asp Explanation: The Klinger Oscillator is a technical indicator that was developed by Stephen Klinger. It is based on the assumption that there is a relationship between money flow and price movement in the stock market. The Klinger Oscillator is calculated by taking the difference between a 34-period and 55-period moving average. Usually the indicator is using together with a 9-period or 13-period of moving average as the signal line. This indicator is often used to identify potential turning points in the market, as well as to confirm the strength of a trend.

func (*KlingerOscillator) BindK added in v1.44.0

func (inc *KlingerOscillator) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)

func (*KlingerOscillator) EmitUpdate added in v1.44.0

func (inc *KlingerOscillator) EmitUpdate(value float64)

func (*KlingerOscillator) Index added in v1.44.0

func (inc *KlingerOscillator) Index(i int) float64

func (*KlingerOscillator) Last added in v1.44.0

func (inc *KlingerOscillator) Last() float64

func (*KlingerOscillator) Length added in v1.44.0

func (inc *KlingerOscillator) Length() int

func (*KlingerOscillator) OnUpdate added in v1.44.0

func (inc *KlingerOscillator) OnUpdate(cb func(value float64))

func (*KlingerOscillator) PushK added in v1.44.0

func (inc *KlingerOscillator) PushK(k types.KLine)

func (*KlingerOscillator) Update added in v1.44.0

func (inc *KlingerOscillator) Update(high, low, cloze, volume float64)

type LinReg added in v1.43.0

type LinReg struct {
	types.SeriesBase
	types.IntervalWindow

	// Values are the slopes of linear regression baseline
	Values floats.Slice
	// ValueRatios are the ratio of slope to the price
	ValueRatios floats.Slice

	EndTime         time.Time
	UpdateCallbacks []func(value float64)
	// contains filtered or unexported fields
}

LinReg is Linear Regression baseline

func (*LinReg) BindK added in v1.43.0

func (lr *LinReg) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)

func (*LinReg) EmitUpdate added in v1.43.0

func (lr *LinReg) EmitUpdate(value float64)

func (*LinReg) Index added in v1.43.0

func (lr *LinReg) Index(i int) float64

Index returns the slope of specified index

func (*LinReg) IndexRatio added in v1.43.0

func (lr *LinReg) IndexRatio(i int) float64

IndexRatio returns the slope ratio

func (*LinReg) Last added in v1.43.0

func (lr *LinReg) Last() float64

Last slope of linear regression baseline

func (*LinReg) LastRatio added in v1.43.0

func (lr *LinReg) LastRatio() float64

LastRatio of slope to price

func (*LinReg) Length added in v1.43.0

func (lr *LinReg) Length() int

Length of the slope values

func (*LinReg) LengthRatio added in v1.43.0

func (lr *LinReg) LengthRatio() int

LengthRatio of the slope ratio values

func (*LinReg) LoadK added in v1.43.0

func (lr *LinReg) LoadK(allKLines []types.KLine)

func (*LinReg) OnUpdate added in v1.43.0

func (lr *LinReg) OnUpdate(cb func(value float64))

func (*LinReg) PushK added in v1.43.0

func (lr *LinReg) PushK(k types.KLine)

func (*LinReg) Update added in v1.43.0

func (lr *LinReg) Update(kline types.KLine)

Update Linear Regression baseline slope

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 NewLine added in v1.30.2

func NewLine(startIndex int, startValue float64, endIndex int, endValue float64, interval types.Interval) *Line

func (*Line) Bind added in v1.30.2

func (l *Line) Bind(updater KLineWindowUpdater)

func (*Line) Index added in v1.30.2

func (l *Line) Index(i int) float64

func (*Line) Last added in v1.30.2

func (l *Line) Last() float64

func (*Line) Length added in v1.30.2

func (l *Line) Length() int

func (*Line) SetXY1 added in v1.30.2

func (l *Line) SetXY1(index int, value float64)

func (*Line) SetXY2 added in v1.30.2

func (l *Line) SetXY2(index int, value float64)

type Low added in v1.38.0

type Low struct {
	types.IntervalWindow
	types.SeriesBase

	Values  floats.Slice
	EndTime time.Time
	// contains filtered or unexported fields
}

func (*Low) EmitUpdate added in v1.38.0

func (inc *Low) EmitUpdate(value float64)

func (*Low) OnUpdate added in v1.38.0

func (inc *Low) OnUpdate(cb func(value float64))

func (*Low) PushK added in v1.38.0

func (inc *Low) PushK(k types.KLine)

func (*Low) Update added in v1.38.0

func (inc *Low) Update(value float64)

type MACD added in v1.16.0

type MACD struct {
	MACDConfig

	Values floats.Slice `json:"-"`

	Histogram floats.Slice `json:"-"`

	EndTime time.Time
	// contains filtered or unexported fields
}

func (*MACD) EmitUpdate added in v1.16.0

func (inc *MACD) EmitUpdate(macd float64, signal float64, histogram float64)

func (*MACD) Last added in v1.37.0

func (inc *MACD) Last() float64

func (*MACD) Length added in v1.38.0

func (inc *MACD) Length() int

func (*MACD) MACD added in v1.30.2

func (inc *MACD) MACD() types.SeriesExtend

func (*MACD) OnUpdate added in v1.16.0

func (inc *MACD) OnUpdate(cb func(macd float64, signal float64, histogram float64))

func (*MACD) PushK added in v1.37.0

func (inc *MACD) PushK(k types.KLine)

func (*MACD) Singals added in v1.30.2

func (inc *MACD) Singals() types.SeriesExtend

func (*MACD) Update added in v1.29.0

func (inc *MACD) Update(x float64)

type MACDConfig added in v1.41.0

type MACDConfig struct {
	types.IntervalWindow // 9

	// ShortPeriod is the short term period EMA, usually 12
	ShortPeriod int `json:"short"`
	// LongPeriod is the long term period EMA, usually 26
	LongPeriod int `json:"long"`
}

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   floats.Slice
	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

On-Balance Volume (OBV) is a technical analysis indicator that uses volume information to predict changes in stock price. The idea behind OBV is that volume precedes price: when the OBV is rising, it means that buyers are becoming more aggressive and that the stock price is likely to follow suit. When the OBV is falling, it indicates that sellers are becoming more aggressive and that the stock price is likely to decrease. OBV is calculated by adding the volume on days when the stock price closes higher and subtracting the volume on days when the stock price closes lower. This running total forms the OBV line, which can then be used to make predictions about future stock price movements.

func (*OBV) Bind added in v1.16.0

func (inc *OBV) Bind(updater KLineWindowUpdater)

func (*OBV) CalculateAndUpdate added in v1.37.0

func (inc *OBV) CalculateAndUpdate(kLines []types.KLine)

func (*OBV) EmitUpdate added in v1.16.0

func (inc *OBV) EmitUpdate(value float64)

func (*OBV) Index added in v1.36.0

func (inc *OBV) Index(i int) float64

func (*OBV) Last added in v1.16.0

func (inc *OBV) Last() float64

func (*OBV) OnUpdate added in v1.16.0

func (inc *OBV) OnUpdate(cb func(value float64))

func (*OBV) PushK added in v1.37.0

func (inc *OBV) PushK(k types.KLine)

func (*OBV) Update added in v1.29.0

func (inc *OBV) Update(price, volume float64)

type PSAR added in v1.44.0

type PSAR struct {
	types.SeriesBase
	types.IntervalWindow
	High    *types.Queue
	Low     *types.Queue
	Values  floats.Slice // Stop and Reverse
	AF      float64      // Acceleration Factor
	EP      float64
	Falling bool

	EndTime         time.Time
	UpdateCallbacks []func(value float64)
}

func (*PSAR) BindK added in v1.44.0

func (inc *PSAR) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)

func (*PSAR) EmitUpdate added in v1.44.0

func (inc *PSAR) EmitUpdate(value float64)

func (*PSAR) Last added in v1.44.0

func (inc *PSAR) Last() float64

func (*PSAR) Length added in v1.44.0

func (inc *PSAR) Length() int

func (*PSAR) OnUpdate added in v1.44.0

func (inc *PSAR) OnUpdate(cb func(value float64))

func (*PSAR) PushK added in v1.44.0

func (inc *PSAR) PushK(k types.KLine)

func (*PSAR) Update added in v1.44.0

func (inc *PSAR) Update(high, low float64)

type Pivot added in v1.33.0

type Pivot struct {
	types.IntervalWindow

	// Values
	Lows  floats.Slice // higher low
	Highs floats.Slice // 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 (inc *Pivot) CalculateAndUpdate(klines []types.KLine)

func (*Pivot) EmitUpdate added in v1.33.0

func (inc *Pivot) EmitUpdate(valueLow float64, valueHigh float64)

func (*Pivot) LastHigh added in v1.33.0

func (inc *Pivot) LastHigh() float64

func (*Pivot) LastLow added in v1.33.0

func (inc *Pivot) LastLow() float64

func (*Pivot) OnUpdate added in v1.33.0

func (inc *Pivot) OnUpdate(cb func(valueLow float64, valueHigh float64))

type PivotHigh added in v1.40.0

type PivotHigh struct {
	types.SeriesBase

	types.IntervalWindow

	Highs   floats.Slice
	Values  floats.Slice
	EndTime time.Time
	// contains filtered or unexported fields
}

func (*PivotHigh) EmitUpdate added in v1.40.0

func (inc *PivotHigh) EmitUpdate(value float64)

func (*PivotHigh) Last added in v1.40.0

func (inc *PivotHigh) Last() float64

func (*PivotHigh) Length added in v1.40.0

func (inc *PivotHigh) Length() int

func (*PivotHigh) OnUpdate added in v1.40.0

func (inc *PivotHigh) OnUpdate(cb func(value float64))

func (*PivotHigh) PushK added in v1.40.0

func (inc *PivotHigh) PushK(k types.KLine)

func (*PivotHigh) Update added in v1.40.0

func (inc *PivotHigh) Update(value float64)

type PivotLow added in v1.38.0

type PivotLow struct {
	types.SeriesBase

	types.IntervalWindow

	Lows    floats.Slice
	Values  floats.Slice
	EndTime time.Time
	// contains filtered or unexported fields
}

func (*PivotLow) EmitUpdate added in v1.38.0

func (inc *PivotLow) EmitUpdate(value float64)

func (*PivotLow) Last added in v1.38.0

func (inc *PivotLow) Last() float64

func (*PivotLow) Length added in v1.38.0

func (inc *PivotLow) Length() int

func (*PivotLow) OnUpdate added in v1.38.0

func (inc *PivotLow) OnUpdate(cb func(value float64))

func (*PivotLow) PushK added in v1.38.0

func (inc *PivotLow) PushK(k types.KLine)

func (*PivotLow) Update added in v1.38.0

func (inc *PivotLow) Update(value float64)

type PivotSupertrend added in v1.44.0

type PivotSupertrend struct {
	types.SeriesBase
	types.IntervalWindow
	ATRMultiplier float64 `json:"atrMultiplier"`
	PivotWindow   int     `json:"pivotWindow"`

	AverageTrueRange *ATR // Value must be set when initialized in strategy

	PivotLow  *PivotLow  // Value must be set when initialized in strategy
	PivotHigh *PivotHigh // Value must be set when initialized in strategy

	EndTime         time.Time
	UpdateCallbacks []func(value float64)
	// contains filtered or unexported fields
}

func (*PivotSupertrend) BindK added in v1.44.0

func (inc *PivotSupertrend) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)

func (*PivotSupertrend) Direction added in v1.44.0

func (inc *PivotSupertrend) Direction() types.Direction

GetDirection return the current trend

func (*PivotSupertrend) EmitUpdate added in v1.44.0

func (inc *PivotSupertrend) EmitUpdate(value float64)

func (*PivotSupertrend) GetSignal added in v1.44.0

func (inc *PivotSupertrend) GetSignal() types.Direction

GetSignal returns signal (Down, None or Up)

func (*PivotSupertrend) Index added in v1.44.0

func (inc *PivotSupertrend) Index(i int) float64

func (*PivotSupertrend) Last added in v1.44.0

func (inc *PivotSupertrend) Last() float64

func (*PivotSupertrend) LastSupertrendResistance added in v1.44.0

func (inc *PivotSupertrend) LastSupertrendResistance() float64

LastSupertrendResistance return the current supertrend resistance value

func (*PivotSupertrend) LastSupertrendSupport added in v1.44.0

func (inc *PivotSupertrend) LastSupertrendSupport() float64

LastSupertrendSupport return the current supertrend support value

func (*PivotSupertrend) Length added in v1.44.0

func (inc *PivotSupertrend) Length() int

func (*PivotSupertrend) LoadK added in v1.44.0

func (inc *PivotSupertrend) LoadK(allKLines []types.KLine)

func (*PivotSupertrend) OnUpdate added in v1.44.0

func (inc *PivotSupertrend) OnUpdate(cb func(value float64))

func (*PivotSupertrend) PushK added in v1.44.0

func (inc *PivotSupertrend) PushK(k types.KLine)

func (*PivotSupertrend) Update added in v1.44.0

func (inc *PivotSupertrend) Update(highPrice, lowPrice, closePrice float64)

type RMA added in v1.31.0

type RMA struct {
	types.SeriesBase
	types.IntervalWindow

	Values  floats.Slice
	EndTime time.Time

	Adjust bool
	// contains filtered or unexported fields
}

func (*RMA) Bind added in v1.31.0

func (inc *RMA) Bind(updater KLineWindowUpdater)

func (*RMA) CalculateAndUpdate added in v1.37.0

func (inc *RMA) CalculateAndUpdate(kLines []types.KLine)

func (*RMA) Clone added in v1.38.0

func (inc *RMA) Clone() types.UpdatableSeriesExtend

func (*RMA) EmitUpdate added in v1.31.0

func (inc *RMA) EmitUpdate(value float64)

func (*RMA) Index added in v1.31.0

func (inc *RMA) Index(i int) float64

func (*RMA) Last added in v1.31.0

func (inc *RMA) Last() float64

func (*RMA) Length added in v1.31.0

func (inc *RMA) Length() int

func (*RMA) OnUpdate added in v1.31.0

func (inc *RMA) OnUpdate(cb func(value float64))

func (*RMA) PushK added in v1.37.0

func (inc *RMA) PushK(k types.KLine)

func (*RMA) Update added in v1.31.0

func (inc *RMA) Update(x float64)

type RSI added in v1.29.0

type RSI struct {
	types.SeriesBase
	types.IntervalWindow
	Values          floats.Slice
	Prices          floats.Slice
	PreviousAvgLoss float64
	PreviousAvgGain float64

	EndTime time.Time
	// contains filtered or unexported fields
}

func (*RSI) Bind added in v1.29.0

func (inc *RSI) Bind(updater KLineWindowUpdater)

func (*RSI) CalculateAndUpdate added in v1.37.0

func (inc *RSI) CalculateAndUpdate(kLines []types.KLine)

func (*RSI) EmitUpdate added in v1.29.0

func (inc *RSI) EmitUpdate(value float64)

func (*RSI) Index added in v1.30.2

func (inc *RSI) Index(i int) float64

func (*RSI) Last added in v1.29.0

func (inc *RSI) Last() float64

func (*RSI) Length added in v1.30.2

func (inc *RSI) Length() int

func (*RSI) OnUpdate added in v1.29.0

func (inc *RSI) OnUpdate(cb func(value float64))

func (*RSI) PushK added in v1.37.0

func (inc *RSI) PushK(k types.KLine)

func (*RSI) Update added in v1.29.0

func (inc *RSI) Update(price float64)

type SMA

type SMA struct {
	types.SeriesBase
	types.IntervalWindow
	Values floats.Slice

	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

func (inc *SMA) EmitUpdate(value float64)

func (*SMA) Index added in v1.30.2

func (inc *SMA) Index(i int) float64

func (*SMA) Last

func (inc *SMA) Last() float64

func (*SMA) Length added in v1.30.2

func (inc *SMA) Length() int

func (*SMA) LoadK added in v1.38.0

func (inc *SMA) LoadK(allKLines []types.KLine)

func (*SMA) OnUpdate added in v1.2.1

func (inc *SMA) OnUpdate(cb func(value float64))

func (*SMA) PushK added in v1.37.0

func (inc *SMA) PushK(k types.KLine)

func (*SMA) Update added in v1.30.2

func (inc *SMA) Update(value float64)

type SSF added in v1.34.0

type SSF struct {
	types.SeriesBase
	types.IntervalWindow
	Poles int

	Values floats.Slice

	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 (inc *SSF) CalculateAndUpdate(allKLines []types.KLine)

func (*SSF) EmitUpdate added in v1.34.0

func (inc *SSF) EmitUpdate(value float64)

func (*SSF) Index added in v1.34.0

func (inc *SSF) Index(i int) float64

func (*SSF) Last added in v1.34.0

func (inc *SSF) Last() float64

func (*SSF) Length added in v1.34.0

func (inc *SSF) Length() int

func (*SSF) OnUpdate added in v1.34.0

func (inc *SSF) OnUpdate(cb func(value float64))

func (*SSF) PushK added in v1.37.0

func (inc *SSF) PushK(k types.KLine)

func (*SSF) Update added in v1.34.0

func (inc *SSF) Update(value float64)

type STOCH added in v1.17.0

type STOCH struct {
	types.IntervalWindow
	K floats.Slice
	D floats.Slice

	HighValues floats.Slice
	LowValues  floats.Slice

	EndTime         time.Time
	UpdateCallbacks []func(k float64, d float64)
}

func (*STOCH) EmitUpdate added in v1.17.0

func (inc *STOCH) EmitUpdate(k float64, d float64)

func (*STOCH) GetD added in v1.30.2

func (inc *STOCH) GetD() types.Series

func (*STOCH) GetK added in v1.30.2

func (inc *STOCH) GetK() types.Series

func (*STOCH) LastD added in v1.17.0

func (inc *STOCH) LastD() float64

func (*STOCH) LastK added in v1.17.0

func (inc *STOCH) LastK() float64

func (*STOCH) OnUpdate added in v1.17.0

func (inc *STOCH) OnUpdate(cb func(k float64, d float64))

func (*STOCH) PushK added in v1.37.0

func (inc *STOCH) PushK(k types.KLine)

func (*STOCH) Update added in v1.31.0

func (inc *STOCH) Update(high, low, cloze float64)

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 floats.Slice

	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 (inc *StdDev) CalculateAndUpdate(allKLines []types.KLine)

func (*StdDev) EmitUpdate added in v1.37.0

func (inc *StdDev) EmitUpdate(value float64)

func (*StdDev) Index added in v1.37.0

func (inc *StdDev) Index(i int) float64

func (*StdDev) Last added in v1.37.0

func (inc *StdDev) Last() float64

func (*StdDev) Length added in v1.37.0

func (inc *StdDev) Length() int

func (*StdDev) OnUpdate added in v1.37.0

func (inc *StdDev) OnUpdate(cb func(value float64))

func (*StdDev) PushK added in v1.37.0

func (inc *StdDev) PushK(k types.KLine)

func (*StdDev) Update added in v1.37.0

func (inc *StdDev) Update(value float64)

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) Direction added in v1.44.0

func (inc *Supertrend) Direction() types.Direction

GetDirection return the current trend

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) LastSupertrendResistance added in v1.44.0

func (inc *Supertrend) LastSupertrendResistance() float64

LastSupertrendResistance return the current supertrend resistance

func (*Supertrend) LastSupertrendSupport added in v1.44.0

func (inc *Supertrend) LastSupertrendSupport() float64

LastSupertrendSupport return the current supertrend support

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 floats.Slice
	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 (inc *TEMA) CalculateAndUpdate(allKLines []types.KLine)

func (*TEMA) EmitUpdate added in v1.31.0

func (inc *TEMA) EmitUpdate(value float64)

func (*TEMA) Index added in v1.31.0

func (inc *TEMA) Index(i int) float64

func (*TEMA) Last added in v1.31.0

func (inc *TEMA) Last() float64

func (*TEMA) Length added in v1.31.0

func (inc *TEMA) Length() int

func (*TEMA) OnUpdate added in v1.31.0

func (inc *TEMA) OnUpdate(cb func(value float64))

func (*TEMA) PushK added in v1.37.0

func (inc *TEMA) PushK(k types.KLine)

func (*TEMA) Update added in v1.31.0

func (inc *TEMA) Update(value float64)

type TILL added in v1.31.0

type TILL struct {
	types.SeriesBase
	types.IntervalWindow
	VolumeFactor float64
	// contains filtered or unexported fields
}

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 (inc *TILL) CalculateAndUpdate(allKLines []types.KLine)

func (*TILL) EmitUpdate added in v1.31.0

func (inc *TILL) EmitUpdate(value float64)

func (*TILL) Index added in v1.31.0

func (inc *TILL) Index(i int) float64

func (*TILL) Last added in v1.31.0

func (inc *TILL) Last() float64

func (*TILL) Length added in v1.31.0

func (inc *TILL) Length() int

func (*TILL) LoadK added in v1.38.0

func (inc *TILL) LoadK(allKLines []types.KLine)

func (*TILL) OnUpdate added in v1.31.0

func (inc *TILL) OnUpdate(cb func(value float64))

func (*TILL) PushK added in v1.37.0

func (inc *TILL) PushK(k types.KLine)

func (*TILL) Update added in v1.31.0

func (inc *TILL) Update(value float64)

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 (inc *TMA) CalculateAndUpdate(allKLines []types.KLine)

func (*TMA) EmitUpdate added in v1.31.0

func (inc *TMA) EmitUpdate(value float64)

func (*TMA) Index added in v1.31.0

func (inc *TMA) Index(i int) float64

func (*TMA) Last added in v1.31.0

func (inc *TMA) Last() float64

func (*TMA) Length added in v1.31.0

func (inc *TMA) Length() int

func (*TMA) OnUpdate added in v1.31.0

func (inc *TMA) OnUpdate(cb func(value float64))

func (*TMA) PushK added in v1.37.0

func (inc *TMA) PushK(k types.KLine)

func (*TMA) Update added in v1.31.0

func (inc *TMA) Update(value float64)

type TSI added in v1.44.0

type TSI struct {
	types.SeriesBase
	types.Interval
	FastWindow int
	SlowWindow int
	PrevValue  float64
	Values     floats.Slice
	Pcs        *EWMA
	Pcds       *EWMA
	Apcs       *EWMA
	Apcds      *EWMA
	// contains filtered or unexported fields
}

Refer: True Strength Index Refer URL: https://www.investopedia.com/terms/t/tsi.asp

func (*TSI) BindK added in v1.44.0

func (inc *TSI) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)

func (*TSI) EmitUpdate added in v1.44.0

func (inc *TSI) EmitUpdate(value float64)

func (*TSI) Index added in v1.44.0

func (inc *TSI) Index(i int) float64

func (*TSI) Last added in v1.44.0

func (inc *TSI) Last() float64

func (*TSI) Length added in v1.44.0

func (inc *TSI) Length() int

func (*TSI) OnUpdate added in v1.44.0

func (inc *TSI) OnUpdate(cb func(value float64))

func (*TSI) PushK added in v1.44.0

func (inc *TSI) PushK(k types.KLine)

func (*TSI) Update added in v1.44.0

func (inc *TSI) Update(value float64)

type UtBotAlert added in v1.44.0

type UtBotAlert struct {
	types.IntervalWindow
	KeyValue float64 `json:"keyValue"` // Should be ATRMultiplier

	Values []types.Direction

	AverageTrueRange *ATR // Value must be set when initialized in strategy

	EndTime         time.Time
	UpdateCallbacks []func(value types.Direction)
	// contains filtered or unexported fields
}

func NewUtBotAlert added in v1.44.0

func NewUtBotAlert(iw types.IntervalWindow, keyValue float64) *UtBotAlert

func (*UtBotAlert) BindK added in v1.44.0

func (inc *UtBotAlert) BindK(target KLineClosedEmitter, symbol string, interval types.Interval)

func (*UtBotAlert) EmitUpdate added in v1.44.0

func (inc *UtBotAlert) EmitUpdate(value types.Direction)

func (*UtBotAlert) GetSignal added in v1.44.0

func (inc *UtBotAlert) GetSignal() types.Direction

GetSignal returns signal (down, none or up)

func (*UtBotAlert) Index added in v1.44.0

func (inc *UtBotAlert) Index(i int) types.Direction

func (*UtBotAlert) Last added in v1.44.0

func (inc *UtBotAlert) Last() types.Direction

func (*UtBotAlert) Length added in v1.44.0

func (inc *UtBotAlert) Length() int

func (*UtBotAlert) LoadK added in v1.44.0

func (inc *UtBotAlert) LoadK(allKLines []types.KLine)

LoadK calculates the initial values

func (*UtBotAlert) OnUpdate added in v1.44.0

func (inc *UtBotAlert) OnUpdate(cb func(value types.Direction))

func (*UtBotAlert) PushK added in v1.44.0

func (inc *UtBotAlert) PushK(k types.KLine)

func (*UtBotAlert) Update added in v1.44.0

func (inc *UtBotAlert) Update(highPrice, lowPrice, closePrice float64)

type VIDYA added in v1.31.0

type VIDYA struct {
	types.SeriesBase
	types.IntervalWindow
	Values floats.Slice
	// contains filtered or unexported fields
}

func (*VIDYA) Bind added in v1.31.0

func (inc *VIDYA) Bind(updater KLineWindowUpdater)

func (*VIDYA) CalculateAndUpdate added in v1.37.0

func (inc *VIDYA) CalculateAndUpdate(allKLines []types.KLine)

func (*VIDYA) EmitUpdate added in v1.31.0

func (inc *VIDYA) EmitUpdate(value float64)

func (*VIDYA) Index added in v1.31.0

func (inc *VIDYA) Index(i int) float64

func (*VIDYA) Last added in v1.31.0

func (inc *VIDYA) Last() float64

func (*VIDYA) Length added in v1.31.0

func (inc *VIDYA) Length() int

func (*VIDYA) OnUpdate added in v1.31.0

func (inc *VIDYA) OnUpdate(cb func(value float64))

func (*VIDYA) PushK added in v1.37.0

func (inc *VIDYA) PushK(k types.KLine)

func (*VIDYA) Update added in v1.31.0

func (inc *VIDYA) Update(value float64)

type VWAP added in v1.16.0

type VWAP struct {
	types.SeriesBase
	types.IntervalWindow
	Values      floats.Slice
	Prices      floats.Slice
	Volumes     floats.Slice
	WeightedSum float64
	VolumeSum   float64

	EndTime         time.Time
	UpdateCallbacks []func(value float64)
}

func (*VWAP) Bind added in v1.16.0

func (inc *VWAP) Bind(updater KLineWindowUpdater)

func (*VWAP) CalculateAndUpdate added in v1.37.0

func (inc *VWAP) CalculateAndUpdate(allKLines []types.KLine)

func (*VWAP) EmitUpdate added in v1.16.0

func (inc *VWAP) EmitUpdate(value float64)

func (*VWAP) Index added in v1.30.2

func (inc *VWAP) Index(i int) float64

func (*VWAP) Last added in v1.29.0

func (inc *VWAP) Last() float64

func (*VWAP) Length added in v1.30.2

func (inc *VWAP) Length() int

func (*VWAP) OnUpdate added in v1.16.0

func (inc *VWAP) OnUpdate(cb func(value float64))

func (*VWAP) PushK added in v1.37.0

func (inc *VWAP) PushK(k types.KLine)

func (*VWAP) Update added in v1.29.0

func (inc *VWAP) Update(price, volume float64)

type VWMA added in v1.21.0

type VWMA struct {
	types.SeriesBase
	types.IntervalWindow

	Values         floats.Slice
	PriceVolumeSMA *SMA
	VolumeSMA      *SMA

	EndTime time.Time
	// contains filtered or unexported fields
}

func (*VWMA) Bind added in v1.21.0

func (inc *VWMA) Bind(updater KLineWindowUpdater)

func (*VWMA) CalculateAndUpdate added in v1.37.0

func (inc *VWMA) CalculateAndUpdate(allKLines []types.KLine)

func (*VWMA) EmitUpdate added in v1.21.0

func (inc *VWMA) EmitUpdate(value float64)

func (*VWMA) Index added in v1.30.2

func (inc *VWMA) Index(i int) float64

func (*VWMA) Last added in v1.21.0

func (inc *VWMA) Last() float64

func (*VWMA) Length added in v1.30.2

func (inc *VWMA) Length() int

func (*VWMA) OnUpdate added in v1.21.0

func (inc *VWMA) OnUpdate(cb func(value float64))

func (*VWMA) PushK added in v1.40.0

func (inc *VWMA) PushK(k types.KLine)

func (*VWMA) Update added in v1.37.0

func (inc *VWMA) Update(price, volume float64)

type Volatility added in v1.37.0

type Volatility struct {
	types.SeriesBase
	types.IntervalWindow
	Values  floats.Slice
	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 VolumeForce added in v1.44.0

type VolumeForce struct {
	Value float64
	// contains filtered or unexported fields
}

Utility to hold the state of calculation

func (*VolumeForce) Update added in v1.44.0

func (inc *VolumeForce) Update(high, low, cloze, volume float64)

type VolumeProfile added in v1.44.0

type VolumeProfile struct {
	types.IntervalWindow
	Delta float64
	// contains filtered or unexported fields
}

The Volume Profile is a technical analysis tool that is used to visualize the distribution of trading volume at different price levels in a security. It is typically plotted as a histogram or heatmap on the price chart, with the x-axis representing the price levels and the y-axis representing the trading volume. The Volume Profile can be used to identify areas of support and resistance, as well as potential entry and exit points for trades.

func (*VolumeProfile) PointOfControlAboveEqual added in v1.44.0

func (inc *VolumeProfile) PointOfControlAboveEqual(price float64, limit ...float64) (resultPrice float64, vol float64)

Get Resistence Level by finding PoC

func (*VolumeProfile) PointOfControlBelowEqual added in v1.44.0

func (inc *VolumeProfile) PointOfControlBelowEqual(price float64, limit ...float64) (resultPrice float64, vol float64)

Get Support Level by finding PoC

func (*VolumeProfile) Update added in v1.44.0

func (inc *VolumeProfile) Update(price, volume float64, timestamp types.Time)

type WWMA added in v1.31.0

type WWMA struct {
	types.SeriesBase
	types.IntervalWindow
	Values       floats.Slice
	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 (inc *WWMA) CalculateAndUpdate(allKLines []types.KLine)

func (*WWMA) EmitUpdate added in v1.31.0

func (inc *WWMA) EmitUpdate(value float64)

func (*WWMA) Index added in v1.31.0

func (inc *WWMA) Index(i int) float64

func (*WWMA) Last added in v1.31.0

func (inc *WWMA) Last() float64

func (*WWMA) Length added in v1.31.0

func (inc *WWMA) Length() int

func (*WWMA) OnUpdate added in v1.31.0

func (inc *WWMA) OnUpdate(cb func(value float64))

func (*WWMA) PushK added in v1.37.0

func (inc *WWMA) PushK(k types.KLine)

func (*WWMA) Update added in v1.31.0

func (inc *WWMA) Update(value float64)

type WeightedDrift added in v1.40.0

type WeightedDrift struct {
	types.SeriesBase
	types.IntervalWindow

	Values          floats.Slice
	MA              types.UpdatableSeriesExtend
	Weight          *types.Queue
	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 (*WeightedDrift) Bind added in v1.40.0

func (inc *WeightedDrift) Bind(updater KLineWindowUpdater)

func (*WeightedDrift) CalculateAndUpdate added in v1.40.0

func (inc *WeightedDrift) CalculateAndUpdate(allKLines []types.KLine)

func (*WeightedDrift) Clone added in v1.40.0

func (inc *WeightedDrift) Clone() (out *WeightedDrift)

func (*WeightedDrift) EmitUpdate added in v1.40.0

func (inc *WeightedDrift) EmitUpdate(value float64)

func (*WeightedDrift) Index added in v1.40.0

func (inc *WeightedDrift) Index(i int) float64

func (*WeightedDrift) Last added in v1.40.0

func (inc *WeightedDrift) Last() float64

func (*WeightedDrift) Length added in v1.40.0

func (inc *WeightedDrift) Length() int

func (*WeightedDrift) OnUpdate added in v1.40.0

func (inc *WeightedDrift) OnUpdate(cb func(value float64))

func (*WeightedDrift) PushK added in v1.40.0

func (inc *WeightedDrift) PushK(k types.KLine)

func (*WeightedDrift) TestUpdate added in v1.40.0

func (inc *WeightedDrift) TestUpdate(value float64, weight float64) *WeightedDrift

func (*WeightedDrift) Update added in v1.40.0

func (inc *WeightedDrift) Update(value float64, weight float64)

func (*WeightedDrift) ZeroPoint added in v1.40.0

func (inc *WeightedDrift) ZeroPoint() float64

Assume that MA is SMA

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 (inc *ZLEMA) CalculateAndUpdate(allKLines []types.KLine)

func (*ZLEMA) EmitUpdate added in v1.31.0

func (inc *ZLEMA) EmitUpdate(value float64)

func (*ZLEMA) Index added in v1.31.0

func (inc *ZLEMA) Index(i int) float64

func (*ZLEMA) Last added in v1.31.0

func (inc *ZLEMA) Last() float64

func (*ZLEMA) Length added in v1.31.0

func (inc *ZLEMA) Length() int

func (*ZLEMA) OnUpdate added in v1.31.0

func (inc *ZLEMA) OnUpdate(cb func(value float64))

func (*ZLEMA) PushK added in v1.37.0

func (inc *ZLEMA) PushK(k types.KLine)

func (*ZLEMA) Update added in v1.31.0

func (inc *ZLEMA) Update(value float64)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL