indicators

package
v0.0.0-...-de2183f Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MinNumPeriods = 2

Variables

This section is empty.

Functions

func EMAWeightingMultiplier

func EMAWeightingMultiplier(len int) float64

func PDMAndNDM

func PDMAndNDM(cur, prev *models.OHLC) (float64, float64)

func TrueRange

func TrueRange(cur, prev *models.OHLC) float64

Types

type ATR

type ATR struct {
	// contains filtered or unexported fields
}

func NewATR

func NewATR(period int) *ATR

func (*ATR) Current

func (atr *ATR) Current() float64

func (*ATR) Period

func (atr *ATR) Period() int

func (*ATR) Update

func (atr *ATR) Update(cur *models.OHLC)

func (*ATR) Warm

func (atr *ATR) Warm() bool

type Aroon

type Aroon struct {
	// contains filtered or unexported fields
}

func NewAroon

func NewAroon(period int) *Aroon

func (*Aroon) Down

func (ind *Aroon) Down() float64

func (*Aroon) Up

func (ind *Aroon) Up() float64

func (*Aroon) Update

func (ind *Aroon) Update(val float64)

func (*Aroon) Warm

func (ind *Aroon) Warm() bool

func (*Aroon) WarmupPeriod

func (ind *Aroon) WarmupPeriod() int

type AroonOsc

type AroonOsc struct {
	// contains filtered or unexported fields
}

func NewAroonOsc

func NewAroonOsc(period int) *AroonOsc

func (*AroonOsc) Diff

func (osc *AroonOsc) Diff() float64

func (*AroonOsc) Down

func (osc *AroonOsc) Down() float64

func (*AroonOsc) Up

func (osc *AroonOsc) Up() float64

func (*AroonOsc) Update

func (osc *AroonOsc) Update(val float64)

func (*AroonOsc) Warm

func (osc *AroonOsc) Warm() bool

func (*AroonOsc) WarmupPeriod

func (osc *AroonOsc) WarmupPeriod() int

type DMI

type DMI struct {
	// contains filtered or unexported fields
}

DMI is a Directional Movement Index indicator.

func NewDMI

func NewDMI(period int) *DMI

func (*DMI) DX

func (ind *DMI) DX() float64

DX returns the directional index value.

func (*DMI) NDI

func (ind *DMI) NDI() float64

NDI returns the negative directional index value.

func (*DMI) PDI

func (ind *DMI) PDI() float64

PDI returns the positive directional index value.

func (*DMI) Update

func (ind *DMI) Update(b *models.Bar)

func (*DMI) Warm

func (ind *DMI) Warm() bool

func (*DMI) WarmupPeriod

func (ind *DMI) WarmupPeriod() int

type EMA

type EMA struct {
	// contains filtered or unexported fields
}

func NewEMA

func NewEMA(len int) *EMA

func (*EMA) Current

func (ema *EMA) Current() float64

func (*EMA) Period

func (ema *EMA) Period() int

func (*EMA) Update

func (ema *EMA) Update(val float64)

func (*EMA) Warm

func (ema *EMA) Warm() bool

type EMV

type EMV struct {
	// contains filtered or unexported fields
}

EMV is an Ease of Movement Value indicator.

func NewEMV

func NewEMV() *EMV

func (*EMV) EMV

func (emv *EMV) EMV() float64

EMV returns the ease of movement value.

func (*EMV) Update

func (emv *EMV) Update(cur *models.Bar)

func (*EMV) Warm

func (emv *EMV) Warm() bool

func (*EMV) WarmupPeriod

func (emv *EMV) WarmupPeriod() int

type LinRegression

type LinRegression struct {
	// contains filtered or unexported fields
}

func NewLinRegression

func NewLinRegression(length int) *LinRegression

func (*LinRegression) Intercept

func (lr *LinRegression) Intercept() float64

func (*LinRegression) Slope

func (lr *LinRegression) Slope() float64

func (*LinRegression) Update

func (lr *LinRegression) Update(val float64)

func (*LinRegression) Warm

func (lr *LinRegression) Warm() bool

func (*LinRegression) WarmupPeriod

func (lr *LinRegression) WarmupPeriod() int

type MAOrdering

type MAOrdering struct {
	MAs []*EMA
	// contains filtered or unexported fields
}

func NewMAOrdering

func NewMAOrdering(periods []int) *MAOrdering

func (*MAOrdering) Correlation

func (ind *MAOrdering) Correlation() float64

func (*MAOrdering) Update

func (ind *MAOrdering) Update(val float64)

func (*MAOrdering) Warm

func (ind *MAOrdering) Warm() bool

func (*MAOrdering) WarmupPeriod

func (ind *MAOrdering) WarmupPeriod() int

type Pivot

type Pivot struct {
	Type   PivotType
	Length int
	Value  float64
}

func NewPivotHigh

func NewPivotHigh(length int, val float64) *Pivot

func NewPivotLow

func NewPivotLow(length int, val float64) *Pivot

func NewPivotNeutral

func NewPivotNeutral(length int, val float64) *Pivot

type PivotType

type PivotType int
const (
	PivotNeutral PivotType = iota
	PivotLow
	PivotHigh
)

type Pivots

type Pivots struct {
	Length  int
	NPivots int
	// contains filtered or unexported fields
}

func NewPivots

func NewPivots(length, nPivots int) (*Pivots, error)

func (*Pivots) Direction

func (zz *Pivots) Direction() models.Direction

func (*Pivots) LastPivot

func (zz *Pivots) LastPivot() *Pivot

func (*Pivots) Update

func (zz *Pivots) Update(val float64) (piv *Pivot, age int, pivotDetected bool)

func (*Pivots) WarmUp

func (zz *Pivots) WarmUp(vals []float64) error

func (*Pivots) WarmupPeriod

func (zz *Pivots) WarmupPeriod() int

type SMA

type SMA struct {
	// contains filtered or unexported fields
}

func NewSMA

func NewSMA(len int) *SMA

func (*SMA) Current

func (sma *SMA) Current() float64

func (*SMA) Period

func (sma *SMA) Period() int

func (*SMA) Update

func (sma *SMA) Update(val float64)

func (*SMA) Warm

func (sma *SMA) Warm() bool

Jump to

Keyboard shortcuts

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