Documentation
¶
Index ¶
- Constants
- func AddSlices(slice1, slice2 []float64) []float64
- func AddToAll(slice []float64, val float64) []float64
- func Avg(data []float64) float64
- func DivSlice(slice []float64, n float64) []float64
- func EMA(series []float64, period int) []float64
- func ExponentialMovingAverage(series []float64, period int) []float64
- func MA(series []float64, period int) []float64
- func RMI(series []float64, fastRMIlength, fastMomentum, slowRMIlength, slowMomentum int) ([]float64, []float64)
- func ROC100(series []float64, period int) []float64
- func RateOfChange100(series []float64, period int) []float64
- func SMA(series []float64, period int) []float64
- func SimpleMovingAverage(series []float64, period int) []float64
- func StandardDeviation(series []float64, period int) float64
- func Std(slice []float64, period int) float64
- func SubSlices(slice1, slice2 []float64) []float64
- func Sum(data []float64) float64
- type Comparison
- type Indicator
- type IndicatorStruct
- func (m IndicatorStruct) Current() float64
- func (m IndicatorStruct) GetName() string
- func (m IndicatorStruct) GetParams() Param
- func (m IndicatorStruct) GetPeriod() int
- func (m *IndicatorStruct) Historic(index int) float64
- func (m IndicatorStruct) LargerThanInd(ind Indicator) []bool
- func (m IndicatorStruct) LargerThanValue(ind Indicator) bool
- func (m *IndicatorStruct) SetParams(low float64, high float64)
- func (m IndicatorStruct) Values() []float64
- type OHLC
- type Param
- type Updatable
Constants ¶
const ( //Open value will be used for the data Open = iota //High value will be used for the data High //Low value will be used for the data Low //Close value will be used for the data Close //Volume value will be used for the data Volume //Default is used when the data is something else than ohlcv Default )
Variables ¶
This section is empty.
Functions ¶
func EMA ¶
EMA is to start a new exponential moving average EMA = Price(t) * k + EMA(y) * (1 – k) t = today, y = yesterday, N = number of days in EMA, k = 2/(N+1)
func ExponentialMovingAverage ¶
ExponentialMovingAverage is to start a new exponential moving average
func RMI ¶
func RMI(series []float64, fastRMIlength, fastMomentum, slowRMIlength, slowMomentum int) ([]float64, []float64)
************************* CALCULATION ***************************** FastemaInc = ema(max(close - close[FastMomentum], 0), FastLenght) FastemaDec = ema(max(close[FastMomentum] - close, 0), FastLenght) FastRMI = FastemaDec == 0 ? 0 : 50 - 100 / (1 + FastemaInc / FastemaDec)
SlowemaInc = ema(max(close - close[SlowMomentum], 0), SlowLenght) SlowemaDec = ema(max(close[SlowMomentum] - close, 0), SlowLenght) SlowRMI = SlowemaDec == 0 ? 0 : 50 - 100 / (1 + SlowemaInc / SlowemaDec)
********************************************************************
func RateOfChange100 ¶
RateOfChange100 is used to get a value between 1 and 100 to pin point the rate of change ROC=(previous value / current value−1)∗100
func SimpleMovingAverage ¶
SimpleMovingAverage to start a new moving average
func StandardDeviation ¶
Std returns standard deviation of a slice.
Types ¶
type Comparison ¶
Comparison type interface
type Indicator ¶
type Indicator interface { Historic(index int) float64 Current() float64 Values() []float64 Update(values []float64) GetDataType() OHLC GetName() string GetPeriod() int }
Indicator Interface for all indicators
type IndicatorStruct ¶
type IndicatorStruct struct {
// contains filtered or unexported fields
}
IndicatorStruct contains a default set of values
func (IndicatorStruct) Current ¶
func (m IndicatorStruct) Current() float64
func (IndicatorStruct) GetName ¶
func (m IndicatorStruct) GetName() string
func (IndicatorStruct) GetParams ¶
func (m IndicatorStruct) GetParams() Param
func (IndicatorStruct) GetPeriod ¶
func (m IndicatorStruct) GetPeriod() int
func (*IndicatorStruct) Historic ¶
func (m *IndicatorStruct) Historic(index int) float64
func (IndicatorStruct) LargerThanInd ¶
func (m IndicatorStruct) LargerThanInd(ind Indicator) []bool
LargerThanInd
func (IndicatorStruct) LargerThanValue ¶
func (m IndicatorStruct) LargerThanValue(ind Indicator) bool
LargerThan the larger than operator
func (*IndicatorStruct) SetParams ¶
func (m *IndicatorStruct) SetParams(low float64, high float64)
func (IndicatorStruct) Values ¶
func (m IndicatorStruct) Values() []float64