Documentation
¶
Overview ¶
Package chartind holds the technical-indicator implementations for the candle chart. Each type satisfies candlechart.Indicator — it turns a candle series into the overlay line(s) the chart draws. The chart owns the wiring and the drawing; this package owns only the math, computed over the shared indicators library (which wraps go-talib). Add an indicator by adding a type here that implements candlechart.Indicator; nothing in candlechart changes.
Inputs are the chart's float64 candles (a chart is a visual artifact, so prices are already floats here) and outputs are overlay values aligned 1:1 with the input, NaN for warm-up positions — the chart breaks the line across a NaN. An indicator with no value for the given series returns nil.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EMA ¶
EMA overlays the exponential moving average of candle closes as one line. Period is the EMA length in bars (e.g. 20); Color overrides the chart's default overlay color when non-nil.
func (EMA) Overlays ¶
func (e EMA) Overlays(cs []candlechart.Candle) []candlechart.Overlay
Overlays computes the EMA line for cs. It returns nil for a non-positive period or an empty series; a series shorter than the warm-up still returns one overlay whose values are all NaN (the chart simply draws no line yet).