Documentation ¶
Index ¶
Constants ¶
const ( FlatTrend float64 = 0 UpTrend float64 = 1 DownTrend float64 = -1 )
Variables ¶
This section is empty.
Functions ¶
func TrendWithFlatMaxDiffInPercent ¶ added in v0.7.0
TrendWithFlatMaxDiffInPercent allows to pass flatMaxDiff in percent. The default value is false
Types ¶
type AverageTrueRange ¶
type AverageTrueRange struct {
// contains filtered or unexported fields
}
AverageTrueRange represents indicator to calculate Average True Range (ATR) https://en.wikipedia.org/wiki/Average_true_range
func (*AverageTrueRange) Calculate ¶
func (ind *AverageTrueRange) Calculate(index int) float64
type AverageVolume ¶ added in v0.3.0
type AverageVolume struct {
// contains filtered or unexported fields
}
AverageVolume is a indicator to calculate average volume for given smoothInterval using simple moving average
func NewAverageVolume ¶ added in v0.3.0
func NewAverageVolume(series *timeseries.TimeSeries, period int) *AverageVolume
func (*AverageVolume) Calculate ¶ added in v0.3.0
func (av *AverageVolume) Calculate(index int) float64
type ExponentialMovingAverage ¶ added in v0.4.0
type ExponentialMovingAverage struct {
// contains filtered or unexported fields
}
ExponentialMovingAverage represents indicator to calculate Exponential Moving Average (EMA)
func NewExponentialMovingAverage ¶ added in v0.4.0
func NewExponentialMovingAverage(series *timeseries.TimeSeries, smoothInterval int) (*ExponentialMovingAverage, error)
func (*ExponentialMovingAverage) Calculate ¶ added in v0.4.0
func (a *ExponentialMovingAverage) Calculate(index int) float64
type Indicator ¶
Indicator represents interface for indicators
func NewAverageTrueRange ¶
func NewAverageTrueRange(series *timeseries.TimeSeries, period int) Indicator
type MockIndicator ¶ added in v0.2.0
MockIndicator is an autogenerated mock type for the Indicator type
func (*MockIndicator) Calculate ¶ added in v0.2.0
func (_m *MockIndicator) Calculate(index int) float64
Calculate provides a mock function with given fields: index
type Trend ¶ added in v0.6.0
type Trend struct {
// contains filtered or unexported fields
}
Trend returns a trend direction. It bases on fast (with shorter period) and slow EMA. flatMaxDiff allows setting max difference between fast and slow EMA when Calculate returns the flat.
type TrendOption ¶ added in v0.7.0
type TrendOption func(*Trend)
type VolumeWeightedAveragePrice ¶ added in v0.5.0
type VolumeWeightedAveragePrice struct {
// contains filtered or unexported fields
}
VolumeWeightedAveragePrice represents indicator to calculate volume-weighted average price (VWAP). More details https://en.wikipedia.org/wiki/Volume-weighted_average_price
func NewVolumeWeightedAveragePrice ¶ added in v0.5.0
func NewVolumeWeightedAveragePrice(series *timeseries.TimeSeries) *VolumeWeightedAveragePrice
NewVolumeWeightedAveragePrice creates VolumeWeightedAveragePrice
func (*VolumeWeightedAveragePrice) Calculate ¶ added in v0.5.0
func (v *VolumeWeightedAveragePrice) Calculate(index int) float64
Calculate returns VWAP value for candle with given index