Documentation
¶
Overview ¶
Package ta holds the series of the technical analysis shared by the entry filters (agents/internal/entryfilter) and the features of the meta-labeling (agents/metalabel), following the conventions of Pine Script, as the helpers of the strategies do (agents/strategies/pine.go, unexported there): a missing value is NaN, the counterpart of Pine's na, comparisons involving NaN are false, and the recursive averages (EMA, RMA and everything built on them: ATR, RSI, DMI) are seeded with the SMA of their first length values, so they are NaN until then, like the built-ins. Every function reads its inputs only, never past their last value.
Index ¶
- Variables
- func ATR(high, low, close []float64, length int) []float64
- func DMI(high, low, close []float64, diLength, adxSmoothing int) (plusDI, minusDI, adx []float64)
- func EMA(src []float64, length int) []float64
- func EfficiencyRatio(close []float64, n int) []float64
- func Missing(n int) []float64
- func RMA(src []float64, length int) []float64
- func RSI(src []float64, length int) []float64
- func SMA(src []float64, length int) []float64
- func Stdev(src []float64, length int) []float64
- func TrueRange(high, low, close []float64, handleNa bool) []float64
Constants ¶
This section is empty.
Variables ¶
var NaN = math.NaN()
NaN is a missing value, Pine's na.
Functions ¶
func ATR ¶
ATR is ta.atr: the RMA of ta.tr(true) (Wilder, "New Concepts in Technical Trading Systems", 1978).
func DMI ¶
DMI is ta.dmi (Wilder 1978): +DI, -DI and the ADX. A bar whose average true range is zero keeps the previous DI values, as fixnan does in the reference script. The ADX of length n is known from the bar 2n-1 on.
func EfficiencyRatio ¶
EfficiencyRatio is Kaufman's efficiency ratio of length n (Perry Kaufman, "Trading Systems and Methods", the ratio of the adaptive moving average): the net move of the close over n bars over the sum of the absolute moves of each bar, |C[t]-C[t-n]| / Σ|C[i]-C[i-1]| for i from t-n+1 to t, from 0 (all noise) to 1 (a straight line); 0 for a close that didn't move at all, NaN for the first n bars.
func RSI ¶
RSI is ta.rsi (Wilder 1978): 100 while the average loss is zero, 0 while the average gain is.
func SMA ¶
SMA is ta.sma: the mean of the last length values, NaN until the window is full and while it holds a NaN.
Types ¶
This section is empty.