Indicator conversion helpers

Indicator conversion helpers

Convert SDK history into nseries.Series with the indicators package. Examples use import indicators as documentation shorthand; substitute your installation’s package import when compiling Go. These views share the SDK buffer and are valid only during the current callback.

Series API and function index · nseries package

Closes

Closes returns the series’ close column as an nseries.Series, oldest first. The conversion is a direct []float64 retype with NO copy, so the result inherits the SDK’s bulk-view lifetime rule (Section 7.6): it is valid only during the current OnBar call. Copy it (nseries.Series.Copy) if you need to keep it.

func Closes(s algolang.Series) nseries.Series

FromSeries

FromSeries converts a whole SDK series at once. No copies are made.

func FromSeries(s algolang.Series) OHLCV

Highs

Highs is Closes for the high column. Same no-copy lifetime rule.

func Highs(s algolang.Series) nseries.Series

Lows

Lows is Closes for the low column. Same no-copy lifetime rule.

func Lows(s algolang.Series) nseries.Series

OHLCV

OHLCV bundles all five columns of a lookback series as nseries views, for indicators that need more than one column (ATR, MFI, OBV, …). The fields share the lifetime rule of the individual accessors: valid only during the current OnBar call.

type OHLCV struct {
	Open, High, Low, Close, Volume nseries.Series
}

Opens

Opens is Closes for the open column. Same no-copy lifetime rule.

func Opens(s algolang.Series) nseries.Series

Volumes

Volumes is Closes for the volume column. Same no-copy lifetime rule.

func Volumes(s algolang.Series) nseries.Series