talib

package module
v0.8.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: BSD-3-Clause Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

TA-Lib for Go

The official TA-Lib in pure Go: every technical analysis function, batch and streaming. No C library to install.

Import

go get ta-lib.github.io/go

Import it as talib "ta-lib.github.io/go". It needs Go 1.22 or later.

On x86-64, build with GOAMD64=v3 when every machine that runs the program has AVX2 and FMA: the functions that use a fused multiply-add, such as T3, MACD and TEMA, run faster, with the same results. A v3 binary does not start on an older CPU.

Batch

Every function is a method of Core, taking the range of bars to compute, the inputs (oldest bar first), the parameters and the output slices:

core := talib.NewCore()
closes := []float64{44.34, 44.09, 44.15, 43.61, 44.33, 44.83, 45.10, 45.42, 45.84, 46.08}
out := make([]float64, len(closes))
r, err := core.SMA(0, len(closes)-1, closes, 5, out)
if err != nil {
	log.Fatal(err)
}
fmt.Printf("SMA from bar %d: %.3f\n", r.BegIdx, out[:r.NBElement])

Streaming

A stream opens on the history and takes one closed bar at a time, returning the value the batch call computes at that bar:

s, last, err := core.SMAOpen(closes, 5)
if err != nil {
	log.Fatal(err)
}
next, err := s.Update(46.03)
if err != nil {
	log.Fatal(err)
}
fmt.Printf("SMA %.3f, then %.3f\n", last, next)

Documentation

https://ta-lib.org/api/go/, and every function's page under https://ta-lib.org/functions/.

Documentation

Overview

Package talib is the official TA-Lib in pure Go: every technical analysis function, batch and streaming.

Batch

Each function is a method of Core named as in TA-Lib. It takes the range of bars to compute, the inputs (oldest bar first), the parameters and the output slices, and returns the OutRange it wrote:

core := talib.NewCore()
out := make([]float64, len(closes))
r, err := core.SMA(0, len(closes)-1, closes, 30, out)

out[k] is the value at bar r.BegIdx+k, for r.NBElement values. A parameter passed as IntegerDefault or RealDefault takes its default, and a Lookback method such as Core.SMALookback tells how many leading bars a call consumes; a DisplayShift method such as Core.DPODisplayShift tells how many bars ahead or behind a chart draws one output. Each method's documentation lists its inputs, parameters and outputs and links to the function's page on ta-lib.org.

Streaming

For live data, open a stream on the history and feed it one closed bar at a time; each Update returns the value the batch call computes at that bar:

s, last, err := core.SMAOpen(closes, 30)
v, err := s.Update(nextClose)

Peek previews a forming bar without committing it, and Clone forks a stream.

Settings

A Core holds what every call reads: the unstable periods (Core.SetUnstablePeriod), the candlestick settings (Core.SetCandleSetting) and the EMA variation (Core.SetEMAVariation). A zero Core holds the defaults, as the one NewCore returns does.

Errors

A call that fails returns a RetCode as its error, such as BadParam for a parameter out of range; test for one with errors.Is.

Abstract API

The package ta-lib.github.io/go/abstract describes every function at run time and calls one chosen by name: list the functions, read each one's inputs, parameters, outputs and flags, then bind the arguments and call it. A program that does not import it links none of it. See https://ta-lib.org/api/abstract/.

Goroutines

A Core is safe to share between goroutines once configured: call its setters only while no other goroutine uses it and no stream opened on it is in use. A stream belongs to one goroutine.

Documentation: https://ta-lib.org/api/go/

Index

Examples

Constants

View Source
const (
	RealDefault       = -4e37
	RealMin           = -3e37
	RealMax           = 3e37
	IntegerDefault    = math.MinInt32
	IntegerMin        = math.MinInt32 + 1
	IntegerMax        = math.MaxInt32
	IndexMax          = 100000000
	UnstableAutoPrec4 = IndexMax + 4
	UnstableAutoPrec8 = IndexMax + 8
)

The sentinels and bounds of the optional parameters and indices, as C defines them.

View Source
const (
	MATypeMin = 0
	MATypeMax = 16
)

The range an MAType parameter accepts.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACCBANDSStream

type ACCBANDSStream struct {
	// contains filtered or unexported fields
}

ACCBANDSStream is a live ACCBANDS over a growing series: ACCBANDSStream.Update takes each new closed bar and returns the values Core.ACCBANDS computes at that bar over the same series. Open one with Core.ACCBANDSOpen or Core.ACCBANDSOpenAndFill.

A stream belongs to one goroutine; ACCBANDSStream.Clone forks it.

func (*ACCBANDSStream) Advance

func (sp *ACCBANDSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ACCBANDSStream) Clone

func (sp *ACCBANDSStream) Clone() *ACCBANDSStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ACCBANDSStream) OutRange

func (sp *ACCBANDSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ACCBANDS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ACCBANDSStream) Peek

func (sp *ACCBANDSStream) Peek(inHigh, inLow, inClose float64) (float64, float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ACCBANDSStream) Update

func (sp *ACCBANDSStream) Update(inHigh, inLow, inClose float64) (float64, float64, float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outRealUpperBand, outRealMiddleBand and outRealLowerBand. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ACCBANDSStream) Value

func (sp *ACCBANDSStream) Value() (float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type ACOSStream

type ACOSStream struct {
	// contains filtered or unexported fields
}

ACOSStream is a live ACOS over a growing series: ACOSStream.Update takes each new closed bar and returns the value Core.ACOS computes at that bar over the same series. Open one with Core.ACOSOpen or Core.ACOSOpenAndFill.

A stream belongs to one goroutine; ACOSStream.Clone forks it.

func (*ACOSStream) Advance

func (sp *ACOSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ACOSStream) Clone

func (sp *ACOSStream) Clone() *ACOSStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ACOSStream) OutRange

func (sp *ACOSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ACOS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ACOSStream) Peek

func (sp *ACOSStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*ACOSStream) Update

func (sp *ACOSStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ACOSStream) Value

func (sp *ACOSStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ACStream

type ACStream struct {
	// contains filtered or unexported fields
}

ACStream is a live AC over a growing series: ACStream.Update takes each new closed bar and returns the value Core.AC computes at that bar over the same series. Open one with Core.ACOpen or Core.ACOpenAndFill.

A stream belongs to one goroutine; ACStream.Clone forks it.

func (*ACStream) Advance

func (sp *ACStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ACStream) Clone

func (sp *ACStream) Clone() *ACStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ACStream) OutRange

func (sp *ACStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.AC reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ACStream) Peek

func (sp *ACStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ACStream) Update

func (sp *ACStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ACStream) Value

func (sp *ACStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ADDStream

type ADDStream struct {
	// contains filtered or unexported fields
}

ADDStream is a live ADD over a growing series: ADDStream.Update takes each new closed bar and returns the value Core.ADD computes at that bar over the same series. Open one with Core.ADDOpen or Core.ADDOpenAndFill.

A stream belongs to one goroutine; ADDStream.Clone forks it.

func (*ADDStream) Advance

func (sp *ADDStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ADDStream) Clone

func (sp *ADDStream) Clone() *ADDStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ADDStream) OutRange

func (sp *ADDStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ADD reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ADDStream) Peek

func (sp *ADDStream) Peek(inReal0, inReal1 float64) (float64, error)

Peek returns what Update would return for the bar (inReal0 and inReal1), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ADDStream) Update

func (sp *ADDStream) Update(inReal0, inReal1 float64) (float64, error)

Update commits one closed bar (inReal0 and inReal1) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ADDStream) Value

func (sp *ADDStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ADOSCStream

type ADOSCStream struct {
	// contains filtered or unexported fields
}

ADOSCStream is a live ADOSC over a growing series: ADOSCStream.Update takes each new closed bar and returns the value Core.ADOSC computes at that bar over the same series. Open one with Core.ADOSCOpen or Core.ADOSCOpenAndFill.

A stream belongs to one goroutine; ADOSCStream.Clone forks it.

func (*ADOSCStream) Advance

func (sp *ADOSCStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ADOSCStream) Clone

func (sp *ADOSCStream) Clone() *ADOSCStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ADOSCStream) OutRange

func (sp *ADOSCStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ADOSC reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ADOSCStream) Peek

func (sp *ADOSCStream) Peek(inHigh, inLow, inClose, inVolume float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow, inClose and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ADOSCStream) Update

func (sp *ADOSCStream) Update(inHigh, inLow, inClose, inVolume float64) (float64, error)

Update commits one closed bar (inHigh, inLow, inClose and inVolume) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ADOSCStream) Value

func (sp *ADOSCStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ADRStream

type ADRStream struct {
	// contains filtered or unexported fields
}

ADRStream is a live ADR over a growing series: ADRStream.Update takes each new closed bar and returns the value Core.ADR computes at that bar over the same series. Open one with Core.ADROpen or Core.ADROpenAndFill.

A stream belongs to one goroutine; ADRStream.Clone forks it.

func (*ADRStream) Advance

func (sp *ADRStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ADRStream) Clone

func (sp *ADRStream) Clone() *ADRStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ADRStream) OutRange

func (sp *ADRStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ADR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ADRStream) Peek

func (sp *ADRStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ADRStream) Update

func (sp *ADRStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ADRStream) Value

func (sp *ADRStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ADStream

type ADStream struct {
	// contains filtered or unexported fields
}

ADStream is a live AD over a growing series: ADStream.Update takes each new closed bar and returns the value Core.AD computes at that bar over the same series. Open one with Core.ADOpen or Core.ADOpenAndFill.

A stream belongs to one goroutine; ADStream.Clone forks it.

func (*ADStream) Advance

func (sp *ADStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ADStream) Clone

func (sp *ADStream) Clone() *ADStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ADStream) OutRange

func (sp *ADStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.AD reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ADStream) Peek

func (sp *ADStream) Peek(inHigh, inLow, inClose, inVolume float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow, inClose and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ADStream) Update

func (sp *ADStream) Update(inHigh, inLow, inClose, inVolume float64) (float64, error)

Update commits one closed bar (inHigh, inLow, inClose and inVolume) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ADStream) Value

func (sp *ADStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ADXRStream

type ADXRStream struct {
	// contains filtered or unexported fields
}

ADXRStream is a live ADXR over a growing series: ADXRStream.Update takes each new closed bar and returns the value Core.ADXR computes at that bar over the same series. Open one with Core.ADXROpen or Core.ADXROpenAndFill.

A stream belongs to one goroutine; ADXRStream.Clone forks it.

func (*ADXRStream) Advance

func (sp *ADXRStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ADXRStream) Clone

func (sp *ADXRStream) Clone() *ADXRStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ADXRStream) OutRange

func (sp *ADXRStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ADXR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ADXRStream) Peek

func (sp *ADXRStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ADXRStream) Update

func (sp *ADXRStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ADXRStream) Value

func (sp *ADXRStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ADXStream

type ADXStream struct {
	// contains filtered or unexported fields
}

ADXStream is a live ADX over a growing series: ADXStream.Update takes each new closed bar and returns the value Core.ADX computes at that bar over the same series. Open one with Core.ADXOpen or Core.ADXOpenAndFill.

A stream belongs to one goroutine; ADXStream.Clone forks it.

func (*ADXStream) Advance

func (sp *ADXStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ADXStream) Clone

func (sp *ADXStream) Clone() *ADXStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ADXStream) OutRange

func (sp *ADXStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ADX reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ADXStream) Peek

func (sp *ADXStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ADXStream) Update

func (sp *ADXStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ADXStream) Value

func (sp *ADXStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ALLIGATORStream

type ALLIGATORStream struct {
	// contains filtered or unexported fields
}

ALLIGATORStream is a live ALLIGATOR over a growing series: ALLIGATORStream.Update takes each new closed bar and returns the values Core.ALLIGATOR computes at that bar over the same series. Open one with Core.ALLIGATOROpen or Core.ALLIGATOROpenAndFill.

A stream belongs to one goroutine; ALLIGATORStream.Clone forks it.

func (*ALLIGATORStream) Advance

func (sp *ALLIGATORStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ALLIGATORStream) Clone

func (sp *ALLIGATORStream) Clone() *ALLIGATORStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ALLIGATORStream) OutRange

func (sp *ALLIGATORStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ALLIGATOR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ALLIGATORStream) Peek

func (sp *ALLIGATORStream) Peek(inHigh, inLow float64) (float64, float64, float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ALLIGATORStream) Update

func (sp *ALLIGATORStream) Update(inHigh, inLow float64) (float64, float64, float64, error)

Update commits one closed bar (inHigh and inLow) and returns its outputs: outJaw, outTeeth and outLips. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ALLIGATORStream) Value

func (sp *ALLIGATORStream) Value() (float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type ALMAStream

type ALMAStream struct {
	// contains filtered or unexported fields
}

ALMAStream is a live ALMA over a growing series: ALMAStream.Update takes each new closed bar and returns the value Core.ALMA computes at that bar over the same series. Open one with Core.ALMAOpen or Core.ALMAOpenAndFill.

A stream belongs to one goroutine; ALMAStream.Clone forks it.

func (*ALMAStream) Advance

func (sp *ALMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ALMAStream) Clone

func (sp *ALMAStream) Clone() *ALMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ALMAStream) OutRange

func (sp *ALMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ALMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ALMAStream) Peek

func (sp *ALMAStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*ALMAStream) Update

func (sp *ALMAStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ALMAStream) Value

func (sp *ALMAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type AOStream

type AOStream struct {
	// contains filtered or unexported fields
}

AOStream is a live AO over a growing series: AOStream.Update takes each new closed bar and returns the value Core.AO computes at that bar over the same series. Open one with Core.AOOpen or Core.AOOpenAndFill.

A stream belongs to one goroutine; AOStream.Clone forks it.

func (*AOStream) Advance

func (sp *AOStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*AOStream) Clone

func (sp *AOStream) Clone() *AOStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*AOStream) OutRange

func (sp *AOStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.AO reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*AOStream) Peek

func (sp *AOStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*AOStream) Update

func (sp *AOStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*AOStream) Value

func (sp *AOStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type APOStream

type APOStream struct {
	// contains filtered or unexported fields
}

APOStream is a live APO over a growing series: APOStream.Update takes each new closed bar and returns the value Core.APO computes at that bar over the same series. Open one with Core.APOOpen or Core.APOOpenAndFill.

A stream belongs to one goroutine; APOStream.Clone forks it.

func (*APOStream) Advance

func (sp *APOStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*APOStream) Clone

func (sp *APOStream) Clone() *APOStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*APOStream) OutRange

func (sp *APOStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.APO reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*APOStream) Peek

func (sp *APOStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*APOStream) Update

func (sp *APOStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*APOStream) Value

func (sp *APOStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type AROONOSCStream

type AROONOSCStream struct {
	// contains filtered or unexported fields
}

AROONOSCStream is a live AROONOSC over a growing series: AROONOSCStream.Update takes each new closed bar and returns the value Core.AROONOSC computes at that bar over the same series. Open one with Core.AROONOSCOpen or Core.AROONOSCOpenAndFill.

A stream belongs to one goroutine; AROONOSCStream.Clone forks it.

func (*AROONOSCStream) Advance

func (sp *AROONOSCStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*AROONOSCStream) Clone

func (sp *AROONOSCStream) Clone() *AROONOSCStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*AROONOSCStream) OutRange

func (sp *AROONOSCStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.AROONOSC reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*AROONOSCStream) Peek

func (sp *AROONOSCStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*AROONOSCStream) Update

func (sp *AROONOSCStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*AROONOSCStream) Value

func (sp *AROONOSCStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type AROONStream

type AROONStream struct {
	// contains filtered or unexported fields
}

AROONStream is a live AROON over a growing series: AROONStream.Update takes each new closed bar and returns the values Core.AROON computes at that bar over the same series. Open one with Core.AROONOpen or Core.AROONOpenAndFill.

A stream belongs to one goroutine; AROONStream.Clone forks it.

func (*AROONStream) Advance

func (sp *AROONStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*AROONStream) Clone

func (sp *AROONStream) Clone() *AROONStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*AROONStream) OutRange

func (sp *AROONStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.AROON reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*AROONStream) Peek

func (sp *AROONStream) Peek(inHigh, inLow float64) (float64, float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*AROONStream) Update

func (sp *AROONStream) Update(inHigh, inLow float64) (float64, float64, error)

Update commits one closed bar (inHigh and inLow) and returns its outputs: outAroonDown and outAroonUp. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*AROONStream) Value

func (sp *AROONStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type ASINStream

type ASINStream struct {
	// contains filtered or unexported fields
}

ASINStream is a live ASIN over a growing series: ASINStream.Update takes each new closed bar and returns the value Core.ASIN computes at that bar over the same series. Open one with Core.ASINOpen or Core.ASINOpenAndFill.

A stream belongs to one goroutine; ASINStream.Clone forks it.

func (*ASINStream) Advance

func (sp *ASINStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ASINStream) Clone

func (sp *ASINStream) Clone() *ASINStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ASINStream) OutRange

func (sp *ASINStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ASIN reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ASINStream) Peek

func (sp *ASINStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*ASINStream) Update

func (sp *ASINStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ASINStream) Value

func (sp *ASINStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ASIStream

type ASIStream struct {
	// contains filtered or unexported fields
}

ASIStream is a live ASI over a growing series: ASIStream.Update takes each new closed bar and returns the value Core.ASI computes at that bar over the same series. Open one with Core.ASIOpen or Core.ASIOpenAndFill.

A stream belongs to one goroutine; ASIStream.Clone forks it.

func (*ASIStream) Advance

func (sp *ASIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ASIStream) Clone

func (sp *ASIStream) Clone() *ASIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ASIStream) OutRange

func (sp *ASIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ASI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ASIStream) Peek

func (sp *ASIStream) Peek(inOpen, inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ASIStream) Update

func (sp *ASIStream) Update(inOpen, inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ASIStream) Value

func (sp *ASIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ATANStream

type ATANStream struct {
	// contains filtered or unexported fields
}

ATANStream is a live ATAN over a growing series: ATANStream.Update takes each new closed bar and returns the value Core.ATAN computes at that bar over the same series. Open one with Core.ATANOpen or Core.ATANOpenAndFill.

A stream belongs to one goroutine; ATANStream.Clone forks it.

func (*ATANStream) Advance

func (sp *ATANStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ATANStream) Clone

func (sp *ATANStream) Clone() *ATANStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ATANStream) OutRange

func (sp *ATANStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ATAN reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ATANStream) Peek

func (sp *ATANStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*ATANStream) Update

func (sp *ATANStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ATANStream) Value

func (sp *ATANStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ATRStream

type ATRStream struct {
	// contains filtered or unexported fields
}

ATRStream is a live ATR over a growing series: ATRStream.Update takes each new closed bar and returns the value Core.ATR computes at that bar over the same series. Open one with Core.ATROpen or Core.ATROpenAndFill.

A stream belongs to one goroutine; ATRStream.Clone forks it.

func (*ATRStream) Advance

func (sp *ATRStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ATRStream) Clone

func (sp *ATRStream) Clone() *ATRStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ATRStream) OutRange

func (sp *ATRStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ATR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ATRStream) Peek

func (sp *ATRStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ATRStream) Update

func (sp *ATRStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ATRStream) Value

func (sp *ATRStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type AVGDEVStream

type AVGDEVStream struct {
	// contains filtered or unexported fields
}

AVGDEVStream is a live AVGDEV over a growing series: AVGDEVStream.Update takes each new closed bar and returns the value Core.AVGDEV computes at that bar over the same series. Open one with Core.AVGDEVOpen or Core.AVGDEVOpenAndFill.

A stream belongs to one goroutine; AVGDEVStream.Clone forks it.

func (*AVGDEVStream) Advance

func (sp *AVGDEVStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*AVGDEVStream) Clone

func (sp *AVGDEVStream) Clone() *AVGDEVStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*AVGDEVStream) OutRange

func (sp *AVGDEVStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.AVGDEV reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*AVGDEVStream) Peek

func (sp *AVGDEVStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*AVGDEVStream) Update

func (sp *AVGDEVStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*AVGDEVStream) Value

func (sp *AVGDEVStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type AVGPRICEStream

type AVGPRICEStream struct {
	// contains filtered or unexported fields
}

AVGPRICEStream is a live AVGPRICE over a growing series: AVGPRICEStream.Update takes each new closed bar and returns the value Core.AVGPRICE computes at that bar over the same series. Open one with Core.AVGPRICEOpen or Core.AVGPRICEOpenAndFill.

A stream belongs to one goroutine; AVGPRICEStream.Clone forks it.

func (*AVGPRICEStream) Advance

func (sp *AVGPRICEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*AVGPRICEStream) Clone

func (sp *AVGPRICEStream) Clone() *AVGPRICEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*AVGPRICEStream) OutRange

func (sp *AVGPRICEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.AVGPRICE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*AVGPRICEStream) Peek

func (sp *AVGPRICEStream) Peek(inOpen, inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*AVGPRICEStream) Update

func (sp *AVGPRICEStream) Update(inOpen, inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*AVGPRICEStream) Value

func (sp *AVGPRICEStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type BBANDSStream

type BBANDSStream struct {
	// contains filtered or unexported fields
}

BBANDSStream is a live BBANDS over a growing series: BBANDSStream.Update takes each new closed bar and returns the values Core.BBANDS computes at that bar over the same series. Open one with Core.BBANDSOpen or Core.BBANDSOpenAndFill.

A stream belongs to one goroutine; BBANDSStream.Clone forks it.

func (*BBANDSStream) Advance

func (sp *BBANDSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*BBANDSStream) Clone

func (sp *BBANDSStream) Clone() *BBANDSStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*BBANDSStream) OutRange

func (sp *BBANDSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.BBANDS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*BBANDSStream) Peek

func (sp *BBANDSStream) Peek(inReal float64) (float64, float64, float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*BBANDSStream) Update

func (sp *BBANDSStream) Update(inReal float64) (float64, float64, float64, error)

Update commits the closed bar inReal and returns its outputs: outRealUpperBand, outRealMiddleBand and outRealLowerBand. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*BBANDSStream) Value

func (sp *BBANDSStream) Value() (float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type BBWStream

type BBWStream struct {
	// contains filtered or unexported fields
}

BBWStream is a live BBW over a growing series: BBWStream.Update takes each new closed bar and returns the value Core.BBW computes at that bar over the same series. Open one with Core.BBWOpen or Core.BBWOpenAndFill.

A stream belongs to one goroutine; BBWStream.Clone forks it.

func (*BBWStream) Advance

func (sp *BBWStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*BBWStream) Clone

func (sp *BBWStream) Clone() *BBWStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*BBWStream) OutRange

func (sp *BBWStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.BBW reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*BBWStream) Peek

func (sp *BBWStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*BBWStream) Update

func (sp *BBWStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*BBWStream) Value

func (sp *BBWStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type BETAStream

type BETAStream struct {
	S_xx float64
	S_xy float64
	S_x  float64
	S_y  float64

	S_yy float64
	// contains filtered or unexported fields
}

BETAStream is a live BETA over a growing series: BETAStream.Update takes each new closed bar and returns the value Core.BETA computes at that bar over the same series. Open one with Core.BETAOpen or Core.BETAOpenAndFill.

A stream belongs to one goroutine; BETAStream.Clone forks it.

func (*BETAStream) Advance

func (sp *BETAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*BETAStream) Clone

func (sp *BETAStream) Clone() *BETAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*BETAStream) OutRange

func (sp *BETAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.BETA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*BETAStream) Peek

func (sp *BETAStream) Peek(inReal0, inReal1 float64) (float64, error)

Peek returns what Update would return for the bar (inReal0 and inReal1), changing nothing. It returns BadParam for a bar value that is not finite.

func (*BETAStream) Update

func (sp *BETAStream) Update(inReal0, inReal1 float64) (float64, error)

Update commits one closed bar (inReal0 and inReal1) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*BETAStream) Value

func (sp *BETAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type BOPStream

type BOPStream struct {
	// contains filtered or unexported fields
}

BOPStream is a live BOP over a growing series: BOPStream.Update takes each new closed bar and returns the value Core.BOP computes at that bar over the same series. Open one with Core.BOPOpen or Core.BOPOpenAndFill.

A stream belongs to one goroutine; BOPStream.Clone forks it.

func (*BOPStream) Advance

func (sp *BOPStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*BOPStream) Clone

func (sp *BOPStream) Clone() *BOPStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*BOPStream) OutRange

func (sp *BOPStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.BOP reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*BOPStream) Peek

func (sp *BOPStream) Peek(inOpen, inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*BOPStream) Update

func (sp *BOPStream) Update(inOpen, inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*BOPStream) Value

func (sp *BOPStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CCIStream

type CCIStream struct {
	// contains filtered or unexported fields
}

CCIStream is a live CCI over a growing series: CCIStream.Update takes each new closed bar and returns the value Core.CCI computes at that bar over the same series. Open one with Core.CCIOpen or Core.CCIOpenAndFill.

A stream belongs to one goroutine; CCIStream.Clone forks it.

func (*CCIStream) Advance

func (sp *CCIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CCIStream) Clone

func (sp *CCIStream) Clone() *CCIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CCIStream) OutRange

func (sp *CCIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CCI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CCIStream) Peek

func (sp *CCIStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CCIStream) Update

func (sp *CCIStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CCIStream) Value

func (sp *CCIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDL2CROWSStream

type CDL2CROWSStream struct {
	BodyLongPeriodTotal float64
	// contains filtered or unexported fields
}

CDL2CROWSStream is a live CDL2CROWS over a growing series: CDL2CROWSStream.Update takes each new closed bar and returns the value Core.CDL2CROWS computes at that bar over the same series. Open one with Core.CDL2CROWSOpen or Core.CDL2CROWSOpenAndFill.

A stream belongs to one goroutine; CDL2CROWSStream.Clone forks it.

func (*CDL2CROWSStream) Advance

func (sp *CDL2CROWSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDL2CROWSStream) Clone

func (sp *CDL2CROWSStream) Clone() *CDL2CROWSStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDL2CROWSStream) OutRange

func (sp *CDL2CROWSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDL2CROWS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDL2CROWSStream) Peek

func (sp *CDL2CROWSStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDL2CROWSStream) Update

func (sp *CDL2CROWSStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDL2CROWSStream) Value

func (sp *CDL2CROWSStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDL3BLACKCROWSStream

type CDL3BLACKCROWSStream struct {
	ShadowVeryShortPeriodTotal [3]float64
	// contains filtered or unexported fields
}

CDL3BLACKCROWSStream is a live CDL3BLACKCROWS over a growing series: CDL3BLACKCROWSStream.Update takes each new closed bar and returns the value Core.CDL3BLACKCROWS computes at that bar over the same series. Open one with Core.CDL3BLACKCROWSOpen or Core.CDL3BLACKCROWSOpenAndFill.

A stream belongs to one goroutine; CDL3BLACKCROWSStream.Clone forks it.

func (*CDL3BLACKCROWSStream) Advance

func (sp *CDL3BLACKCROWSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDL3BLACKCROWSStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDL3BLACKCROWSStream) OutRange

func (sp *CDL3BLACKCROWSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDL3BLACKCROWS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDL3BLACKCROWSStream) Peek

func (sp *CDL3BLACKCROWSStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDL3BLACKCROWSStream) Update

func (sp *CDL3BLACKCROWSStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDL3BLACKCROWSStream) Value

func (sp *CDL3BLACKCROWSStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDL3INSIDEStream

type CDL3INSIDEStream struct {
	BodyShortPeriodTotal float64
	BodyLongPeriodTotal  float64
	// contains filtered or unexported fields
}

CDL3INSIDEStream is a live CDL3INSIDE over a growing series: CDL3INSIDEStream.Update takes each new closed bar and returns the value Core.CDL3INSIDE computes at that bar over the same series. Open one with Core.CDL3INSIDEOpen or Core.CDL3INSIDEOpenAndFill.

A stream belongs to one goroutine; CDL3INSIDEStream.Clone forks it.

func (*CDL3INSIDEStream) Advance

func (sp *CDL3INSIDEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDL3INSIDEStream) Clone

func (sp *CDL3INSIDEStream) Clone() *CDL3INSIDEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDL3INSIDEStream) OutRange

func (sp *CDL3INSIDEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDL3INSIDE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDL3INSIDEStream) Peek

func (sp *CDL3INSIDEStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDL3INSIDEStream) Update

func (sp *CDL3INSIDEStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDL3INSIDEStream) Value

func (sp *CDL3INSIDEStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDL3LINESTRIKEStream

type CDL3LINESTRIKEStream struct {
	NearPeriodTotal            [4]float64
	NearPeriodTotalRange3      float64
	NearPeriodTotalTrailRange3 float64
	// contains filtered or unexported fields
}

CDL3LINESTRIKEStream is a live CDL3LINESTRIKE over a growing series: CDL3LINESTRIKEStream.Update takes each new closed bar and returns the value Core.CDL3LINESTRIKE computes at that bar over the same series. Open one with Core.CDL3LINESTRIKEOpen or Core.CDL3LINESTRIKEOpenAndFill.

A stream belongs to one goroutine; CDL3LINESTRIKEStream.Clone forks it.

func (*CDL3LINESTRIKEStream) Advance

func (sp *CDL3LINESTRIKEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDL3LINESTRIKEStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDL3LINESTRIKEStream) OutRange

func (sp *CDL3LINESTRIKEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDL3LINESTRIKE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDL3LINESTRIKEStream) Peek

func (sp *CDL3LINESTRIKEStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDL3LINESTRIKEStream) Update

func (sp *CDL3LINESTRIKEStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDL3LINESTRIKEStream) Value

func (sp *CDL3LINESTRIKEStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDL3OUTSIDEStream

type CDL3OUTSIDEStream struct {
	// contains filtered or unexported fields
}

CDL3OUTSIDEStream is a live CDL3OUTSIDE over a growing series: CDL3OUTSIDEStream.Update takes each new closed bar and returns the value Core.CDL3OUTSIDE computes at that bar over the same series. Open one with Core.CDL3OUTSIDEOpen or Core.CDL3OUTSIDEOpenAndFill.

A stream belongs to one goroutine; CDL3OUTSIDEStream.Clone forks it.

func (*CDL3OUTSIDEStream) Advance

func (sp *CDL3OUTSIDEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDL3OUTSIDEStream) Clone

func (sp *CDL3OUTSIDEStream) Clone() *CDL3OUTSIDEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDL3OUTSIDEStream) OutRange

func (sp *CDL3OUTSIDEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDL3OUTSIDE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDL3OUTSIDEStream) Peek

func (sp *CDL3OUTSIDEStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDL3OUTSIDEStream) Update

func (sp *CDL3OUTSIDEStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDL3OUTSIDEStream) Value

func (sp *CDL3OUTSIDEStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDL3STARSINSOUTHStream

type CDL3STARSINSOUTHStream struct {
	BodyLongPeriodTotal                   float64
	BodyShortPeriodTotal                  float64
	ShadowLongPeriodTotal                 float64
	ShadowVeryShortPeriodTotal            [2]float64
	ShadowVeryShortPeriodTotalRange1      float64
	ShadowVeryShortPeriodTotalTrailRange1 float64
	// contains filtered or unexported fields
}

CDL3STARSINSOUTHStream is a live CDL3STARSINSOUTH over a growing series: CDL3STARSINSOUTHStream.Update takes each new closed bar and returns the value Core.CDL3STARSINSOUTH computes at that bar over the same series. Open one with Core.CDL3STARSINSOUTHOpen or Core.CDL3STARSINSOUTHOpenAndFill.

A stream belongs to one goroutine; CDL3STARSINSOUTHStream.Clone forks it.

func (*CDL3STARSINSOUTHStream) Advance

func (sp *CDL3STARSINSOUTHStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDL3STARSINSOUTHStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDL3STARSINSOUTHStream) OutRange

func (sp *CDL3STARSINSOUTHStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDL3STARSINSOUTH reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDL3STARSINSOUTHStream) Peek

func (sp *CDL3STARSINSOUTHStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDL3STARSINSOUTHStream) Update

func (sp *CDL3STARSINSOUTHStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDL3STARSINSOUTHStream) Value

func (sp *CDL3STARSINSOUTHStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDL3WHITESOLDIERSStream

type CDL3WHITESOLDIERSStream struct {
	ShadowVeryShortPeriodTotal            [3]float64
	NearPeriodTotal                       [3]float64
	FarPeriodTotal                        [3]float64
	ShadowVeryShortPeriodTotalRange1      float64
	ShadowVeryShortPeriodTotalTrailRange1 float64
	ShadowVeryShortPeriodTotalRange2      float64
	ShadowVeryShortPeriodTotalTrailRange2 float64
	FarPeriodTotalRange2                  float64
	FarPeriodTotalTrailRange2             float64
	NearPeriodTotalRange2                 float64
	NearPeriodTotalTrailRange2            float64
	BodyShortPeriodTotal                  float64
	// contains filtered or unexported fields
}

CDL3WHITESOLDIERSStream is a live CDL3WHITESOLDIERS over a growing series: CDL3WHITESOLDIERSStream.Update takes each new closed bar and returns the value Core.CDL3WHITESOLDIERS computes at that bar over the same series. Open one with Core.CDL3WHITESOLDIERSOpen or Core.CDL3WHITESOLDIERSOpenAndFill.

A stream belongs to one goroutine; CDL3WHITESOLDIERSStream.Clone forks it.

func (*CDL3WHITESOLDIERSStream) Advance

func (sp *CDL3WHITESOLDIERSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDL3WHITESOLDIERSStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDL3WHITESOLDIERSStream) OutRange

func (sp *CDL3WHITESOLDIERSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDL3WHITESOLDIERS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDL3WHITESOLDIERSStream) Peek

func (sp *CDL3WHITESOLDIERSStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDL3WHITESOLDIERSStream) Update

func (sp *CDL3WHITESOLDIERSStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDL3WHITESOLDIERSStream) Value

func (sp *CDL3WHITESOLDIERSStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLABANDONEDBABYStream

type CDLABANDONEDBABYStream struct {
	BodyDojiPeriodTotal  float64
	BodyLongPeriodTotal  float64
	BodyShortPeriodTotal float64
	// contains filtered or unexported fields
}

CDLABANDONEDBABYStream is a live CDLABANDONEDBABY over a growing series: CDLABANDONEDBABYStream.Update takes each new closed bar and returns the value Core.CDLABANDONEDBABY computes at that bar over the same series. Open one with Core.CDLABANDONEDBABYOpen or Core.CDLABANDONEDBABYOpenAndFill.

A stream belongs to one goroutine; CDLABANDONEDBABYStream.Clone forks it.

func (*CDLABANDONEDBABYStream) Advance

func (sp *CDLABANDONEDBABYStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLABANDONEDBABYStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLABANDONEDBABYStream) OutRange

func (sp *CDLABANDONEDBABYStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLABANDONEDBABY reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLABANDONEDBABYStream) Peek

func (sp *CDLABANDONEDBABYStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLABANDONEDBABYStream) Update

func (sp *CDLABANDONEDBABYStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLABANDONEDBABYStream) Value

func (sp *CDLABANDONEDBABYStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLADVANCEBLOCKStream

type CDLADVANCEBLOCKStream struct {
	ShadowShortPeriodTotal            [3]float64
	ShadowLongPeriodTotal             [2]float64
	NearPeriodTotal                   [3]float64
	FarPeriodTotal                    [3]float64
	ShadowShortPeriodTotalRange1      float64
	ShadowShortPeriodTotalTrailRange1 float64
	ShadowShortPeriodTotalRange2      float64
	ShadowShortPeriodTotalTrailRange2 float64
	ShadowLongPeriodTotalRange1       float64
	ShadowLongPeriodTotalTrailRange1  float64
	FarPeriodTotalRange2              float64
	FarPeriodTotalTrailRange2         float64
	NearPeriodTotalRange2             float64
	NearPeriodTotalTrailRange2        float64
	BodyLongPeriodTotal               float64
	// contains filtered or unexported fields
}

CDLADVANCEBLOCKStream is a live CDLADVANCEBLOCK over a growing series: CDLADVANCEBLOCKStream.Update takes each new closed bar and returns the value Core.CDLADVANCEBLOCK computes at that bar over the same series. Open one with Core.CDLADVANCEBLOCKOpen or Core.CDLADVANCEBLOCKOpenAndFill.

A stream belongs to one goroutine; CDLADVANCEBLOCKStream.Clone forks it.

func (*CDLADVANCEBLOCKStream) Advance

func (sp *CDLADVANCEBLOCKStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLADVANCEBLOCKStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLADVANCEBLOCKStream) OutRange

func (sp *CDLADVANCEBLOCKStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLADVANCEBLOCK reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLADVANCEBLOCKStream) Peek

func (sp *CDLADVANCEBLOCKStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLADVANCEBLOCKStream) Update

func (sp *CDLADVANCEBLOCKStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLADVANCEBLOCKStream) Value

func (sp *CDLADVANCEBLOCKStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLBELTHOLDStream

type CDLBELTHOLDStream struct {
	BodyLongPeriodTotal        float64
	ShadowVeryShortPeriodTotal float64
	// contains filtered or unexported fields
}

CDLBELTHOLDStream is a live CDLBELTHOLD over a growing series: CDLBELTHOLDStream.Update takes each new closed bar and returns the value Core.CDLBELTHOLD computes at that bar over the same series. Open one with Core.CDLBELTHOLDOpen or Core.CDLBELTHOLDOpenAndFill.

A stream belongs to one goroutine; CDLBELTHOLDStream.Clone forks it.

func (*CDLBELTHOLDStream) Advance

func (sp *CDLBELTHOLDStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLBELTHOLDStream) Clone

func (sp *CDLBELTHOLDStream) Clone() *CDLBELTHOLDStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLBELTHOLDStream) OutRange

func (sp *CDLBELTHOLDStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLBELTHOLD reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLBELTHOLDStream) Peek

func (sp *CDLBELTHOLDStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLBELTHOLDStream) Update

func (sp *CDLBELTHOLDStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLBELTHOLDStream) Value

func (sp *CDLBELTHOLDStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLBREAKAWAYStream

type CDLBREAKAWAYStream struct {
	BodyLongPeriodTotal float64
	// contains filtered or unexported fields
}

CDLBREAKAWAYStream is a live CDLBREAKAWAY over a growing series: CDLBREAKAWAYStream.Update takes each new closed bar and returns the value Core.CDLBREAKAWAY computes at that bar over the same series. Open one with Core.CDLBREAKAWAYOpen or Core.CDLBREAKAWAYOpenAndFill.

A stream belongs to one goroutine; CDLBREAKAWAYStream.Clone forks it.

func (*CDLBREAKAWAYStream) Advance

func (sp *CDLBREAKAWAYStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLBREAKAWAYStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLBREAKAWAYStream) OutRange

func (sp *CDLBREAKAWAYStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLBREAKAWAY reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLBREAKAWAYStream) Peek

func (sp *CDLBREAKAWAYStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLBREAKAWAYStream) Update

func (sp *CDLBREAKAWAYStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLBREAKAWAYStream) Value

func (sp *CDLBREAKAWAYStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLCLOSINGMARUBOZUStream

type CDLCLOSINGMARUBOZUStream struct {
	BodyLongPeriodTotal        float64
	ShadowVeryShortPeriodTotal float64
	// contains filtered or unexported fields
}

CDLCLOSINGMARUBOZUStream is a live CDLCLOSINGMARUBOZU over a growing series: CDLCLOSINGMARUBOZUStream.Update takes each new closed bar and returns the value Core.CDLCLOSINGMARUBOZU computes at that bar over the same series. Open one with Core.CDLCLOSINGMARUBOZUOpen or Core.CDLCLOSINGMARUBOZUOpenAndFill.

A stream belongs to one goroutine; CDLCLOSINGMARUBOZUStream.Clone forks it.

func (*CDLCLOSINGMARUBOZUStream) Advance

func (sp *CDLCLOSINGMARUBOZUStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLCLOSINGMARUBOZUStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLCLOSINGMARUBOZUStream) OutRange

func (sp *CDLCLOSINGMARUBOZUStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLCLOSINGMARUBOZU reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLCLOSINGMARUBOZUStream) Peek

func (sp *CDLCLOSINGMARUBOZUStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLCLOSINGMARUBOZUStream) Update

func (sp *CDLCLOSINGMARUBOZUStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLCLOSINGMARUBOZUStream) Value

func (sp *CDLCLOSINGMARUBOZUStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLCONCEALBABYSWALLStream

type CDLCONCEALBABYSWALLStream struct {
	ShadowVeryShortPeriodTotal            [4]float64
	ShadowVeryShortPeriodTotalRange2      float64
	ShadowVeryShortPeriodTotalTrailRange2 float64
	ShadowVeryShortPeriodTotalRange3      float64
	ShadowVeryShortPeriodTotalTrailRange3 float64
	// contains filtered or unexported fields
}

CDLCONCEALBABYSWALLStream is a live CDLCONCEALBABYSWALL over a growing series: CDLCONCEALBABYSWALLStream.Update takes each new closed bar and returns the value Core.CDLCONCEALBABYSWALL computes at that bar over the same series. Open one with Core.CDLCONCEALBABYSWALLOpen or Core.CDLCONCEALBABYSWALLOpenAndFill.

A stream belongs to one goroutine; CDLCONCEALBABYSWALLStream.Clone forks it.

func (*CDLCONCEALBABYSWALLStream) Advance

func (sp *CDLCONCEALBABYSWALLStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLCONCEALBABYSWALLStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLCONCEALBABYSWALLStream) OutRange

func (sp *CDLCONCEALBABYSWALLStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLCONCEALBABYSWALL reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLCONCEALBABYSWALLStream) Peek

func (sp *CDLCONCEALBABYSWALLStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLCONCEALBABYSWALLStream) Update

func (sp *CDLCONCEALBABYSWALLStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLCONCEALBABYSWALLStream) Value

func (sp *CDLCONCEALBABYSWALLStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLCOUNTERATTACKStream

type CDLCOUNTERATTACKStream struct {
	EqualPeriodTotal               float64
	BodyLongPeriodTotal            [2]float64
	BodyLongPeriodTotalRange1      float64
	BodyLongPeriodTotalTrailRange1 float64
	// contains filtered or unexported fields
}

CDLCOUNTERATTACKStream is a live CDLCOUNTERATTACK over a growing series: CDLCOUNTERATTACKStream.Update takes each new closed bar and returns the value Core.CDLCOUNTERATTACK computes at that bar over the same series. Open one with Core.CDLCOUNTERATTACKOpen or Core.CDLCOUNTERATTACKOpenAndFill.

A stream belongs to one goroutine; CDLCOUNTERATTACKStream.Clone forks it.

func (*CDLCOUNTERATTACKStream) Advance

func (sp *CDLCOUNTERATTACKStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLCOUNTERATTACKStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLCOUNTERATTACKStream) OutRange

func (sp *CDLCOUNTERATTACKStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLCOUNTERATTACK reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLCOUNTERATTACKStream) Peek

func (sp *CDLCOUNTERATTACKStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLCOUNTERATTACKStream) Update

func (sp *CDLCOUNTERATTACKStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLCOUNTERATTACKStream) Value

func (sp *CDLCOUNTERATTACKStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLDARKCLOUDCOVERStream

type CDLDARKCLOUDCOVERStream struct {
	BodyLongPeriodTotal float64
	// contains filtered or unexported fields
}

CDLDARKCLOUDCOVERStream is a live CDLDARKCLOUDCOVER over a growing series: CDLDARKCLOUDCOVERStream.Update takes each new closed bar and returns the value Core.CDLDARKCLOUDCOVER computes at that bar over the same series. Open one with Core.CDLDARKCLOUDCOVEROpen or Core.CDLDARKCLOUDCOVEROpenAndFill.

A stream belongs to one goroutine; CDLDARKCLOUDCOVERStream.Clone forks it.

func (*CDLDARKCLOUDCOVERStream) Advance

func (sp *CDLDARKCLOUDCOVERStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLDARKCLOUDCOVERStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLDARKCLOUDCOVERStream) OutRange

func (sp *CDLDARKCLOUDCOVERStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLDARKCLOUDCOVER reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLDARKCLOUDCOVERStream) Peek

func (sp *CDLDARKCLOUDCOVERStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLDARKCLOUDCOVERStream) Update

func (sp *CDLDARKCLOUDCOVERStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLDARKCLOUDCOVERStream) Value

func (sp *CDLDARKCLOUDCOVERStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLDOJISTARStream

type CDLDOJISTARStream struct {
	BodyDojiPeriodTotal float64
	BodyLongPeriodTotal float64
	// contains filtered or unexported fields
}

CDLDOJISTARStream is a live CDLDOJISTAR over a growing series: CDLDOJISTARStream.Update takes each new closed bar and returns the value Core.CDLDOJISTAR computes at that bar over the same series. Open one with Core.CDLDOJISTAROpen or Core.CDLDOJISTAROpenAndFill.

A stream belongs to one goroutine; CDLDOJISTARStream.Clone forks it.

func (*CDLDOJISTARStream) Advance

func (sp *CDLDOJISTARStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLDOJISTARStream) Clone

func (sp *CDLDOJISTARStream) Clone() *CDLDOJISTARStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLDOJISTARStream) OutRange

func (sp *CDLDOJISTARStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLDOJISTAR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLDOJISTARStream) Peek

func (sp *CDLDOJISTARStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLDOJISTARStream) Update

func (sp *CDLDOJISTARStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLDOJISTARStream) Value

func (sp *CDLDOJISTARStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLDOJIStream

type CDLDOJIStream struct {
	BodyDojiPeriodTotal float64
	// contains filtered or unexported fields
}

CDLDOJIStream is a live CDLDOJI over a growing series: CDLDOJIStream.Update takes each new closed bar and returns the value Core.CDLDOJI computes at that bar over the same series. Open one with Core.CDLDOJIOpen or Core.CDLDOJIOpenAndFill.

A stream belongs to one goroutine; CDLDOJIStream.Clone forks it.

func (*CDLDOJIStream) Advance

func (sp *CDLDOJIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLDOJIStream) Clone

func (sp *CDLDOJIStream) Clone() *CDLDOJIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLDOJIStream) OutRange

func (sp *CDLDOJIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLDOJI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLDOJIStream) Peek

func (sp *CDLDOJIStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLDOJIStream) Update

func (sp *CDLDOJIStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLDOJIStream) Value

func (sp *CDLDOJIStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLDRAGONFLYDOJIStream

type CDLDRAGONFLYDOJIStream struct {
	BodyDojiPeriodTotal        float64
	ShadowVeryShortPeriodTotal float64
	// contains filtered or unexported fields
}

CDLDRAGONFLYDOJIStream is a live CDLDRAGONFLYDOJI over a growing series: CDLDRAGONFLYDOJIStream.Update takes each new closed bar and returns the value Core.CDLDRAGONFLYDOJI computes at that bar over the same series. Open one with Core.CDLDRAGONFLYDOJIOpen or Core.CDLDRAGONFLYDOJIOpenAndFill.

A stream belongs to one goroutine; CDLDRAGONFLYDOJIStream.Clone forks it.

func (*CDLDRAGONFLYDOJIStream) Advance

func (sp *CDLDRAGONFLYDOJIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLDRAGONFLYDOJIStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLDRAGONFLYDOJIStream) OutRange

func (sp *CDLDRAGONFLYDOJIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLDRAGONFLYDOJI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLDRAGONFLYDOJIStream) Peek

func (sp *CDLDRAGONFLYDOJIStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLDRAGONFLYDOJIStream) Update

func (sp *CDLDRAGONFLYDOJIStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLDRAGONFLYDOJIStream) Value

func (sp *CDLDRAGONFLYDOJIStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLENGULFINGStream

type CDLENGULFINGStream struct {
	// contains filtered or unexported fields
}

CDLENGULFINGStream is a live CDLENGULFING over a growing series: CDLENGULFINGStream.Update takes each new closed bar and returns the value Core.CDLENGULFING computes at that bar over the same series. Open one with Core.CDLENGULFINGOpen or Core.CDLENGULFINGOpenAndFill.

A stream belongs to one goroutine; CDLENGULFINGStream.Clone forks it.

func (*CDLENGULFINGStream) Advance

func (sp *CDLENGULFINGStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLENGULFINGStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLENGULFINGStream) OutRange

func (sp *CDLENGULFINGStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLENGULFING reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLENGULFINGStream) Peek

func (sp *CDLENGULFINGStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLENGULFINGStream) Update

func (sp *CDLENGULFINGStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLENGULFINGStream) Value

func (sp *CDLENGULFINGStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLEVENINGDOJISTARStream

type CDLEVENINGDOJISTARStream struct {
	BodyDojiPeriodTotal  float64
	BodyLongPeriodTotal  float64
	BodyShortPeriodTotal float64
	// contains filtered or unexported fields
}

CDLEVENINGDOJISTARStream is a live CDLEVENINGDOJISTAR over a growing series: CDLEVENINGDOJISTARStream.Update takes each new closed bar and returns the value Core.CDLEVENINGDOJISTAR computes at that bar over the same series. Open one with Core.CDLEVENINGDOJISTAROpen or Core.CDLEVENINGDOJISTAROpenAndFill.

A stream belongs to one goroutine; CDLEVENINGDOJISTARStream.Clone forks it.

func (*CDLEVENINGDOJISTARStream) Advance

func (sp *CDLEVENINGDOJISTARStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLEVENINGDOJISTARStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLEVENINGDOJISTARStream) OutRange

func (sp *CDLEVENINGDOJISTARStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLEVENINGDOJISTAR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLEVENINGDOJISTARStream) Peek

func (sp *CDLEVENINGDOJISTARStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLEVENINGDOJISTARStream) Update

func (sp *CDLEVENINGDOJISTARStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLEVENINGDOJISTARStream) Value

func (sp *CDLEVENINGDOJISTARStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLEVENINGSTARStream

type CDLEVENINGSTARStream struct {
	BodyShortPeriodTotal  float64
	BodyLongPeriodTotal   float64
	BodyShortPeriodTotal2 float64
	// contains filtered or unexported fields
}

CDLEVENINGSTARStream is a live CDLEVENINGSTAR over a growing series: CDLEVENINGSTARStream.Update takes each new closed bar and returns the value Core.CDLEVENINGSTAR computes at that bar over the same series. Open one with Core.CDLEVENINGSTAROpen or Core.CDLEVENINGSTAROpenAndFill.

A stream belongs to one goroutine; CDLEVENINGSTARStream.Clone forks it.

func (*CDLEVENINGSTARStream) Advance

func (sp *CDLEVENINGSTARStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLEVENINGSTARStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLEVENINGSTARStream) OutRange

func (sp *CDLEVENINGSTARStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLEVENINGSTAR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLEVENINGSTARStream) Peek

func (sp *CDLEVENINGSTARStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLEVENINGSTARStream) Update

func (sp *CDLEVENINGSTARStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLEVENINGSTARStream) Value

func (sp *CDLEVENINGSTARStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLGAPSIDESIDEWHITEStream

type CDLGAPSIDESIDEWHITEStream struct {
	NearPeriodTotal  float64
	EqualPeriodTotal float64
	// contains filtered or unexported fields
}

CDLGAPSIDESIDEWHITEStream is a live CDLGAPSIDESIDEWHITE over a growing series: CDLGAPSIDESIDEWHITEStream.Update takes each new closed bar and returns the value Core.CDLGAPSIDESIDEWHITE computes at that bar over the same series. Open one with Core.CDLGAPSIDESIDEWHITEOpen or Core.CDLGAPSIDESIDEWHITEOpenAndFill.

A stream belongs to one goroutine; CDLGAPSIDESIDEWHITEStream.Clone forks it.

func (*CDLGAPSIDESIDEWHITEStream) Advance

func (sp *CDLGAPSIDESIDEWHITEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLGAPSIDESIDEWHITEStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLGAPSIDESIDEWHITEStream) OutRange

func (sp *CDLGAPSIDESIDEWHITEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLGAPSIDESIDEWHITE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLGAPSIDESIDEWHITEStream) Peek

func (sp *CDLGAPSIDESIDEWHITEStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLGAPSIDESIDEWHITEStream) Update

func (sp *CDLGAPSIDESIDEWHITEStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLGAPSIDESIDEWHITEStream) Value

func (sp *CDLGAPSIDESIDEWHITEStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLGRAVESTONEDOJIStream

type CDLGRAVESTONEDOJIStream struct {
	BodyDojiPeriodTotal        float64
	ShadowVeryShortPeriodTotal float64
	// contains filtered or unexported fields
}

CDLGRAVESTONEDOJIStream is a live CDLGRAVESTONEDOJI over a growing series: CDLGRAVESTONEDOJIStream.Update takes each new closed bar and returns the value Core.CDLGRAVESTONEDOJI computes at that bar over the same series. Open one with Core.CDLGRAVESTONEDOJIOpen or Core.CDLGRAVESTONEDOJIOpenAndFill.

A stream belongs to one goroutine; CDLGRAVESTONEDOJIStream.Clone forks it.

func (*CDLGRAVESTONEDOJIStream) Advance

func (sp *CDLGRAVESTONEDOJIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLGRAVESTONEDOJIStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLGRAVESTONEDOJIStream) OutRange

func (sp *CDLGRAVESTONEDOJIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLGRAVESTONEDOJI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLGRAVESTONEDOJIStream) Peek

func (sp *CDLGRAVESTONEDOJIStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLGRAVESTONEDOJIStream) Update

func (sp *CDLGRAVESTONEDOJIStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLGRAVESTONEDOJIStream) Value

func (sp *CDLGRAVESTONEDOJIStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLHAMMERStream

type CDLHAMMERStream struct {
	BodyPeriodTotal            float64
	ShadowLongPeriodTotal      float64
	ShadowVeryShortPeriodTotal float64
	NearPeriodTotal            float64
	// contains filtered or unexported fields
}

CDLHAMMERStream is a live CDLHAMMER over a growing series: CDLHAMMERStream.Update takes each new closed bar and returns the value Core.CDLHAMMER computes at that bar over the same series. Open one with Core.CDLHAMMEROpen or Core.CDLHAMMEROpenAndFill.

A stream belongs to one goroutine; CDLHAMMERStream.Clone forks it.

func (*CDLHAMMERStream) Advance

func (sp *CDLHAMMERStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLHAMMERStream) Clone

func (sp *CDLHAMMERStream) Clone() *CDLHAMMERStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLHAMMERStream) OutRange

func (sp *CDLHAMMERStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLHAMMER reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLHAMMERStream) Peek

func (sp *CDLHAMMERStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLHAMMERStream) Update

func (sp *CDLHAMMERStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLHAMMERStream) Value

func (sp *CDLHAMMERStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLHANGINGMANStream

type CDLHANGINGMANStream struct {
	BodyPeriodTotal            float64
	ShadowLongPeriodTotal      float64
	ShadowVeryShortPeriodTotal float64
	NearPeriodTotal            float64
	// contains filtered or unexported fields
}

CDLHANGINGMANStream is a live CDLHANGINGMAN over a growing series: CDLHANGINGMANStream.Update takes each new closed bar and returns the value Core.CDLHANGINGMAN computes at that bar over the same series. Open one with Core.CDLHANGINGMANOpen or Core.CDLHANGINGMANOpenAndFill.

A stream belongs to one goroutine; CDLHANGINGMANStream.Clone forks it.

func (*CDLHANGINGMANStream) Advance

func (sp *CDLHANGINGMANStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLHANGINGMANStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLHANGINGMANStream) OutRange

func (sp *CDLHANGINGMANStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLHANGINGMAN reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLHANGINGMANStream) Peek

func (sp *CDLHANGINGMANStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLHANGINGMANStream) Update

func (sp *CDLHANGINGMANStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLHANGINGMANStream) Value

func (sp *CDLHANGINGMANStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLHARAMICROSSStream

type CDLHARAMICROSSStream struct {
	BodyDojiPeriodTotal float64
	BodyLongPeriodTotal float64
	// contains filtered or unexported fields
}

CDLHARAMICROSSStream is a live CDLHARAMICROSS over a growing series: CDLHARAMICROSSStream.Update takes each new closed bar and returns the value Core.CDLHARAMICROSS computes at that bar over the same series. Open one with Core.CDLHARAMICROSSOpen or Core.CDLHARAMICROSSOpenAndFill.

A stream belongs to one goroutine; CDLHARAMICROSSStream.Clone forks it.

func (*CDLHARAMICROSSStream) Advance

func (sp *CDLHARAMICROSSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLHARAMICROSSStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLHARAMICROSSStream) OutRange

func (sp *CDLHARAMICROSSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLHARAMICROSS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLHARAMICROSSStream) Peek

func (sp *CDLHARAMICROSSStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLHARAMICROSSStream) Update

func (sp *CDLHARAMICROSSStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLHARAMICROSSStream) Value

func (sp *CDLHARAMICROSSStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLHARAMIStream

type CDLHARAMIStream struct {
	BodyShortPeriodTotal float64
	BodyLongPeriodTotal  float64
	// contains filtered or unexported fields
}

CDLHARAMIStream is a live CDLHARAMI over a growing series: CDLHARAMIStream.Update takes each new closed bar and returns the value Core.CDLHARAMI computes at that bar over the same series. Open one with Core.CDLHARAMIOpen or Core.CDLHARAMIOpenAndFill.

A stream belongs to one goroutine; CDLHARAMIStream.Clone forks it.

func (*CDLHARAMIStream) Advance

func (sp *CDLHARAMIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLHARAMIStream) Clone

func (sp *CDLHARAMIStream) Clone() *CDLHARAMIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLHARAMIStream) OutRange

func (sp *CDLHARAMIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLHARAMI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLHARAMIStream) Peek

func (sp *CDLHARAMIStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLHARAMIStream) Update

func (sp *CDLHARAMIStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLHARAMIStream) Value

func (sp *CDLHARAMIStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLHIGHWAVEStream

type CDLHIGHWAVEStream struct {
	BodyPeriodTotal   float64
	ShadowPeriodTotal float64
	// contains filtered or unexported fields
}

CDLHIGHWAVEStream is a live CDLHIGHWAVE over a growing series: CDLHIGHWAVEStream.Update takes each new closed bar and returns the value Core.CDLHIGHWAVE computes at that bar over the same series. Open one with Core.CDLHIGHWAVEOpen or Core.CDLHIGHWAVEOpenAndFill.

A stream belongs to one goroutine; CDLHIGHWAVEStream.Clone forks it.

func (*CDLHIGHWAVEStream) Advance

func (sp *CDLHIGHWAVEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLHIGHWAVEStream) Clone

func (sp *CDLHIGHWAVEStream) Clone() *CDLHIGHWAVEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLHIGHWAVEStream) OutRange

func (sp *CDLHIGHWAVEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLHIGHWAVE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLHIGHWAVEStream) Peek

func (sp *CDLHIGHWAVEStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLHIGHWAVEStream) Update

func (sp *CDLHIGHWAVEStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLHIGHWAVEStream) Value

func (sp *CDLHIGHWAVEStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLHIKKAKEMODStream

type CDLHIKKAKEMODStream struct {
	NearPeriodTotal float64
	// contains filtered or unexported fields
}

CDLHIKKAKEMODStream is a live CDLHIKKAKEMOD over a growing series: CDLHIKKAKEMODStream.Update takes each new closed bar and returns the value Core.CDLHIKKAKEMOD computes at that bar over the same series. Open one with Core.CDLHIKKAKEMODOpen or Core.CDLHIKKAKEMODOpenAndFill.

A stream belongs to one goroutine; CDLHIKKAKEMODStream.Clone forks it.

func (*CDLHIKKAKEMODStream) Advance

func (sp *CDLHIKKAKEMODStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLHIKKAKEMODStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLHIKKAKEMODStream) OutRange

func (sp *CDLHIKKAKEMODStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLHIKKAKEMOD reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLHIKKAKEMODStream) Peek

func (sp *CDLHIKKAKEMODStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLHIKKAKEMODStream) Update

func (sp *CDLHIKKAKEMODStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLHIKKAKEMODStream) Value

func (sp *CDLHIKKAKEMODStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLHIKKAKEStream

type CDLHIKKAKEStream struct {
	// contains filtered or unexported fields
}

CDLHIKKAKEStream is a live CDLHIKKAKE over a growing series: CDLHIKKAKEStream.Update takes each new closed bar and returns the value Core.CDLHIKKAKE computes at that bar over the same series. Open one with Core.CDLHIKKAKEOpen or Core.CDLHIKKAKEOpenAndFill.

A stream belongs to one goroutine; CDLHIKKAKEStream.Clone forks it.

func (*CDLHIKKAKEStream) Advance

func (sp *CDLHIKKAKEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLHIKKAKEStream) Clone

func (sp *CDLHIKKAKEStream) Clone() *CDLHIKKAKEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLHIKKAKEStream) OutRange

func (sp *CDLHIKKAKEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLHIKKAKE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLHIKKAKEStream) Peek

func (sp *CDLHIKKAKEStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLHIKKAKEStream) Update

func (sp *CDLHIKKAKEStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLHIKKAKEStream) Value

func (sp *CDLHIKKAKEStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLHOMINGPIGEONStream

type CDLHOMINGPIGEONStream struct {
	BodyShortPeriodTotal float64
	BodyLongPeriodTotal  float64
	// contains filtered or unexported fields
}

CDLHOMINGPIGEONStream is a live CDLHOMINGPIGEON over a growing series: CDLHOMINGPIGEONStream.Update takes each new closed bar and returns the value Core.CDLHOMINGPIGEON computes at that bar over the same series. Open one with Core.CDLHOMINGPIGEONOpen or Core.CDLHOMINGPIGEONOpenAndFill.

A stream belongs to one goroutine; CDLHOMINGPIGEONStream.Clone forks it.

func (*CDLHOMINGPIGEONStream) Advance

func (sp *CDLHOMINGPIGEONStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLHOMINGPIGEONStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLHOMINGPIGEONStream) OutRange

func (sp *CDLHOMINGPIGEONStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLHOMINGPIGEON reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLHOMINGPIGEONStream) Peek

func (sp *CDLHOMINGPIGEONStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLHOMINGPIGEONStream) Update

func (sp *CDLHOMINGPIGEONStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLHOMINGPIGEONStream) Value

func (sp *CDLHOMINGPIGEONStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLIDENTICAL3CROWSStream

type CDLIDENTICAL3CROWSStream struct {
	ShadowVeryShortPeriodTotal            [3]float64
	EqualPeriodTotal                      [3]float64
	ShadowVeryShortPeriodTotalRange1      float64
	ShadowVeryShortPeriodTotalTrailRange1 float64
	ShadowVeryShortPeriodTotalRange2      float64
	ShadowVeryShortPeriodTotalTrailRange2 float64
	EqualPeriodTotalRange2                float64
	EqualPeriodTotalTrailRange2           float64
	// contains filtered or unexported fields
}

CDLIDENTICAL3CROWSStream is a live CDLIDENTICAL3CROWS over a growing series: CDLIDENTICAL3CROWSStream.Update takes each new closed bar and returns the value Core.CDLIDENTICAL3CROWS computes at that bar over the same series. Open one with Core.CDLIDENTICAL3CROWSOpen or Core.CDLIDENTICAL3CROWSOpenAndFill.

A stream belongs to one goroutine; CDLIDENTICAL3CROWSStream.Clone forks it.

func (*CDLIDENTICAL3CROWSStream) Advance

func (sp *CDLIDENTICAL3CROWSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLIDENTICAL3CROWSStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLIDENTICAL3CROWSStream) OutRange

func (sp *CDLIDENTICAL3CROWSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLIDENTICAL3CROWS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLIDENTICAL3CROWSStream) Peek

func (sp *CDLIDENTICAL3CROWSStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLIDENTICAL3CROWSStream) Update

func (sp *CDLIDENTICAL3CROWSStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLIDENTICAL3CROWSStream) Value

func (sp *CDLIDENTICAL3CROWSStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLINNECKStream

type CDLINNECKStream struct {
	EqualPeriodTotal    float64
	BodyLongPeriodTotal float64
	// contains filtered or unexported fields
}

CDLINNECKStream is a live CDLINNECK over a growing series: CDLINNECKStream.Update takes each new closed bar and returns the value Core.CDLINNECK computes at that bar over the same series. Open one with Core.CDLINNECKOpen or Core.CDLINNECKOpenAndFill.

A stream belongs to one goroutine; CDLINNECKStream.Clone forks it.

func (*CDLINNECKStream) Advance

func (sp *CDLINNECKStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLINNECKStream) Clone

func (sp *CDLINNECKStream) Clone() *CDLINNECKStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLINNECKStream) OutRange

func (sp *CDLINNECKStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLINNECK reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLINNECKStream) Peek

func (sp *CDLINNECKStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLINNECKStream) Update

func (sp *CDLINNECKStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLINNECKStream) Value

func (sp *CDLINNECKStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLINVERTEDHAMMERStream

type CDLINVERTEDHAMMERStream struct {
	BodyPeriodTotal            float64
	ShadowLongPeriodTotal      float64
	ShadowVeryShortPeriodTotal float64
	// contains filtered or unexported fields
}

CDLINVERTEDHAMMERStream is a live CDLINVERTEDHAMMER over a growing series: CDLINVERTEDHAMMERStream.Update takes each new closed bar and returns the value Core.CDLINVERTEDHAMMER computes at that bar over the same series. Open one with Core.CDLINVERTEDHAMMEROpen or Core.CDLINVERTEDHAMMEROpenAndFill.

A stream belongs to one goroutine; CDLINVERTEDHAMMERStream.Clone forks it.

func (*CDLINVERTEDHAMMERStream) Advance

func (sp *CDLINVERTEDHAMMERStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLINVERTEDHAMMERStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLINVERTEDHAMMERStream) OutRange

func (sp *CDLINVERTEDHAMMERStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLINVERTEDHAMMER reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLINVERTEDHAMMERStream) Peek

func (sp *CDLINVERTEDHAMMERStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLINVERTEDHAMMERStream) Update

func (sp *CDLINVERTEDHAMMERStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLINVERTEDHAMMERStream) Value

func (sp *CDLINVERTEDHAMMERStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLKICKINGBYLENGTHStream

type CDLKICKINGBYLENGTHStream struct {
	ShadowVeryShortPeriodTotal            [2]float64
	BodyLongPeriodTotal                   [2]float64
	BodyLongPeriodTotalRange1             float64
	BodyLongPeriodTotalTrailRange1        float64
	ShadowVeryShortPeriodTotalRange1      float64
	ShadowVeryShortPeriodTotalTrailRange1 float64
	// contains filtered or unexported fields
}

CDLKICKINGBYLENGTHStream is a live CDLKICKINGBYLENGTH over a growing series: CDLKICKINGBYLENGTHStream.Update takes each new closed bar and returns the value Core.CDLKICKINGBYLENGTH computes at that bar over the same series. Open one with Core.CDLKICKINGBYLENGTHOpen or Core.CDLKICKINGBYLENGTHOpenAndFill.

A stream belongs to one goroutine; CDLKICKINGBYLENGTHStream.Clone forks it.

func (*CDLKICKINGBYLENGTHStream) Advance

func (sp *CDLKICKINGBYLENGTHStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLKICKINGBYLENGTHStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLKICKINGBYLENGTHStream) OutRange

func (sp *CDLKICKINGBYLENGTHStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLKICKINGBYLENGTH reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLKICKINGBYLENGTHStream) Peek

func (sp *CDLKICKINGBYLENGTHStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLKICKINGBYLENGTHStream) Update

func (sp *CDLKICKINGBYLENGTHStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLKICKINGBYLENGTHStream) Value

func (sp *CDLKICKINGBYLENGTHStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLKICKINGStream

type CDLKICKINGStream struct {
	ShadowVeryShortPeriodTotal            [2]float64
	BodyLongPeriodTotal                   [2]float64
	BodyLongPeriodTotalRange1             float64
	BodyLongPeriodTotalTrailRange1        float64
	ShadowVeryShortPeriodTotalRange1      float64
	ShadowVeryShortPeriodTotalTrailRange1 float64
	// contains filtered or unexported fields
}

CDLKICKINGStream is a live CDLKICKING over a growing series: CDLKICKINGStream.Update takes each new closed bar and returns the value Core.CDLKICKING computes at that bar over the same series. Open one with Core.CDLKICKINGOpen or Core.CDLKICKINGOpenAndFill.

A stream belongs to one goroutine; CDLKICKINGStream.Clone forks it.

func (*CDLKICKINGStream) Advance

func (sp *CDLKICKINGStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLKICKINGStream) Clone

func (sp *CDLKICKINGStream) Clone() *CDLKICKINGStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLKICKINGStream) OutRange

func (sp *CDLKICKINGStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLKICKING reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLKICKINGStream) Peek

func (sp *CDLKICKINGStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLKICKINGStream) Update

func (sp *CDLKICKINGStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLKICKINGStream) Value

func (sp *CDLKICKINGStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLLADDERBOTTOMStream

type CDLLADDERBOTTOMStream struct {
	ShadowVeryShortPeriodTotal float64
	// contains filtered or unexported fields
}

CDLLADDERBOTTOMStream is a live CDLLADDERBOTTOM over a growing series: CDLLADDERBOTTOMStream.Update takes each new closed bar and returns the value Core.CDLLADDERBOTTOM computes at that bar over the same series. Open one with Core.CDLLADDERBOTTOMOpen or Core.CDLLADDERBOTTOMOpenAndFill.

A stream belongs to one goroutine; CDLLADDERBOTTOMStream.Clone forks it.

func (*CDLLADDERBOTTOMStream) Advance

func (sp *CDLLADDERBOTTOMStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLLADDERBOTTOMStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLLADDERBOTTOMStream) OutRange

func (sp *CDLLADDERBOTTOMStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLLADDERBOTTOM reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLLADDERBOTTOMStream) Peek

func (sp *CDLLADDERBOTTOMStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLLADDERBOTTOMStream) Update

func (sp *CDLLADDERBOTTOMStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLLADDERBOTTOMStream) Value

func (sp *CDLLADDERBOTTOMStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLLONGLEGGEDDOJIStream

type CDLLONGLEGGEDDOJIStream struct {
	BodyDojiPeriodTotal   float64
	ShadowLongPeriodTotal float64
	// contains filtered or unexported fields
}

CDLLONGLEGGEDDOJIStream is a live CDLLONGLEGGEDDOJI over a growing series: CDLLONGLEGGEDDOJIStream.Update takes each new closed bar and returns the value Core.CDLLONGLEGGEDDOJI computes at that bar over the same series. Open one with Core.CDLLONGLEGGEDDOJIOpen or Core.CDLLONGLEGGEDDOJIOpenAndFill.

A stream belongs to one goroutine; CDLLONGLEGGEDDOJIStream.Clone forks it.

func (*CDLLONGLEGGEDDOJIStream) Advance

func (sp *CDLLONGLEGGEDDOJIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLLONGLEGGEDDOJIStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLLONGLEGGEDDOJIStream) OutRange

func (sp *CDLLONGLEGGEDDOJIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLLONGLEGGEDDOJI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLLONGLEGGEDDOJIStream) Peek

func (sp *CDLLONGLEGGEDDOJIStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLLONGLEGGEDDOJIStream) Update

func (sp *CDLLONGLEGGEDDOJIStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLLONGLEGGEDDOJIStream) Value

func (sp *CDLLONGLEGGEDDOJIStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLLONGLINEStream

type CDLLONGLINEStream struct {
	BodyPeriodTotal   float64
	ShadowPeriodTotal float64
	// contains filtered or unexported fields
}

CDLLONGLINEStream is a live CDLLONGLINE over a growing series: CDLLONGLINEStream.Update takes each new closed bar and returns the value Core.CDLLONGLINE computes at that bar over the same series. Open one with Core.CDLLONGLINEOpen or Core.CDLLONGLINEOpenAndFill.

A stream belongs to one goroutine; CDLLONGLINEStream.Clone forks it.

func (*CDLLONGLINEStream) Advance

func (sp *CDLLONGLINEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLLONGLINEStream) Clone

func (sp *CDLLONGLINEStream) Clone() *CDLLONGLINEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLLONGLINEStream) OutRange

func (sp *CDLLONGLINEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLLONGLINE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLLONGLINEStream) Peek

func (sp *CDLLONGLINEStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLLONGLINEStream) Update

func (sp *CDLLONGLINEStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLLONGLINEStream) Value

func (sp *CDLLONGLINEStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLMARUBOZUStream

type CDLMARUBOZUStream struct {
	BodyLongPeriodTotal        float64
	ShadowVeryShortPeriodTotal float64
	// contains filtered or unexported fields
}

CDLMARUBOZUStream is a live CDLMARUBOZU over a growing series: CDLMARUBOZUStream.Update takes each new closed bar and returns the value Core.CDLMARUBOZU computes at that bar over the same series. Open one with Core.CDLMARUBOZUOpen or Core.CDLMARUBOZUOpenAndFill.

A stream belongs to one goroutine; CDLMARUBOZUStream.Clone forks it.

func (*CDLMARUBOZUStream) Advance

func (sp *CDLMARUBOZUStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLMARUBOZUStream) Clone

func (sp *CDLMARUBOZUStream) Clone() *CDLMARUBOZUStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLMARUBOZUStream) OutRange

func (sp *CDLMARUBOZUStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLMARUBOZU reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLMARUBOZUStream) Peek

func (sp *CDLMARUBOZUStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLMARUBOZUStream) Update

func (sp *CDLMARUBOZUStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLMARUBOZUStream) Value

func (sp *CDLMARUBOZUStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLMATCHINGLOWStream

type CDLMATCHINGLOWStream struct {
	EqualPeriodTotal float64
	// contains filtered or unexported fields
}

CDLMATCHINGLOWStream is a live CDLMATCHINGLOW over a growing series: CDLMATCHINGLOWStream.Update takes each new closed bar and returns the value Core.CDLMATCHINGLOW computes at that bar over the same series. Open one with Core.CDLMATCHINGLOWOpen or Core.CDLMATCHINGLOWOpenAndFill.

A stream belongs to one goroutine; CDLMATCHINGLOWStream.Clone forks it.

func (*CDLMATCHINGLOWStream) Advance

func (sp *CDLMATCHINGLOWStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLMATCHINGLOWStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLMATCHINGLOWStream) OutRange

func (sp *CDLMATCHINGLOWStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLMATCHINGLOW reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLMATCHINGLOWStream) Peek

func (sp *CDLMATCHINGLOWStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLMATCHINGLOWStream) Update

func (sp *CDLMATCHINGLOWStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLMATCHINGLOWStream) Value

func (sp *CDLMATCHINGLOWStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLMATHOLDStream

type CDLMATHOLDStream struct {
	BodyPeriodTotal            [5]float64
	BodyPeriodTotalRange2      float64
	BodyPeriodTotalTrailRange2 float64
	BodyPeriodTotalRange3      float64
	BodyPeriodTotalTrailRange3 float64
	// contains filtered or unexported fields
}

CDLMATHOLDStream is a live CDLMATHOLD over a growing series: CDLMATHOLDStream.Update takes each new closed bar and returns the value Core.CDLMATHOLD computes at that bar over the same series. Open one with Core.CDLMATHOLDOpen or Core.CDLMATHOLDOpenAndFill.

A stream belongs to one goroutine; CDLMATHOLDStream.Clone forks it.

func (*CDLMATHOLDStream) Advance

func (sp *CDLMATHOLDStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLMATHOLDStream) Clone

func (sp *CDLMATHOLDStream) Clone() *CDLMATHOLDStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLMATHOLDStream) OutRange

func (sp *CDLMATHOLDStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLMATHOLD reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLMATHOLDStream) Peek

func (sp *CDLMATHOLDStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLMATHOLDStream) Update

func (sp *CDLMATHOLDStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLMATHOLDStream) Value

func (sp *CDLMATHOLDStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLMORNINGDOJISTARStream

type CDLMORNINGDOJISTARStream struct {
	BodyDojiPeriodTotal  float64
	BodyLongPeriodTotal  float64
	BodyShortPeriodTotal float64
	// contains filtered or unexported fields
}

CDLMORNINGDOJISTARStream is a live CDLMORNINGDOJISTAR over a growing series: CDLMORNINGDOJISTARStream.Update takes each new closed bar and returns the value Core.CDLMORNINGDOJISTAR computes at that bar over the same series. Open one with Core.CDLMORNINGDOJISTAROpen or Core.CDLMORNINGDOJISTAROpenAndFill.

A stream belongs to one goroutine; CDLMORNINGDOJISTARStream.Clone forks it.

func (*CDLMORNINGDOJISTARStream) Advance

func (sp *CDLMORNINGDOJISTARStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLMORNINGDOJISTARStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLMORNINGDOJISTARStream) OutRange

func (sp *CDLMORNINGDOJISTARStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLMORNINGDOJISTAR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLMORNINGDOJISTARStream) Peek

func (sp *CDLMORNINGDOJISTARStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLMORNINGDOJISTARStream) Update

func (sp *CDLMORNINGDOJISTARStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLMORNINGDOJISTARStream) Value

func (sp *CDLMORNINGDOJISTARStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLMORNINGSTARStream

type CDLMORNINGSTARStream struct {
	BodyShortPeriodTotal  float64
	BodyLongPeriodTotal   float64
	BodyShortPeriodTotal2 float64
	// contains filtered or unexported fields
}

CDLMORNINGSTARStream is a live CDLMORNINGSTAR over a growing series: CDLMORNINGSTARStream.Update takes each new closed bar and returns the value Core.CDLMORNINGSTAR computes at that bar over the same series. Open one with Core.CDLMORNINGSTAROpen or Core.CDLMORNINGSTAROpenAndFill.

A stream belongs to one goroutine; CDLMORNINGSTARStream.Clone forks it.

func (*CDLMORNINGSTARStream) Advance

func (sp *CDLMORNINGSTARStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLMORNINGSTARStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLMORNINGSTARStream) OutRange

func (sp *CDLMORNINGSTARStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLMORNINGSTAR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLMORNINGSTARStream) Peek

func (sp *CDLMORNINGSTARStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLMORNINGSTARStream) Update

func (sp *CDLMORNINGSTARStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLMORNINGSTARStream) Value

func (sp *CDLMORNINGSTARStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLONNECKStream

type CDLONNECKStream struct {
	EqualPeriodTotal    float64
	BodyLongPeriodTotal float64
	// contains filtered or unexported fields
}

CDLONNECKStream is a live CDLONNECK over a growing series: CDLONNECKStream.Update takes each new closed bar and returns the value Core.CDLONNECK computes at that bar over the same series. Open one with Core.CDLONNECKOpen or Core.CDLONNECKOpenAndFill.

A stream belongs to one goroutine; CDLONNECKStream.Clone forks it.

func (*CDLONNECKStream) Advance

func (sp *CDLONNECKStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLONNECKStream) Clone

func (sp *CDLONNECKStream) Clone() *CDLONNECKStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLONNECKStream) OutRange

func (sp *CDLONNECKStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLONNECK reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLONNECKStream) Peek

func (sp *CDLONNECKStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLONNECKStream) Update

func (sp *CDLONNECKStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLONNECKStream) Value

func (sp *CDLONNECKStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLPIERCINGStream

type CDLPIERCINGStream struct {
	BodyLongPeriodTotal [2]float64
	// contains filtered or unexported fields
}

CDLPIERCINGStream is a live CDLPIERCING over a growing series: CDLPIERCINGStream.Update takes each new closed bar and returns the value Core.CDLPIERCING computes at that bar over the same series. Open one with Core.CDLPIERCINGOpen or Core.CDLPIERCINGOpenAndFill.

A stream belongs to one goroutine; CDLPIERCINGStream.Clone forks it.

func (*CDLPIERCINGStream) Advance

func (sp *CDLPIERCINGStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLPIERCINGStream) Clone

func (sp *CDLPIERCINGStream) Clone() *CDLPIERCINGStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLPIERCINGStream) OutRange

func (sp *CDLPIERCINGStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLPIERCING reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLPIERCINGStream) Peek

func (sp *CDLPIERCINGStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLPIERCINGStream) Update

func (sp *CDLPIERCINGStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLPIERCINGStream) Value

func (sp *CDLPIERCINGStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLRICKSHAWMANStream

type CDLRICKSHAWMANStream struct {
	BodyDojiPeriodTotal   float64
	ShadowLongPeriodTotal float64
	NearPeriodTotal       float64
	// contains filtered or unexported fields
}

CDLRICKSHAWMANStream is a live CDLRICKSHAWMAN over a growing series: CDLRICKSHAWMANStream.Update takes each new closed bar and returns the value Core.CDLRICKSHAWMAN computes at that bar over the same series. Open one with Core.CDLRICKSHAWMANOpen or Core.CDLRICKSHAWMANOpenAndFill.

A stream belongs to one goroutine; CDLRICKSHAWMANStream.Clone forks it.

func (*CDLRICKSHAWMANStream) Advance

func (sp *CDLRICKSHAWMANStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLRICKSHAWMANStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLRICKSHAWMANStream) OutRange

func (sp *CDLRICKSHAWMANStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLRICKSHAWMAN reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLRICKSHAWMANStream) Peek

func (sp *CDLRICKSHAWMANStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLRICKSHAWMANStream) Update

func (sp *CDLRICKSHAWMANStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLRICKSHAWMANStream) Value

func (sp *CDLRICKSHAWMANStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLRISEFALL3METHODSStream

type CDLRISEFALL3METHODSStream struct {
	BodyPeriodTotal            [5]float64
	BodyPeriodTotalRange2      float64
	BodyPeriodTotalTrailRange2 float64
	BodyPeriodTotalRange3      float64
	BodyPeriodTotalTrailRange3 float64
	// contains filtered or unexported fields
}

CDLRISEFALL3METHODSStream is a live CDLRISEFALL3METHODS over a growing series: CDLRISEFALL3METHODSStream.Update takes each new closed bar and returns the value Core.CDLRISEFALL3METHODS computes at that bar over the same series. Open one with Core.CDLRISEFALL3METHODSOpen or Core.CDLRISEFALL3METHODSOpenAndFill.

A stream belongs to one goroutine; CDLRISEFALL3METHODSStream.Clone forks it.

func (*CDLRISEFALL3METHODSStream) Advance

func (sp *CDLRISEFALL3METHODSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLRISEFALL3METHODSStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLRISEFALL3METHODSStream) OutRange

func (sp *CDLRISEFALL3METHODSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLRISEFALL3METHODS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLRISEFALL3METHODSStream) Peek

func (sp *CDLRISEFALL3METHODSStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLRISEFALL3METHODSStream) Update

func (sp *CDLRISEFALL3METHODSStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLRISEFALL3METHODSStream) Value

func (sp *CDLRISEFALL3METHODSStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLSEPARATINGLINESStream

type CDLSEPARATINGLINESStream struct {
	ShadowVeryShortPeriodTotal float64
	BodyLongPeriodTotal        float64
	EqualPeriodTotal           float64
	// contains filtered or unexported fields
}

CDLSEPARATINGLINESStream is a live CDLSEPARATINGLINES over a growing series: CDLSEPARATINGLINESStream.Update takes each new closed bar and returns the value Core.CDLSEPARATINGLINES computes at that bar over the same series. Open one with Core.CDLSEPARATINGLINESOpen or Core.CDLSEPARATINGLINESOpenAndFill.

A stream belongs to one goroutine; CDLSEPARATINGLINESStream.Clone forks it.

func (*CDLSEPARATINGLINESStream) Advance

func (sp *CDLSEPARATINGLINESStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLSEPARATINGLINESStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLSEPARATINGLINESStream) OutRange

func (sp *CDLSEPARATINGLINESStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLSEPARATINGLINES reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLSEPARATINGLINESStream) Peek

func (sp *CDLSEPARATINGLINESStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLSEPARATINGLINESStream) Update

func (sp *CDLSEPARATINGLINESStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLSEPARATINGLINESStream) Value

func (sp *CDLSEPARATINGLINESStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLSHOOTINGSTARStream

type CDLSHOOTINGSTARStream struct {
	BodyPeriodTotal            float64
	ShadowLongPeriodTotal      float64
	ShadowVeryShortPeriodTotal float64
	// contains filtered or unexported fields
}

CDLSHOOTINGSTARStream is a live CDLSHOOTINGSTAR over a growing series: CDLSHOOTINGSTARStream.Update takes each new closed bar and returns the value Core.CDLSHOOTINGSTAR computes at that bar over the same series. Open one with Core.CDLSHOOTINGSTAROpen or Core.CDLSHOOTINGSTAROpenAndFill.

A stream belongs to one goroutine; CDLSHOOTINGSTARStream.Clone forks it.

func (*CDLSHOOTINGSTARStream) Advance

func (sp *CDLSHOOTINGSTARStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLSHOOTINGSTARStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLSHOOTINGSTARStream) OutRange

func (sp *CDLSHOOTINGSTARStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLSHOOTINGSTAR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLSHOOTINGSTARStream) Peek

func (sp *CDLSHOOTINGSTARStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLSHOOTINGSTARStream) Update

func (sp *CDLSHOOTINGSTARStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLSHOOTINGSTARStream) Value

func (sp *CDLSHOOTINGSTARStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLSHORTLINEStream

type CDLSHORTLINEStream struct {
	BodyPeriodTotal   float64
	ShadowPeriodTotal float64
	// contains filtered or unexported fields
}

CDLSHORTLINEStream is a live CDLSHORTLINE over a growing series: CDLSHORTLINEStream.Update takes each new closed bar and returns the value Core.CDLSHORTLINE computes at that bar over the same series. Open one with Core.CDLSHORTLINEOpen or Core.CDLSHORTLINEOpenAndFill.

A stream belongs to one goroutine; CDLSHORTLINEStream.Clone forks it.

func (*CDLSHORTLINEStream) Advance

func (sp *CDLSHORTLINEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLSHORTLINEStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLSHORTLINEStream) OutRange

func (sp *CDLSHORTLINEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLSHORTLINE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLSHORTLINEStream) Peek

func (sp *CDLSHORTLINEStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLSHORTLINEStream) Update

func (sp *CDLSHORTLINEStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLSHORTLINEStream) Value

func (sp *CDLSHORTLINEStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLSPINNINGTOPStream

type CDLSPINNINGTOPStream struct {
	BodyPeriodTotal float64
	// contains filtered or unexported fields
}

CDLSPINNINGTOPStream is a live CDLSPINNINGTOP over a growing series: CDLSPINNINGTOPStream.Update takes each new closed bar and returns the value Core.CDLSPINNINGTOP computes at that bar over the same series. Open one with Core.CDLSPINNINGTOPOpen or Core.CDLSPINNINGTOPOpenAndFill.

A stream belongs to one goroutine; CDLSPINNINGTOPStream.Clone forks it.

func (*CDLSPINNINGTOPStream) Advance

func (sp *CDLSPINNINGTOPStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLSPINNINGTOPStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLSPINNINGTOPStream) OutRange

func (sp *CDLSPINNINGTOPStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLSPINNINGTOP reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLSPINNINGTOPStream) Peek

func (sp *CDLSPINNINGTOPStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLSPINNINGTOPStream) Update

func (sp *CDLSPINNINGTOPStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLSPINNINGTOPStream) Value

func (sp *CDLSPINNINGTOPStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLSTALLEDPATTERNStream

type CDLSTALLEDPATTERNStream struct {
	BodyLongPeriodTotal            [3]float64
	NearPeriodTotal                [3]float64
	BodyLongPeriodTotalRange2      float64
	BodyLongPeriodTotalTrailRange2 float64
	NearPeriodTotalRange2          float64
	NearPeriodTotalTrailRange2     float64
	BodyShortPeriodTotal           float64
	ShadowVeryShortPeriodTotal     float64
	// contains filtered or unexported fields
}

CDLSTALLEDPATTERNStream is a live CDLSTALLEDPATTERN over a growing series: CDLSTALLEDPATTERNStream.Update takes each new closed bar and returns the value Core.CDLSTALLEDPATTERN computes at that bar over the same series. Open one with Core.CDLSTALLEDPATTERNOpen or Core.CDLSTALLEDPATTERNOpenAndFill.

A stream belongs to one goroutine; CDLSTALLEDPATTERNStream.Clone forks it.

func (*CDLSTALLEDPATTERNStream) Advance

func (sp *CDLSTALLEDPATTERNStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLSTALLEDPATTERNStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLSTALLEDPATTERNStream) OutRange

func (sp *CDLSTALLEDPATTERNStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLSTALLEDPATTERN reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLSTALLEDPATTERNStream) Peek

func (sp *CDLSTALLEDPATTERNStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLSTALLEDPATTERNStream) Update

func (sp *CDLSTALLEDPATTERNStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLSTALLEDPATTERNStream) Value

func (sp *CDLSTALLEDPATTERNStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLSTICKSANDWICHStream

type CDLSTICKSANDWICHStream struct {
	EqualPeriodTotal float64
	// contains filtered or unexported fields
}

CDLSTICKSANDWICHStream is a live CDLSTICKSANDWICH over a growing series: CDLSTICKSANDWICHStream.Update takes each new closed bar and returns the value Core.CDLSTICKSANDWICH computes at that bar over the same series. Open one with Core.CDLSTICKSANDWICHOpen or Core.CDLSTICKSANDWICHOpenAndFill.

A stream belongs to one goroutine; CDLSTICKSANDWICHStream.Clone forks it.

func (*CDLSTICKSANDWICHStream) Advance

func (sp *CDLSTICKSANDWICHStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLSTICKSANDWICHStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLSTICKSANDWICHStream) OutRange

func (sp *CDLSTICKSANDWICHStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLSTICKSANDWICH reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLSTICKSANDWICHStream) Peek

func (sp *CDLSTICKSANDWICHStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLSTICKSANDWICHStream) Update

func (sp *CDLSTICKSANDWICHStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLSTICKSANDWICHStream) Value

func (sp *CDLSTICKSANDWICHStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLTAKURIStream

type CDLTAKURIStream struct {
	BodyDojiPeriodTotal        float64
	ShadowVeryShortPeriodTotal float64
	ShadowVeryLongPeriodTotal  float64
	// contains filtered or unexported fields
}

CDLTAKURIStream is a live CDLTAKURI over a growing series: CDLTAKURIStream.Update takes each new closed bar and returns the value Core.CDLTAKURI computes at that bar over the same series. Open one with Core.CDLTAKURIOpen or Core.CDLTAKURIOpenAndFill.

A stream belongs to one goroutine; CDLTAKURIStream.Clone forks it.

func (*CDLTAKURIStream) Advance

func (sp *CDLTAKURIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLTAKURIStream) Clone

func (sp *CDLTAKURIStream) Clone() *CDLTAKURIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLTAKURIStream) OutRange

func (sp *CDLTAKURIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLTAKURI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLTAKURIStream) Peek

func (sp *CDLTAKURIStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLTAKURIStream) Update

func (sp *CDLTAKURIStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLTAKURIStream) Value

func (sp *CDLTAKURIStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLTASUKIGAPStream

type CDLTASUKIGAPStream struct {
	NearPeriodTotal float64
	// contains filtered or unexported fields
}

CDLTASUKIGAPStream is a live CDLTASUKIGAP over a growing series: CDLTASUKIGAPStream.Update takes each new closed bar and returns the value Core.CDLTASUKIGAP computes at that bar over the same series. Open one with Core.CDLTASUKIGAPOpen or Core.CDLTASUKIGAPOpenAndFill.

A stream belongs to one goroutine; CDLTASUKIGAPStream.Clone forks it.

func (*CDLTASUKIGAPStream) Advance

func (sp *CDLTASUKIGAPStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLTASUKIGAPStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLTASUKIGAPStream) OutRange

func (sp *CDLTASUKIGAPStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLTASUKIGAP reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLTASUKIGAPStream) Peek

func (sp *CDLTASUKIGAPStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLTASUKIGAPStream) Update

func (sp *CDLTASUKIGAPStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLTASUKIGAPStream) Value

func (sp *CDLTASUKIGAPStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLTHRUSTINGStream

type CDLTHRUSTINGStream struct {
	EqualPeriodTotal    float64
	BodyLongPeriodTotal float64
	// contains filtered or unexported fields
}

CDLTHRUSTINGStream is a live CDLTHRUSTING over a growing series: CDLTHRUSTINGStream.Update takes each new closed bar and returns the value Core.CDLTHRUSTING computes at that bar over the same series. Open one with Core.CDLTHRUSTINGOpen or Core.CDLTHRUSTINGOpenAndFill.

A stream belongs to one goroutine; CDLTHRUSTINGStream.Clone forks it.

func (*CDLTHRUSTINGStream) Advance

func (sp *CDLTHRUSTINGStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLTHRUSTINGStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLTHRUSTINGStream) OutRange

func (sp *CDLTHRUSTINGStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLTHRUSTING reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLTHRUSTINGStream) Peek

func (sp *CDLTHRUSTINGStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLTHRUSTINGStream) Update

func (sp *CDLTHRUSTINGStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLTHRUSTINGStream) Value

func (sp *CDLTHRUSTINGStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLTRISTARStream

type CDLTRISTARStream struct {
	BodyPeriodTotal float64
	// contains filtered or unexported fields
}

CDLTRISTARStream is a live CDLTRISTAR over a growing series: CDLTRISTARStream.Update takes each new closed bar and returns the value Core.CDLTRISTAR computes at that bar over the same series. Open one with Core.CDLTRISTAROpen or Core.CDLTRISTAROpenAndFill.

A stream belongs to one goroutine; CDLTRISTARStream.Clone forks it.

func (*CDLTRISTARStream) Advance

func (sp *CDLTRISTARStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLTRISTARStream) Clone

func (sp *CDLTRISTARStream) Clone() *CDLTRISTARStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLTRISTARStream) OutRange

func (sp *CDLTRISTARStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLTRISTAR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLTRISTARStream) Peek

func (sp *CDLTRISTARStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLTRISTARStream) Update

func (sp *CDLTRISTARStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLTRISTARStream) Value

func (sp *CDLTRISTARStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLUNIQUE3RIVERStream

type CDLUNIQUE3RIVERStream struct {
	BodyShortPeriodTotal float64
	BodyLongPeriodTotal  float64
	// contains filtered or unexported fields
}

CDLUNIQUE3RIVERStream is a live CDLUNIQUE3RIVER over a growing series: CDLUNIQUE3RIVERStream.Update takes each new closed bar and returns the value Core.CDLUNIQUE3RIVER computes at that bar over the same series. Open one with Core.CDLUNIQUE3RIVEROpen or Core.CDLUNIQUE3RIVEROpenAndFill.

A stream belongs to one goroutine; CDLUNIQUE3RIVERStream.Clone forks it.

func (*CDLUNIQUE3RIVERStream) Advance

func (sp *CDLUNIQUE3RIVERStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLUNIQUE3RIVERStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLUNIQUE3RIVERStream) OutRange

func (sp *CDLUNIQUE3RIVERStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLUNIQUE3RIVER reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLUNIQUE3RIVERStream) Peek

func (sp *CDLUNIQUE3RIVERStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLUNIQUE3RIVERStream) Update

func (sp *CDLUNIQUE3RIVERStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLUNIQUE3RIVERStream) Value

func (sp *CDLUNIQUE3RIVERStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLUPSIDEGAP2CROWSStream

type CDLUPSIDEGAP2CROWSStream struct {
	BodyShortPeriodTotal float64
	BodyLongPeriodTotal  float64
	// contains filtered or unexported fields
}

CDLUPSIDEGAP2CROWSStream is a live CDLUPSIDEGAP2CROWS over a growing series: CDLUPSIDEGAP2CROWSStream.Update takes each new closed bar and returns the value Core.CDLUPSIDEGAP2CROWS computes at that bar over the same series. Open one with Core.CDLUPSIDEGAP2CROWSOpen or Core.CDLUPSIDEGAP2CROWSOpenAndFill.

A stream belongs to one goroutine; CDLUPSIDEGAP2CROWSStream.Clone forks it.

func (*CDLUPSIDEGAP2CROWSStream) Advance

func (sp *CDLUPSIDEGAP2CROWSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLUPSIDEGAP2CROWSStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLUPSIDEGAP2CROWSStream) OutRange

func (sp *CDLUPSIDEGAP2CROWSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLUPSIDEGAP2CROWS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLUPSIDEGAP2CROWSStream) Peek

func (sp *CDLUPSIDEGAP2CROWSStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLUPSIDEGAP2CROWSStream) Update

func (sp *CDLUPSIDEGAP2CROWSStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLUPSIDEGAP2CROWSStream) Value

func (sp *CDLUPSIDEGAP2CROWSStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CDLXSIDEGAP3METHODSStream

type CDLXSIDEGAP3METHODSStream struct {
	// contains filtered or unexported fields
}

CDLXSIDEGAP3METHODSStream is a live CDLXSIDEGAP3METHODS over a growing series: CDLXSIDEGAP3METHODSStream.Update takes each new closed bar and returns the value Core.CDLXSIDEGAP3METHODS computes at that bar over the same series. Open one with Core.CDLXSIDEGAP3METHODSOpen or Core.CDLXSIDEGAP3METHODSOpenAndFill.

A stream belongs to one goroutine; CDLXSIDEGAP3METHODSStream.Clone forks it.

func (*CDLXSIDEGAP3METHODSStream) Advance

func (sp *CDLXSIDEGAP3METHODSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CDLXSIDEGAP3METHODSStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CDLXSIDEGAP3METHODSStream) OutRange

func (sp *CDLXSIDEGAP3METHODSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CDLXSIDEGAP3METHODS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CDLXSIDEGAP3METHODSStream) Peek

func (sp *CDLXSIDEGAP3METHODSStream) Peek(inOpen, inHigh, inLow, inClose float64) (int32, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CDLXSIDEGAP3METHODSStream) Update

func (sp *CDLXSIDEGAP3METHODSStream) Update(inOpen, inHigh, inLow, inClose float64) (int32, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CDLXSIDEGAP3METHODSStream) Value

func (sp *CDLXSIDEGAP3METHODSStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type CEILStream

type CEILStream struct {
	// contains filtered or unexported fields
}

CEILStream is a live CEIL over a growing series: CEILStream.Update takes each new closed bar and returns the value Core.CEIL computes at that bar over the same series. Open one with Core.CEILOpen or Core.CEILOpenAndFill.

A stream belongs to one goroutine; CEILStream.Clone forks it.

func (*CEILStream) Advance

func (sp *CEILStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CEILStream) Clone

func (sp *CEILStream) Clone() *CEILStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CEILStream) OutRange

func (sp *CEILStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CEIL reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CEILStream) Peek

func (sp *CEILStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*CEILStream) Update

func (sp *CEILStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CEILStream) Value

func (sp *CEILStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CEStream

type CEStream struct {
	// contains filtered or unexported fields
}

CEStream is a live CE over a growing series: CEStream.Update takes each new closed bar and returns the values Core.CE computes at that bar over the same series. Open one with Core.CEOpen or Core.CEOpenAndFill.

A stream belongs to one goroutine; CEStream.Clone forks it.

func (*CEStream) Advance

func (sp *CEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CEStream) Clone

func (sp *CEStream) Clone() *CEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CEStream) OutRange

func (sp *CEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CEStream) Peek

func (sp *CEStream) Peek(inHigh, inLow, inClose float64) (float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CEStream) Update

func (sp *CEStream) Update(inHigh, inLow, inClose float64) (float64, float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outRealLong and outRealShort. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CEStream) Value

func (sp *CEStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type CGStream

type CGStream struct {
	// contains filtered or unexported fields
}

CGStream is a live CG over a growing series: CGStream.Update takes each new closed bar and returns the value Core.CG computes at that bar over the same series. Open one with Core.CGOpen or Core.CGOpenAndFill.

A stream belongs to one goroutine; CGStream.Clone forks it.

func (*CGStream) Advance

func (sp *CGStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CGStream) Clone

func (sp *CGStream) Clone() *CGStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CGStream) OutRange

func (sp *CGStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CG reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CGStream) Peek

func (sp *CGStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*CGStream) Update

func (sp *CGStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CGStream) Value

func (sp *CGStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CHOPStream

type CHOPStream struct {
	// contains filtered or unexported fields
}

CHOPStream is a live CHOP over a growing series: CHOPStream.Update takes each new closed bar and returns the value Core.CHOP computes at that bar over the same series. Open one with Core.CHOPOpen or Core.CHOPOpenAndFill.

A stream belongs to one goroutine; CHOPStream.Clone forks it.

func (*CHOPStream) Advance

func (sp *CHOPStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CHOPStream) Clone

func (sp *CHOPStream) Clone() *CHOPStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CHOPStream) OutRange

func (sp *CHOPStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CHOP reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CHOPStream) Peek

func (sp *CHOPStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CHOPStream) Update

func (sp *CHOPStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CHOPStream) Value

func (sp *CHOPStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CHOPTRStream

type CHOPTRStream struct {
	// contains filtered or unexported fields
}

CHOPTRStream is a live CHOPTR over a growing series: CHOPTRStream.Update takes each new closed bar and returns the value Core.CHOPTR computes at that bar over the same series. Open one with Core.CHOPTROpen or Core.CHOPTROpenAndFill.

A stream belongs to one goroutine; CHOPTRStream.Clone forks it.

func (*CHOPTRStream) Advance

func (sp *CHOPTRStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CHOPTRStream) Clone

func (sp *CHOPTRStream) Clone() *CHOPTRStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CHOPTRStream) OutRange

func (sp *CHOPTRStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CHOPTR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CHOPTRStream) Peek

func (sp *CHOPTRStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CHOPTRStream) Update

func (sp *CHOPTRStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CHOPTRStream) Value

func (sp *CHOPTRStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CKSPStream

type CKSPStream struct {
	// contains filtered or unexported fields
}

CKSPStream is a live CKSP over a growing series: CKSPStream.Update takes each new closed bar and returns the values Core.CKSP computes at that bar over the same series. Open one with Core.CKSPOpen or Core.CKSPOpenAndFill.

A stream belongs to one goroutine; CKSPStream.Clone forks it.

func (*CKSPStream) Advance

func (sp *CKSPStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CKSPStream) Clone

func (sp *CKSPStream) Clone() *CKSPStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CKSPStream) OutRange

func (sp *CKSPStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CKSP reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CKSPStream) Peek

func (sp *CKSPStream) Peek(inHigh, inLow, inClose float64) (float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CKSPStream) Update

func (sp *CKSPStream) Update(inHigh, inLow, inClose float64) (float64, float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outHighStop and outLowStop. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CKSPStream) Value

func (sp *CKSPStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type CMFStream

type CMFStream struct {
	// contains filtered or unexported fields
}

CMFStream is a live CMF over a growing series: CMFStream.Update takes each new closed bar and returns the value Core.CMF computes at that bar over the same series. Open one with Core.CMFOpen or Core.CMFOpenAndFill.

A stream belongs to one goroutine; CMFStream.Clone forks it.

func (*CMFStream) Advance

func (sp *CMFStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CMFStream) Clone

func (sp *CMFStream) Clone() *CMFStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CMFStream) OutRange

func (sp *CMFStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CMF reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CMFStream) Peek

func (sp *CMFStream) Peek(inHigh, inLow, inClose, inVolume float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow, inClose and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CMFStream) Update

func (sp *CMFStream) Update(inHigh, inLow, inClose, inVolume float64) (float64, error)

Update commits one closed bar (inHigh, inLow, inClose and inVolume) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CMFStream) Value

func (sp *CMFStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CMOStream

type CMOStream struct {
	// contains filtered or unexported fields
}

CMOStream is a live CMO over a growing series: CMOStream.Update takes each new closed bar and returns the value Core.CMO computes at that bar over the same series. Open one with Core.CMOOpen or Core.CMOOpenAndFill.

A stream belongs to one goroutine; CMOStream.Clone forks it.

func (*CMOStream) Advance

func (sp *CMOStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CMOStream) Clone

func (sp *CMOStream) Clone() *CMOStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CMOStream) OutRange

func (sp *CMOStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CMO reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CMOStream) Peek

func (sp *CMOStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*CMOStream) Update

func (sp *CMOStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CMOStream) Value

func (sp *CMOStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CMOUStream

type CMOUStream struct {
	// contains filtered or unexported fields
}

CMOUStream is a live CMOU over a growing series: CMOUStream.Update takes each new closed bar and returns the value Core.CMOU computes at that bar over the same series. Open one with Core.CMOUOpen or Core.CMOUOpenAndFill.

A stream belongs to one goroutine; CMOUStream.Clone forks it.

func (*CMOUStream) Advance

func (sp *CMOUStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CMOUStream) Clone

func (sp *CMOUStream) Clone() *CMOUStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CMOUStream) OutRange

func (sp *CMOUStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CMOU reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CMOUStream) Peek

func (sp *CMOUStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*CMOUStream) Update

func (sp *CMOUStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CMOUStream) Value

func (sp *CMOUStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type COPPOCKStream

type COPPOCKStream struct {
	// contains filtered or unexported fields
}

COPPOCKStream is a live COPPOCK over a growing series: COPPOCKStream.Update takes each new closed bar and returns the value Core.COPPOCK computes at that bar over the same series. Open one with Core.COPPOCKOpen or Core.COPPOCKOpenAndFill.

A stream belongs to one goroutine; COPPOCKStream.Clone forks it.

func (*COPPOCKStream) Advance

func (sp *COPPOCKStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*COPPOCKStream) Clone

func (sp *COPPOCKStream) Clone() *COPPOCKStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*COPPOCKStream) OutRange

func (sp *COPPOCKStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.COPPOCK reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*COPPOCKStream) Peek

func (sp *COPPOCKStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*COPPOCKStream) Update

func (sp *COPPOCKStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*COPPOCKStream) Value

func (sp *COPPOCKStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CORRELStream

type CORRELStream struct {
	// contains filtered or unexported fields
}

CORRELStream is a live CORREL over a growing series: CORRELStream.Update takes each new closed bar and returns the value Core.CORREL computes at that bar over the same series. Open one with Core.CORRELOpen or Core.CORRELOpenAndFill.

A stream belongs to one goroutine; CORRELStream.Clone forks it.

func (*CORRELStream) Advance

func (sp *CORRELStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CORRELStream) Clone

func (sp *CORRELStream) Clone() *CORRELStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CORRELStream) OutRange

func (sp *CORRELStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CORREL reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CORRELStream) Peek

func (sp *CORRELStream) Peek(inReal0, inReal1 float64) (float64, error)

Peek returns what Update would return for the bar (inReal0 and inReal1), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CORRELStream) Update

func (sp *CORRELStream) Update(inReal0, inReal1 float64) (float64, error)

Update commits one closed bar (inReal0 and inReal1) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CORRELStream) Value

func (sp *CORRELStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type COSHStream

type COSHStream struct {
	// contains filtered or unexported fields
}

COSHStream is a live COSH over a growing series: COSHStream.Update takes each new closed bar and returns the value Core.COSH computes at that bar over the same series. Open one with Core.COSHOpen or Core.COSHOpenAndFill.

A stream belongs to one goroutine; COSHStream.Clone forks it.

func (*COSHStream) Advance

func (sp *COSHStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*COSHStream) Clone

func (sp *COSHStream) Clone() *COSHStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*COSHStream) OutRange

func (sp *COSHStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.COSH reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*COSHStream) Peek

func (sp *COSHStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*COSHStream) Update

func (sp *COSHStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*COSHStream) Value

func (sp *COSHStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type COSStream

type COSStream struct {
	// contains filtered or unexported fields
}

COSStream is a live COS over a growing series: COSStream.Update takes each new closed bar and returns the value Core.COS computes at that bar over the same series. Open one with Core.COSOpen or Core.COSOpenAndFill.

A stream belongs to one goroutine; COSStream.Clone forks it.

func (*COSStream) Advance

func (sp *COSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*COSStream) Clone

func (sp *COSStream) Clone() *COSStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*COSStream) OutRange

func (sp *COSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.COS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*COSStream) Peek

func (sp *COSStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*COSStream) Update

func (sp *COSStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*COSStream) Value

func (sp *COSStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CPRStream

type CPRStream struct {
	// contains filtered or unexported fields
}

CPRStream is a live CPR over a growing series: CPRStream.Update takes each new closed bar and returns the values Core.CPR computes at that bar over the same series. Open one with Core.CPROpen or Core.CPROpenAndFill.

A stream belongs to one goroutine; CPRStream.Clone forks it.

func (*CPRStream) Advance

func (sp *CPRStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CPRStream) Clone

func (sp *CPRStream) Clone() *CPRStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CPRStream) OutRange

func (sp *CPRStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CPR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CPRStream) Peek

func (sp *CPRStream) Peek(inHigh, inLow, inClose float64) (float64, float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CPRStream) Update

func (sp *CPRStream) Update(inHigh, inLow, inClose float64) (float64, float64, float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outRealUpperBand, outRealMiddleBand and outRealLowerBand. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CPRStream) Value

func (sp *CPRStream) Value() (float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type CRSIStream

type CRSIStream struct {
	// contains filtered or unexported fields
}

CRSIStream is a live CRSI over a growing series: CRSIStream.Update takes each new closed bar and returns the value Core.CRSI computes at that bar over the same series. Open one with Core.CRSIOpen or Core.CRSIOpenAndFill.

A stream belongs to one goroutine; CRSIStream.Clone forks it.

func (*CRSIStream) Advance

func (sp *CRSIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CRSIStream) Clone

func (sp *CRSIStream) Clone() *CRSIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CRSIStream) OutRange

func (sp *CRSIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CRSI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CRSIStream) Peek

func (sp *CRSIStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*CRSIStream) Update

func (sp *CRSIStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CRSIStream) Value

func (sp *CRSIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CTIStream

type CTIStream struct {
	// contains filtered or unexported fields
}

CTIStream is a live CTI over a growing series: CTIStream.Update takes each new closed bar and returns the value Core.CTI computes at that bar over the same series. Open one with Core.CTIOpen or Core.CTIOpenAndFill.

A stream belongs to one goroutine; CTIStream.Clone forks it.

func (*CTIStream) Advance

func (sp *CTIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CTIStream) Clone

func (sp *CTIStream) Clone() *CTIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CTIStream) OutRange

func (sp *CTIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CTI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CTIStream) Peek

func (sp *CTIStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*CTIStream) Update

func (sp *CTIStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CTIStream) Value

func (sp *CTIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CUMSUMStream

type CUMSUMStream struct {
	// contains filtered or unexported fields
}

CUMSUMStream is a live CUMSUM over a growing series: CUMSUMStream.Update takes each new closed bar and returns the value Core.CUMSUM computes at that bar over the same series. Open one with Core.CUMSUMOpen or Core.CUMSUMOpenAndFill.

A stream belongs to one goroutine; CUMSUMStream.Clone forks it.

func (*CUMSUMStream) Advance

func (sp *CUMSUMStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CUMSUMStream) Clone

func (sp *CUMSUMStream) Clone() *CUMSUMStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CUMSUMStream) OutRange

func (sp *CUMSUMStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CUMSUM reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CUMSUMStream) Peek

func (sp *CUMSUMStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*CUMSUMStream) Update

func (sp *CUMSUMStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CUMSUMStream) Value

func (sp *CUMSUMStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CVIStream

type CVIStream struct {
	// contains filtered or unexported fields
}

CVIStream is a live CVI over a growing series: CVIStream.Update takes each new closed bar and returns the value Core.CVI computes at that bar over the same series. Open one with Core.CVIOpen or Core.CVIOpenAndFill.

A stream belongs to one goroutine; CVIStream.Clone forks it.

func (*CVIStream) Advance

func (sp *CVIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*CVIStream) Clone

func (sp *CVIStream) Clone() *CVIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*CVIStream) OutRange

func (sp *CVIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.CVI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*CVIStream) Peek

func (sp *CVIStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*CVIStream) Update

func (sp *CVIStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*CVIStream) Value

func (sp *CVIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type CandleSetting

type CandleSetting struct {
	SettingType CandleSettingType
	RangeType   RangeType
	AvgPeriod   int
	Factor      float64
}

CandleSetting is one candlestick threshold: Factor times the average of RangeType over AvgPeriod previous candles (0: no averaging).

type CandleSettingType

type CandleSettingType int32

CandleSettingType names one candlestick threshold; C's order.

const (
	CandleSettingTypeBodyLong          CandleSettingType = 0
	CandleSettingTypeBodyVeryLong      CandleSettingType = 1
	CandleSettingTypeBodyShort         CandleSettingType = 2
	CandleSettingTypeBodyDoji          CandleSettingType = 3
	CandleSettingTypeShadowLong        CandleSettingType = 4
	CandleSettingTypeShadowVeryLong    CandleSettingType = 5
	CandleSettingTypeShadowShort       CandleSettingType = 6
	CandleSettingTypeShadowVeryShort   CandleSettingType = 7
	CandleSettingTypeNear              CandleSettingType = 8
	CandleSettingTypeFar               CandleSettingType = 9
	CandleSettingTypeEqual             CandleSettingType = 10
	CandleSettingTypeAllCandleSettings CandleSettingType = 11
)

The CandleSettingType members. CandleSettingTypeAllCandleSettings selects every setting, for RestoreCandleDefault only.

type Core

type Core struct {
	// contains filtered or unexported fields
}

Core holds the settings every call reads: the unstable periods, the candlestick settings and the EMA variation. The zero value is ready to use and holds C's defaults, as NewCore does. A Core is safe to share between goroutines once configured: call its setters only while no other goroutine uses it and no stream opened on it is in use.

Example (Ht_dcperiod)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.HT_DCPERIOD(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
220 values from bar 32: [15.6467, ..., 39.1993]
Example (Ht_dcphase)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.HT_DCPHASE(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
189 values from bar 63: [28.7296, ..., 192.6522]
Example (Ht_phasor)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	inPhase := make([]float64, 252)
	quadrature := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.HT_PHASOR(0, len(series)-1, series, inPhase, quadrature)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("inPhase = [%.4f, ..., %.4f]\n", inPhase[0], inPhase[r.NBElement-1])
	fmt.Printf("quadrature = [%.4f, ..., %.4f]\n", quadrature[0], quadrature[r.NBElement-1])
}
Output:
220 values from bar 32:
inPhase = [1.2892, ..., -9.5366]
quadrature = [1.0596, ..., 2.0052]
Example (Ht_sine)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	sine := make([]float64, 252)
	leadSine := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.HT_SINE(0, len(series)-1, series, sine, leadSine)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("sine = [%.4f, ..., %.4f]\n", sine[0], sine[r.NBElement-1])
	fmt.Printf("leadSine = [%.4f, ..., %.4f]\n", leadSine[0], leadSine[r.NBElement-1])
}
Output:
189 values from bar 63:
sine = [0.4807, ..., -0.2190]
leadSine = [0.9600, ..., -0.8448]
Example (Ht_trendline)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.HT_TRENDLINE(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
189 values from bar 63: [95.6417, ..., 96.7034]
Example (Ht_trendmode)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.HT_TRENDMODE(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
189 values from bar 63: [1, ..., 1]
Example (Linearreg_angle)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.LINEARREG_ANGLE(0, len(series)-1, series, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [-53.4711, ..., -50.7680]
Example (Linearreg_intercept)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.LINEARREG_INTERCEPT(0, len(series)-1, series, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [108.7000, ..., 109.9286]
Example (Linearreg_slope)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.LINEARREG_SLOPE(0, len(series)-1, series, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [-1.3500, ..., -1.2247]
Example (Minus_di)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MINUS_DI(0, len(high)-1, high, low, close, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [22.6963, ..., 14.4133]
Example (Minus_dm)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MINUS_DM(0, len(high)-1, high, low, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [17.5500, ..., 11.4676]
Example (Plus_di)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.PLUS_DI(0, len(high)-1, high, low, close, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [0.0000, ..., 7.3826]
Example (Plus_dm)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.PLUS_DM(0, len(high)-1, high, low, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [0.0000, ..., 5.8738]
Example (Swak2php)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SWAK_2PHP(0, len(series)-1, series, 20, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [0.0000, ..., 0.2147]
Example (Swak_bp)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SWAK_BP(0, len(series)-1, series, 20, 0.1, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [0.0000, ..., -3.1313]
Example (Swak_butter)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SWAK_BUTTER(0, len(series)-1, series, 20, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [110.0000, ..., 98.8859]
Example (Swak_gauss)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SWAK_GAUSS(0, len(series)-1, series, 20, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [110.0000, ..., 97.7048]
Example (Swak_hp)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SWAK_HP(0, len(series)-1, series, 20, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [0.0000, ..., -3.4618]
Example (Ulcer_roll)
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ULCER_ROLL(0, len(series)-1, series, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
226 values from bar 26: [10.0470, ..., 8.5995]

func NewCore

func NewCore() *Core

NewCore returns a Core with C's defaults: no unstable period, the default candlestick settings and the default EMA variation.

func (*Core) AC

func (c *Core) AC(startIdx, endIdx int, inHigh, inLow []float64, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int, outReal []float64) (OutRange, error)

AC computes the Accelerator/Decelerator Oscillator over bars startIdx through endIdx.

Bill Williams' Accelerator/Decelerator Oscillator (New Trading Dimensions, 1998): the rate at which market momentum is itself speeding up or slowing down. Where the Awesome Oscillator (Core.AO) measures momentum, this measures the change in that momentum, by taking the oscillator's distance above or below its own moving average.

Formula and more info at https://ta-lib.org/functions/ac.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInFastPeriod: Number of bars in the short moving average of the median price. Default 5; range 2 to 100000; IntegerDefault selects the default.
  • optInSlowPeriod: Number of bars in the long moving average of the median price. Default 34; range 2 to 100000; IntegerDefault selects the default.
  • optInSignalPeriod: Number of bars in the moving average taken over the oscillator. Default 5; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Distance of the Awesome Oscillator (Core.AO) from its own moving average, centred on zero.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ACLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.AC(0, len(high)-1, high, low, 5, 34, 5, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
215 values from bar 37: [2.9000, ..., -2.7471]

func (*Core) ACCBANDS

func (c *Core) ACCBANDS(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outRealUpperBand, outRealMiddleBand, outRealLowerBand []float64) (OutRange, error)

ACCBANDS computes the Acceleration Bands over bars startIdx through endIdx.

Acceleration Bands: three overlap lines around price. The middle band is an SMA of the close; the upper/lower bands are SMAs of the high/low scaled by an intraday-range factor.

Formula and more info at https://ta-lib.org/functions/accbands.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: SMA smoothing period for all three bands. Default 20; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outRealUpperBand: SMA of the range-scaled high band.
  • outRealMiddleBand: SMA of the close.
  • outRealLowerBand: SMA of the range-scaled low band.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ACCBANDSLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	upperBand := make([]float64, 252)
	middleBand := make([]float64, 252)
	lowerBand := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ACCBANDS(0, len(high)-1, high, low, close, 20, upperBand, middleBand, lowerBand)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("upperBand = [%.4f, ..., %.4f]\n", upperBand[0], upperBand[r.NBElement-1])
	fmt.Printf("middleBand = [%.4f, ..., %.4f]\n", middleBand[0], middleBand[r.NBElement-1])
	fmt.Printf("lowerBand = [%.4f, ..., %.4f]\n", lowerBand[0], lowerBand[r.NBElement-1])
}
Output:
233 values from bar 19:
upperBand = [110.8998, ..., 116.0730]
middleBand = [97.0250, ..., 101.4250]
lowerBand = [84.0748, ..., 87.7480]

func (*Core) ACCBANDSDisplayShift

func (c *Core) ACCBANDSDisplayShift(optInTimePeriod, outputIdx int) (int, error)

ACCBANDSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ACCBANDS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ACCBANDS followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ACCBANDSLookback rejects or an index that names no output.

func (*Core) ACCBANDSLookback

func (c *Core) ACCBANDSLookback(optInTimePeriod int) (int, error)

ACCBANDSLookback returns how many leading bars Core.ACCBANDS consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ACCBANDS and returns BadParam for one out of range.

func (*Core) ACCBANDSOpen

func (c *Core) ACCBANDSOpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*ACCBANDSStream, float64, float64, float64, error)

ACCBANDSOpen opens a live ACCBANDSStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outRealUpperBand, outRealMiddleBand and outRealLowerBand), the values Core.ACCBANDS writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.ACCBANDS.

The error is InsufficientHistory for a history of at most Core.ACCBANDSLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ACCBANDSOpenAndFill

func (c *Core) ACCBANDSOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outRealUpperBand, outRealMiddleBand, outRealLowerBand []float64) (*ACCBANDSStream, OutRange, error)

ACCBANDSOpenAndFill opens a stream as Core.ACCBANDSOpen does and also writes the outputs over the whole history, as Core.ACCBANDS writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.ACCBANDSLookback values and share no memory with an input or another output.

The errors are those of Core.ACCBANDSOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ACDisplayShift

func (c *Core) ACDisplayShift(optInFastPeriod, optInSlowPeriod, optInSignalPeriod, outputIdx int) (int, error)

ACDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.AC. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.AC followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ACLookback rejects or an index that names no output.

func (*Core) ACLookback

func (c *Core) ACLookback(optInFastPeriod, optInSlowPeriod, optInSignalPeriod int) (int, error)

ACLookback returns how many leading bars Core.AC consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.AC and returns BadParam for one out of range.

func (*Core) ACOS

func (c *Core) ACOS(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

ACOS computes the Vector Trigonometric ACos over bars startIdx through endIdx.

Element-wise arc cosine of the input series.

Formula and more info at https://ta-lib.org/functions/acos.

Inputs, each at least endIdx+1 long:

  • inReal: input values (expected in [-1, 1])

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: arc cosine of each input, in radians.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ACOSLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = -1 + 2*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ACOS(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [3.1416, ..., 0.0000]

func (*Core) ACOSDisplayShift

func (c *Core) ACOSDisplayShift(outputIdx int) (int, error)

ACOSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ACOS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.ACOS, from 0, and returns BadParam for an index that names no output.

func (*Core) ACOSLookback

func (c *Core) ACOSLookback() (int, error)

ACOSLookback returns how many leading bars Core.ACOS consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) ACOSOpen

func (c *Core) ACOSOpen(inReal []float64) (*ACOSStream, float64, error)

ACOSOpen opens a live ACOSStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ACOS writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.ACOSLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) ACOSOpenAndFill

func (c *Core) ACOSOpenAndFill(inReal, outReal []float64) (*ACOSStream, OutRange, error)

ACOSOpenAndFill opens a stream as Core.ACOSOpen does and also writes the outputs over the whole history, as Core.ACOS writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.ACOSLookback values and share no memory with an input or another output.

The errors are those of Core.ACOSOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ACOpen

func (c *Core) ACOpen(inHigh, inLow []float64, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int) (*ACStream, float64, error)

ACOpen opens a live ACStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.AC writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.AC.

The error is InsufficientHistory for a history of at most Core.ACLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ACOpenAndFill

func (c *Core) ACOpenAndFill(inHigh, inLow []float64, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int, outReal []float64) (*ACStream, OutRange, error)

ACOpenAndFill opens a stream as Core.ACOpen does and also writes the outputs over the whole history, as Core.AC writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.ACLookback values and share no memory with an input or another output.

The errors are those of Core.ACOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) AD

func (c *Core) AD(startIdx, endIdx int, inHigh, inLow, inClose, inVolume, outReal []float64) (OutRange, error)

AD computes the Chaikin A/D Line over bars startIdx through endIdx.

Chaikin Accumulation/Distribution Line, a cumulative volume-flow indicator. Sums a volume-weighted money-flow multiplier per bar to gauge buying vs. selling pressure. Rising line = accumulation (buying pressure); falling = distribution.

Formula and more info at https://ta-lib.org/functions/ad.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.
  • inVolume: Volume of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Cumulative A/D line value per bar.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ADLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.AD(0, len(high)-1, high, low, close, volume, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [5473.6842, ..., -606413.2613]

func (*Core) ADD

func (c *Core) ADD(startIdx, endIdx int, inReal0, inReal1, outReal []float64) (OutRange, error)

ADD computes the Vector Arithmetic Add over bars startIdx through endIdx.

Element-wise addition of two input series.

Formula and more info at https://ta-lib.org/functions/add.

Inputs, each at least endIdx+1 long:

  • inReal0: First operand series.
  • inReal1: Second operand series.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Element-wise sum of the two inputs.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ADDLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series0 := make([]float64, 252) // your data, oldest first
	for i := range series0 {
		series0[i] = float64(10*(i%40-20)*(i%40-20)-2000) / 201
	}
	series1 := make([]float64, 252) // your data, oldest first
	for i := range series1 {
		series1[i] = -5 + 10*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ADD(0, len(series0)-1, series0, series1, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [4.9502, ..., -0.9204]

func (*Core) ADDDisplayShift

func (c *Core) ADDDisplayShift(outputIdx int) (int, error)

ADDDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ADD. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.ADD, from 0, and returns BadParam for an index that names no output.

func (*Core) ADDLookback

func (c *Core) ADDLookback() (int, error)

ADDLookback returns how many leading bars Core.ADD consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) ADDOpen

func (c *Core) ADDOpen(inReal0, inReal1 []float64) (*ADDStream, float64, error)

ADDOpen opens a live ADDStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ADD writes there.

inReal0 and inReal1 are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.ADDLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) ADDOpenAndFill

func (c *Core) ADDOpenAndFill(inReal0, inReal1, outReal []float64) (*ADDStream, OutRange, error)

ADDOpenAndFill opens a stream as Core.ADDOpen does and also writes the outputs over the whole history, as Core.ADD writes them for bars 0 through len(inReal0)-1, returning that range.

Each output must hold len(inReal0) minus Core.ADDLookback values and share no memory with an input or another output.

The errors are those of Core.ADDOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ADDisplayShift

func (c *Core) ADDisplayShift(outputIdx int) (int, error)

ADDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.AD. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.AD, from 0, and returns BadParam for an index that names no output.

func (*Core) ADLookback

func (c *Core) ADLookback() (int, error)

ADLookback returns how many leading bars Core.AD consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) ADOSC

func (c *Core) ADOSC(startIdx, endIdx int, inHigh, inLow, inClose, inVolume []float64, optInFastPeriod, optInSlowPeriod int, outReal []float64) (OutRange, error)

ADOSC computes the Chaikin A/D Oscillator over bars startIdx through endIdx.

Chaikin A/D Oscillator: the difference between a fast and a slow EMA of the Accumulation/Distribution line. Highlights momentum in accumulation/distribution volume flow. Positive/rising suggests accumulation; negative/falling suggests distribution.

Formula and more info at https://ta-lib.org/functions/adosc.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.
  • inVolume: Volume of each bar.

Parameters:

  • optInFastPeriod: Period of the fast A/D EMA. Default 3; range 2 to 100000; IntegerDefault selects the default.
  • optInSlowPeriod: Period of the slow A/D EMA. Default 10; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Fast-EMA minus slow-EMA of the A/D line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ADOSCLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ADOSC(0, len(high)-1, high, low, close, volume, 3, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
243 values from bar 9: [-2760.4458, ..., -9229.2767]

func (*Core) ADOSCDisplayShift

func (c *Core) ADOSCDisplayShift(optInFastPeriod, optInSlowPeriod, outputIdx int) (int, error)

ADOSCDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ADOSC. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ADOSC followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ADOSCLookback rejects or an index that names no output.

func (*Core) ADOSCLookback

func (c *Core) ADOSCLookback(optInFastPeriod, optInSlowPeriod int) (int, error)

ADOSCLookback returns how many leading bars Core.ADOSC consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ADOSC and returns BadParam for one out of range.

func (*Core) ADOSCOpen

func (c *Core) ADOSCOpen(inHigh, inLow, inClose, inVolume []float64, optInFastPeriod, optInSlowPeriod int) (*ADOSCStream, float64, error)

ADOSCOpen opens a live ADOSCStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ADOSC writes there.

inHigh, inLow, inClose and inVolume are the histories, of one length; the parameters are those of Core.ADOSC.

The error is InsufficientHistory for a history of at most Core.ADOSCLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ADOSCOpenAndFill

func (c *Core) ADOSCOpenAndFill(inHigh, inLow, inClose, inVolume []float64, optInFastPeriod, optInSlowPeriod int, outReal []float64) (*ADOSCStream, OutRange, error)

ADOSCOpenAndFill opens a stream as Core.ADOSCOpen does and also writes the outputs over the whole history, as Core.ADOSC writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.ADOSCLookback values and share no memory with an input or another output.

The errors are those of Core.ADOSCOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ADOpen

func (c *Core) ADOpen(inHigh, inLow, inClose, inVolume []float64) (*ADStream, float64, error)

ADOpen opens a live ADStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.AD writes there.

inHigh, inLow, inClose and inVolume are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.ADLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) ADOpenAndFill

func (c *Core) ADOpenAndFill(inHigh, inLow, inClose, inVolume, outReal []float64) (*ADStream, OutRange, error)

ADOpenAndFill opens a stream as Core.ADOpen does and also writes the outputs over the whole history, as Core.AD writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.ADLookback values and share no memory with an input or another output.

The errors are those of Core.ADOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ADR

func (c *Core) ADR(startIdx, endIdx int, inHigh, inLow []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

ADR computes the Average Day Range over bars startIdx through endIdx.

Average Day Range: the arithmetic mean of the last optInTimePeriod bar ranges, high minus low. It answers how far price travels within a bar, and is read as a volatility budget — a stop or a target much smaller than ADR is inside the noise the instrument produces on an ordinary bar, one much larger asks for a move that rarely happens.

Formula and more info at https://ta-lib.org/functions/adr.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInTimePeriod: Number of bar ranges averaged. Published conventions differ and none is authoritative: TradingView's ADR indicator page works its example over 7 bars, TC2000's over 10, and the Qullamaggie screener community reads "ADR" as 20. The value shipped here is ATR's, so the two volatility measures are comparable out of the box. Default 14; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Average bar range over the window, in price units.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ADRLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ADR(0, len(high)-1, high, low, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [5.5571, ..., 5.3286]

func (*Core) ADRDisplayShift

func (c *Core) ADRDisplayShift(optInTimePeriod, outputIdx int) (int, error)

ADRDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ADR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ADR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ADRLookback rejects or an index that names no output.

func (*Core) ADRLookback

func (c *Core) ADRLookback(optInTimePeriod int) (int, error)

ADRLookback returns how many leading bars Core.ADR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ADR and returns BadParam for one out of range.

func (*Core) ADROpen

func (c *Core) ADROpen(inHigh, inLow []float64, optInTimePeriod int) (*ADRStream, float64, error)

ADROpen opens a live ADRStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ADR writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.ADR.

The error is InsufficientHistory for a history of at most Core.ADRLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ADROpenAndFill

func (c *Core) ADROpenAndFill(inHigh, inLow []float64, optInTimePeriod int, outReal []float64) (*ADRStream, OutRange, error)

ADROpenAndFill opens a stream as Core.ADROpen does and also writes the outputs over the whole history, as Core.ADR writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.ADRLookback values and share no memory with an input or another output.

The errors are those of Core.ADROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ADX

func (c *Core) ADX(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

ADX computes the Average Directional Movement Index over bars startIdx through endIdx.

Wilder's Average Directional Movement Index, a smoothed measure of trend strength derived from the directional indicators (+DI/-DI). Quantifies how strongly a market is trending, regardless of direction. Higher values indicate a stronger trend (a common convention treats >25 as trending); says nothing about direction.

Formula and more info at https://ta-lib.org/functions/adx.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Smoothing/averaging period for DM, TR, and ADX. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Smoothed directional trend-strength index (0-100)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ADXLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdADX (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ADX(0, len(high)-1, high, low, close, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
225 values from bar 27: [82.0443, ..., 32.8646]

func (*Core) ADXDisplayShift

func (c *Core) ADXDisplayShift(optInTimePeriod, outputIdx int) (int, error)

ADXDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ADX. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ADX followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ADXLookback rejects or an index that names no output.

func (*Core) ADXLookback

func (c *Core) ADXLookback(optInTimePeriod int) (int, error)

ADXLookback returns how many leading bars Core.ADX consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdADX (see Core.SetUnstablePeriod).

It takes the parameters of Core.ADX and returns BadParam for one out of range.

func (*Core) ADXOpen

func (c *Core) ADXOpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*ADXStream, float64, error)

ADXOpen opens a live ADXStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ADX writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.ADX.

The error is InsufficientHistory for a history of at most Core.ADXLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ADXOpenAndFill

func (c *Core) ADXOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (*ADXStream, OutRange, error)

ADXOpenAndFill opens a stream as Core.ADXOpen does and also writes the outputs over the whole history, as Core.ADX writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.ADXLookback values and share no memory with an input or another output.

The errors are those of Core.ADXOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ADXR

func (c *Core) ADXR(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

ADXR computes the Average Directional Movement Index Rating over bars startIdx through endIdx.

Smoothed variant of ADX: the average of the current ADX value and the ADX value from (period-1) bars earlier. Further damps ADX to gauge trend strength. Higher values mean a stronger trend; smoother and more lagging than ADX.

Formula and more info at https://ta-lib.org/functions/adxr.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Smoothing period, also the bar gap between the two averaged ADX values. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: ADXR line (averaged ADX)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ADXRLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ADXR(0, len(high)-1, high, low, close, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
212 values from bar 40: [69.6458, ..., 36.7686]

func (*Core) ADXRDisplayShift

func (c *Core) ADXRDisplayShift(optInTimePeriod, outputIdx int) (int, error)

ADXRDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ADXR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ADXR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ADXRLookback rejects or an index that names no output.

func (*Core) ADXRLookback

func (c *Core) ADXRLookback(optInTimePeriod int) (int, error)

ADXRLookback returns how many leading bars Core.ADXR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ADXR and returns BadParam for one out of range.

func (*Core) ADXROpen

func (c *Core) ADXROpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*ADXRStream, float64, error)

ADXROpen opens a live ADXRStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ADXR writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.ADXR.

The error is InsufficientHistory for a history of at most Core.ADXRLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ADXROpenAndFill

func (c *Core) ADXROpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (*ADXRStream, OutRange, error)

ADXROpenAndFill opens a stream as Core.ADXROpen does and also writes the outputs over the whole history, as Core.ADXR writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.ADXRLookback values and share no memory with an input or another output.

The errors are those of Core.ADXROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ALLIGATOR

func (c *Core) ALLIGATOR(startIdx, endIdx int, inHigh, inLow []float64, optInJawPeriod, optInJawShift, optInTeethPeriod, optInTeethShift, optInLipsPeriod, optInLipsShift int, outJaw, outTeeth, outLips []float64) (OutRange, error)

ALLIGATOR computes the Williams Alligator over bars startIdx through endIdx.

Bill Williams' Alligator (Trading Chaos, 1995): three smoothed moving averages of the median price. The Jaw, Teeth and Lips are each drawn a few bars ahead of the bar that computed it. When the three lines are intertwined the alligator sleeps and the market has no trend; when they fan out in order, Lips above Teeth above Jaw or the reverse, it is feeding and a trend is under way. Price crossing back into the lines is read as the trend tiring.

Formula and more info at https://ta-lib.org/functions/alligator.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInJawPeriod: Number of bars in the jaw's smoothed moving average. Default 13; range 1 to 100000; IntegerDefault selects the default.
  • optInJawShift: Bars ahead of the computing bar at which a chart draws the jaw. Default 8; range 0 to 100000; IntegerDefault selects the default.
  • optInTeethPeriod: Number of bars in the teeth's smoothed moving average. Default 8; range 1 to 100000; IntegerDefault selects the default.
  • optInTeethShift: Bars ahead of the computing bar at which a chart draws the teeth. Default 5; range 0 to 100000; IntegerDefault selects the default.
  • optInLipsPeriod: Number of bars in the lips' smoothed moving average. Default 5; range 1 to 100000; IntegerDefault selects the default.
  • optInLipsShift: Bars ahead of the computing bar at which a chart draws the lips. Default 3; range 0 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outJaw: Jaw: the slowest line, drawn ahead by the jaw shift.
  • outTeeth: Teeth: the middle line, drawn ahead by the teeth shift.
  • outLips: Lips: the fastest line, drawn ahead by the lips shift.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ALLIGATORLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	jaw := make([]float64, 252)
	teeth := make([]float64, 252)
	lips := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ALLIGATOR(0, len(high)-1, high, low, 13, 8, 8, 5, 5, 3, jaw, teeth, lips)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("jaw = [%.4f, ..., %.4f]\n", jaw[0], jaw[r.NBElement-1])
	fmt.Printf("teeth = [%.4f, ..., %.4f]\n", teeth[0], teeth[r.NBElement-1])
	fmt.Printf("lips = [%.4f, ..., %.4f]\n", lips[0], lips[r.NBElement-1])
}
Output:
240 values from bar 12:
jaw = [100.5000, ..., 99.1056]
teeth = [96.8750, ..., 99.1236]
lips = [95.1000, ..., 98.0754]

func (*Core) ALLIGATORDisplayShift

func (c *Core) ALLIGATORDisplayShift(optInJawPeriod, optInJawShift, optInTeethPeriod, optInTeethShift, optInLipsPeriod, optInLipsShift, outputIdx int) (int, error)

ALLIGATORDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ALLIGATOR. The values are never shifted.

It takes the parameters of Core.ALLIGATOR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ALLIGATORLookback rejects or an index that names no output.

func (*Core) ALLIGATORLookback

func (c *Core) ALLIGATORLookback(optInJawPeriod, optInJawShift, optInTeethPeriod, optInTeethShift, optInLipsPeriod, optInLipsShift int) (int, error)

ALLIGATORLookback returns how many leading bars Core.ALLIGATOR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ALLIGATOR and returns BadParam for one out of range.

func (*Core) ALLIGATOROpen

func (c *Core) ALLIGATOROpen(inHigh, inLow []float64, optInJawPeriod, optInJawShift, optInTeethPeriod, optInTeethShift, optInLipsPeriod, optInLipsShift int) (*ALLIGATORStream, float64, float64, float64, error)

ALLIGATOROpen opens a live ALLIGATORStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outJaw, outTeeth and outLips), the values Core.ALLIGATOR writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.ALLIGATOR.

The error is InsufficientHistory for a history of at most Core.ALLIGATORLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ALLIGATOROpenAndFill

func (c *Core) ALLIGATOROpenAndFill(inHigh, inLow []float64, optInJawPeriod, optInJawShift, optInTeethPeriod, optInTeethShift, optInLipsPeriod, optInLipsShift int, outJaw, outTeeth, outLips []float64) (*ALLIGATORStream, OutRange, error)

ALLIGATOROpenAndFill opens a stream as Core.ALLIGATOROpen does and also writes the outputs over the whole history, as Core.ALLIGATOR writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.ALLIGATORLookback values and share no memory with an input or another output.

The errors are those of Core.ALLIGATOROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ALMA

func (c *Core) ALMA(startIdx, endIdx int, inReal []float64, optInTimePeriod int, optInSigma, optInOffset float64, outReal []float64) (OutRange, error)

ALMA computes the Arnaud Legoux Moving Average over bars startIdx through endIdx.

Arnaud Legoux Moving Average: the last N inputs weighted by a Gaussian whose peak sits a fraction offset of the way from the oldest to the newest bar. Moving the offset toward 1 puts the peak on recent bars and cuts the lag; moving it toward 0 puts the peak on old bars and lags most. Smoothing is greatest with the peak mid-window, near 0.5. Sigma sets the width: the Gaussian's standard deviation is N / sigma bars, so a larger sigma concentrates the weight around the peak and smooths less.

Formula and more info at https://ta-lib.org/functions/alma.

Inputs, each at least endIdx+1 long:

  • inReal: Data on which to compute the average.

Parameters:

  • optInTimePeriod: Number of bars in the window. Default 9; range 1 to 100000; IntegerDefault selects the default.
  • optInSigma: Divides the period to give the Gaussian's width in bars. Default 6; minimum 0.01; RealDefault selects the default.
  • optInOffset: Position of the peak weight, 0 at the oldest bar and 1 at the newest. Default 0.85; range 0 to 1; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Arnaud Legoux Moving Average line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ALMALookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ALMA(0, len(series)-1, series, 9, 6, 0.85, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
244 values from bar 8: [100.1040, ..., 96.3088]

func (*Core) ALMADisplayShift

func (c *Core) ALMADisplayShift(optInTimePeriod int, optInSigma, optInOffset float64, outputIdx int) (int, error)

ALMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ALMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ALMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ALMALookback rejects or an index that names no output.

func (*Core) ALMALookback

func (c *Core) ALMALookback(optInTimePeriod int, optInSigma, optInOffset float64) (int, error)

ALMALookback returns how many leading bars Core.ALMA consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ALMA and returns BadParam for one out of range.

func (*Core) ALMAOpen

func (c *Core) ALMAOpen(inReal []float64, optInTimePeriod int, optInSigma, optInOffset float64) (*ALMAStream, float64, error)

ALMAOpen opens a live ALMAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ALMA writes there.

inReal is the history; the parameters are those of Core.ALMA.

The error is InsufficientHistory for a history of at most Core.ALMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) ALMAOpenAndFill

func (c *Core) ALMAOpenAndFill(inReal []float64, optInTimePeriod int, optInSigma, optInOffset float64, outReal []float64) (*ALMAStream, OutRange, error)

ALMAOpenAndFill opens a stream as Core.ALMAOpen does and also writes the outputs over the whole history, as Core.ALMA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.ALMALookback values and share no memory with an input or another output.

The errors are those of Core.ALMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) AO

func (c *Core) AO(startIdx, endIdx int, inHigh, inLow []float64, optInFastPeriod, optInSlowPeriod int, outReal []float64) (OutRange, error)

AO computes the Awesome Oscillator over bars startIdx through endIdx.

Bill Williams' Awesome Oscillator (New Trading Dimensions, 1998): market momentum read as the spread between a short and a long simple moving average of the median price. It contrasts what the recent bars have done against a longer stretch of the same market, using the bar midpoint rather than the close so that intrabar range, not the settle, drives the reading.

Formula and more info at https://ta-lib.org/functions/ao.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInFastPeriod: Number of bars in the short moving average. Default 5; range 2 to 100000; IntegerDefault selects the default.
  • optInSlowPeriod: Number of bars in the long moving average. Default 34; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Spread between the two moving averages, centred on zero.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.AOLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.AO(0, len(high)-1, high, low, 5, 34, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
219 values from bar 33: [0.7250, ..., -1.4103]

func (*Core) AODisplayShift

func (c *Core) AODisplayShift(optInFastPeriod, optInSlowPeriod, outputIdx int) (int, error)

AODisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.AO. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.AO followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.AOLookback rejects or an index that names no output.

func (*Core) AOLookback

func (c *Core) AOLookback(optInFastPeriod, optInSlowPeriod int) (int, error)

AOLookback returns how many leading bars Core.AO consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.AO and returns BadParam for one out of range.

func (*Core) AOOpen

func (c *Core) AOOpen(inHigh, inLow []float64, optInFastPeriod, optInSlowPeriod int) (*AOStream, float64, error)

AOOpen opens a live AOStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.AO writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.AO.

The error is InsufficientHistory for a history of at most Core.AOLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) AOOpenAndFill

func (c *Core) AOOpenAndFill(inHigh, inLow []float64, optInFastPeriod, optInSlowPeriod int, outReal []float64) (*AOStream, OutRange, error)

AOOpenAndFill opens a stream as Core.AOOpen does and also writes the outputs over the whole history, as Core.AO writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.AOLookback values and share no memory with an input or another output.

The errors are those of Core.AOOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) APO

func (c *Core) APO(startIdx, endIdx int, inReal []float64, optInFastPeriod, optInSlowPeriod int, optInMAType MAType, outReal []float64) (OutRange, error)

APO computes the Absolute Price Oscillator over bars startIdx through endIdx.

Absolute Price Oscillator: the difference between a fast and a slow moving average of the input, in price units. Measures short- vs long-term momentum. Positive when fast MA > slow MA (upward momentum); negative otherwise.

Formula and more info at https://ta-lib.org/functions/apo.

Inputs, each at least endIdx+1 long:

  • inReal: Source data series.

Parameters:

  • optInFastPeriod: Period of the fast moving average. Default 12; range 2 to 10000; IntegerDefault selects the default.
  • optInSlowPeriod: Period of the slow moving average. Default 26; range 2 to 10000; IntegerDefault selects the default.
  • optInMAType: Moving-average type used for both MAs. Default MATypeEMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Fast MA minus slow MA.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.APOLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.APO(0, len(series)-1, series, 12, 26, talib.MATypeEMA, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
227 values from bar 25: [-3.9399, ..., -0.2779]

func (*Core) APODisplayShift

func (c *Core) APODisplayShift(optInFastPeriod, optInSlowPeriod int, optInMAType MAType, outputIdx int) (int, error)

APODisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.APO. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.APO followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.APOLookback rejects or an index that names no output.

func (*Core) APOLookback

func (c *Core) APOLookback(optInFastPeriod, optInSlowPeriod int, optInMAType MAType) (int, error)

APOLookback returns how many leading bars Core.APO consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.APO and returns BadParam for one out of range.

func (*Core) APOOpen

func (c *Core) APOOpen(inReal []float64, optInFastPeriod, optInSlowPeriod int, optInMAType MAType) (*APOStream, float64, error)

APOOpen opens a live APOStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.APO writes there.

inReal is the history; the parameters are those of Core.APO.

The error is InsufficientHistory for a history of at most Core.APOLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) APOOpenAndFill

func (c *Core) APOOpenAndFill(inReal []float64, optInFastPeriod, optInSlowPeriod int, optInMAType MAType, outReal []float64) (*APOStream, OutRange, error)

APOOpenAndFill opens a stream as Core.APOOpen does and also writes the outputs over the whole history, as Core.APO writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.APOLookback values and share no memory with an input or another output.

The errors are those of Core.APOOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) AROON

func (c *Core) AROON(startIdx, endIdx int, inHigh, inLow []float64, optInTimePeriod int, outAroonDown, outAroonUp []float64) (OutRange, error)

AROON computes the Aroon over bars startIdx through endIdx.

Aroon reports how recently the highest high and lowest low occurred within a rolling window of length optInTimePeriod, as two 0-100 oscillators. Indicates trend strength and direction. Up near 100 = a very recent new high (strong uptrend); Down near 100 = a very recent new low. Up/Down crossovers signal trend shifts.

Formula and more info at https://ta-lib.org/functions/aroon.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInTimePeriod: Lookback window length. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outAroonDown: Recency of the lowest low (100 = it is the current bar, decaying as it ages)
  • outAroonUp: Recency of the highest high (100 = it is the current bar, decaying as it ages)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.AROONLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	aroonDown := make([]float64, 252)
	aroonUp := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.AROON(0, len(high)-1, high, low, 14, aroonDown, aroonUp)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("aroonDown = [%.4f, ..., %.4f]\n", aroonDown[0], aroonDown[r.NBElement-1])
	fmt.Printf("aroonUp = [%.4f, ..., %.4f]\n", aroonUp[0], aroonUp[r.NBElement-1])
}
Output:
238 values from bar 14:
aroonDown = [100.0000, ..., 100.0000]
aroonUp = [0.0000, ..., 21.4286]

func (*Core) AROONDisplayShift

func (c *Core) AROONDisplayShift(optInTimePeriod, outputIdx int) (int, error)

AROONDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.AROON. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.AROON followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.AROONLookback rejects or an index that names no output.

func (*Core) AROONLookback

func (c *Core) AROONLookback(optInTimePeriod int) (int, error)

AROONLookback returns how many leading bars Core.AROON consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.AROON and returns BadParam for one out of range.

func (*Core) AROONOSC

func (c *Core) AROONOSC(startIdx, endIdx int, inHigh, inLow []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

AROONOSC computes the Aroon Oscillator over bars startIdx through endIdx.

Aroon Oscillator: AroonUp minus AroonDown over a lookback window. Measures trend direction and strength on a -100..+100 scale. Positive when the high is more recent than the low (up-trend); negative when the low is more recent (down-trend).

Formula and more info at https://ta-lib.org/functions/aroonosc.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInTimePeriod: Lookback window for locating the highest high and lowest low. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Aroon oscillator value (AroonUp - AroonDown)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.AROONOSCLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.AROONOSC(0, len(high)-1, high, low, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [-100.0000, ..., -78.5714]

func (*Core) AROONOSCDisplayShift

func (c *Core) AROONOSCDisplayShift(optInTimePeriod, outputIdx int) (int, error)

AROONOSCDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.AROONOSC. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.AROONOSC followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.AROONOSCLookback rejects or an index that names no output.

func (*Core) AROONOSCLookback

func (c *Core) AROONOSCLookback(optInTimePeriod int) (int, error)

AROONOSCLookback returns how many leading bars Core.AROONOSC consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.AROONOSC and returns BadParam for one out of range.

func (*Core) AROONOSCOpen

func (c *Core) AROONOSCOpen(inHigh, inLow []float64, optInTimePeriod int) (*AROONOSCStream, float64, error)

AROONOSCOpen opens a live AROONOSCStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.AROONOSC writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.AROONOSC.

The error is InsufficientHistory for a history of at most Core.AROONOSCLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) AROONOSCOpenAndFill

func (c *Core) AROONOSCOpenAndFill(inHigh, inLow []float64, optInTimePeriod int, outReal []float64) (*AROONOSCStream, OutRange, error)

AROONOSCOpenAndFill opens a stream as Core.AROONOSCOpen does and also writes the outputs over the whole history, as Core.AROONOSC writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.AROONOSCLookback values and share no memory with an input or another output.

The errors are those of Core.AROONOSCOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) AROONOpen

func (c *Core) AROONOpen(inHigh, inLow []float64, optInTimePeriod int) (*AROONStream, float64, float64, error)

AROONOpen opens a live AROONStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outAroonDown and outAroonUp), the values Core.AROON writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.AROON.

The error is InsufficientHistory for a history of at most Core.AROONLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) AROONOpenAndFill

func (c *Core) AROONOpenAndFill(inHigh, inLow []float64, optInTimePeriod int, outAroonDown, outAroonUp []float64) (*AROONStream, OutRange, error)

AROONOpenAndFill opens a stream as Core.AROONOpen does and also writes the outputs over the whole history, as Core.AROON writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.AROONLookback values and share no memory with an input or another output.

The errors are those of Core.AROONOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ASI

func (c *Core) ASI(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, optInLimitMove float64, outReal []float64) (OutRange, error)

ASI computes the Wilder Accumulative Swing Index over bars startIdx through endIdx.

Wilder's Accumulative Swing Index: the running total of the Swing Index (SI), a line meant to trace the market's real swings through the noise of the daily closes. Wilder draws trendlines and breakout points on it as on a price chart: a breakout of the ASI that the price has not confirmed yet is his signal. J. Welles Wilder Jr. introduced both in 1978. The line starts at 0 on the first bar of the requested range, so only its shape carries meaning, not its level.

Formula and more info at https://ta-lib.org/functions/asi.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInLimitMove: Limit move, the largest one-bar price move the index is scaled against, in price units. Default 3; minimum 0.00000001; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Running total of the swing index from the first bar of the range.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ASILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ASI(0, len(open)-1, open, high, low, close, 3, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [0.0000, ..., -600.1100]

func (*Core) ASIDisplayShift

func (c *Core) ASIDisplayShift(optInLimitMove float64, outputIdx int) (int, error)

ASIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ASI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ASI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ASILookback rejects or an index that names no output.

func (*Core) ASILookback

func (c *Core) ASILookback(optInLimitMove float64) (int, error)

ASILookback returns how many leading bars Core.ASI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ASI and returns BadParam for one out of range.

func (*Core) ASIN

func (c *Core) ASIN(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

ASIN computes the Vector Trigonometric ASin over bars startIdx through endIdx.

Element-wise arcsine of the input series.

Formula and more info at https://ta-lib.org/functions/asin.

Inputs, each at least endIdx+1 long:

  • inReal: Input values (domain [-1,1] for a real result)

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Arcsine of each input, in radians.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ASINLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = -1 + 2*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ASIN(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [-1.5708, ..., 1.5708]

func (*Core) ASINDisplayShift

func (c *Core) ASINDisplayShift(outputIdx int) (int, error)

ASINDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ASIN. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.ASIN, from 0, and returns BadParam for an index that names no output.

func (*Core) ASINLookback

func (c *Core) ASINLookback() (int, error)

ASINLookback returns how many leading bars Core.ASIN consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) ASINOpen

func (c *Core) ASINOpen(inReal []float64) (*ASINStream, float64, error)

ASINOpen opens a live ASINStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ASIN writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.ASINLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) ASINOpenAndFill

func (c *Core) ASINOpenAndFill(inReal, outReal []float64) (*ASINStream, OutRange, error)

ASINOpenAndFill opens a stream as Core.ASINOpen does and also writes the outputs over the whole history, as Core.ASIN writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.ASINLookback values and share no memory with an input or another output.

The errors are those of Core.ASINOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ASIOpen

func (c *Core) ASIOpen(inOpen, inHigh, inLow, inClose []float64, optInLimitMove float64) (*ASIStream, float64, error)

ASIOpen opens a live ASIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ASI writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.ASI.

The error is InsufficientHistory for a history of at most Core.ASILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ASIOpenAndFill

func (c *Core) ASIOpenAndFill(inOpen, inHigh, inLow, inClose []float64, optInLimitMove float64, outReal []float64) (*ASIStream, OutRange, error)

ASIOpenAndFill opens a stream as Core.ASIOpen does and also writes the outputs over the whole history, as Core.ASI writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.ASILookback values and share no memory with an input or another output.

The errors are those of Core.ASIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ATAN

func (c *Core) ATAN(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

ATAN computes the Vector Trigonometric ATan over bars startIdx through endIdx.

Element-wise arctangent of the input series.

Formula and more info at https://ta-lib.org/functions/atan.

Inputs, each at least endIdx+1 long:

  • inReal: Input values.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Arc tangent of each input, in radians.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ATANLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = -5 + 10*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ATAN(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [-1.3734, ..., 1.3734]

func (*Core) ATANDisplayShift

func (c *Core) ATANDisplayShift(outputIdx int) (int, error)

ATANDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ATAN. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.ATAN, from 0, and returns BadParam for an index that names no output.

func (*Core) ATANLookback

func (c *Core) ATANLookback() (int, error)

ATANLookback returns how many leading bars Core.ATAN consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) ATANOpen

func (c *Core) ATANOpen(inReal []float64) (*ATANStream, float64, error)

ATANOpen opens a live ATANStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ATAN writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.ATANLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) ATANOpenAndFill

func (c *Core) ATANOpenAndFill(inReal, outReal []float64) (*ATANStream, OutRange, error)

ATANOpenAndFill opens a stream as Core.ATANOpen does and also writes the outputs over the whole history, as Core.ATAN writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.ATANLookback values and share no memory with an input or another output.

The errors are those of Core.ATANOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ATR

func (c *Core) ATR(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

ATR computes the Average True Range over bars startIdx through endIdx.

Wilder-smoothed average of the True Range over a period, measuring price volatility regardless of direction. Higher ATR means greater volatility; no directional bias.

Formula and more info at https://ta-lib.org/functions/atr.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Smoothing period. Default 14; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Average True Range value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ATRLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdATR (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ATR(0, len(high)-1, high, low, close, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [5.5214, ..., 5.6830]

func (*Core) ATRDisplayShift

func (c *Core) ATRDisplayShift(optInTimePeriod, outputIdx int) (int, error)

ATRDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ATR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ATR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ATRLookback rejects or an index that names no output.

func (*Core) ATRLookback

func (c *Core) ATRLookback(optInTimePeriod int) (int, error)

ATRLookback returns how many leading bars Core.ATR consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdATR (see Core.SetUnstablePeriod).

It takes the parameters of Core.ATR and returns BadParam for one out of range.

func (*Core) ATROpen

func (c *Core) ATROpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*ATRStream, float64, error)

ATROpen opens a live ATRStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ATR writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.ATR.

The error is InsufficientHistory for a history of at most Core.ATRLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ATROpenAndFill

func (c *Core) ATROpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (*ATRStream, OutRange, error)

ATROpenAndFill opens a stream as Core.ATROpen does and also writes the outputs over the whole history, as Core.ATR writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.ATRLookback values and share no memory with an input or another output.

The errors are those of Core.ATROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) AVGDEV

func (c *Core) AVGDEV(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

AVGDEV computes the Average Deviation over bars startIdx through endIdx.

Rolling average absolute deviation of a series from its own simple moving average over the last N periods. Measures dispersion around the window mean. Higher values indicate greater spread.

Formula and more info at https://ta-lib.org/functions/avgdev.

Inputs, each at least endIdx+1 long:

  • inReal: source series.

Parameters:

  • optInTimePeriod: Window length. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: mean absolute deviation over the window.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.AVGDEVLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.AVGDEV(0, len(series)-1, series, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [4.7429, ..., 4.5679]

func (*Core) AVGDEVDisplayShift

func (c *Core) AVGDEVDisplayShift(optInTimePeriod, outputIdx int) (int, error)

AVGDEVDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.AVGDEV. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.AVGDEV followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.AVGDEVLookback rejects or an index that names no output.

func (*Core) AVGDEVLookback

func (c *Core) AVGDEVLookback(optInTimePeriod int) (int, error)

AVGDEVLookback returns how many leading bars Core.AVGDEV consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.AVGDEV and returns BadParam for one out of range.

func (*Core) AVGDEVOpen

func (c *Core) AVGDEVOpen(inReal []float64, optInTimePeriod int) (*AVGDEVStream, float64, error)

AVGDEVOpen opens a live AVGDEVStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.AVGDEV writes there.

inReal is the history; the parameters are those of Core.AVGDEV.

The error is InsufficientHistory for a history of at most Core.AVGDEVLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) AVGDEVOpenAndFill

func (c *Core) AVGDEVOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*AVGDEVStream, OutRange, error)

AVGDEVOpenAndFill opens a stream as Core.AVGDEVOpen does and also writes the outputs over the whole history, as Core.AVGDEV writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.AVGDEVLookback values and share no memory with an input or another output.

The errors are those of Core.AVGDEVOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) AVGPRICE

func (c *Core) AVGPRICE(startIdx, endIdx int, inOpen, inHigh, inLow, inClose, outReal []float64) (OutRange, error)

AVGPRICE computes the Average Price over bars startIdx through endIdx.

Average Price: the arithmetic mean of each bar's open, high, low, and close. A price-transform overlap condensing OHLC into a single representative price.

Formula and more info at https://ta-lib.org/functions/avgprice.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Per-bar average of the four OHLC prices.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.AVGPRICELookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.AVGPRICE(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [109.9125, ..., 94.6875]

func (*Core) AVGPRICEDisplayShift

func (c *Core) AVGPRICEDisplayShift(outputIdx int) (int, error)

AVGPRICEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.AVGPRICE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.AVGPRICE, from 0, and returns BadParam for an index that names no output.

func (*Core) AVGPRICELookback

func (c *Core) AVGPRICELookback() (int, error)

AVGPRICELookback returns how many leading bars Core.AVGPRICE consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) AVGPRICEOpen

func (c *Core) AVGPRICEOpen(inOpen, inHigh, inLow, inClose []float64) (*AVGPRICEStream, float64, error)

AVGPRICEOpen opens a live AVGPRICEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.AVGPRICE writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.AVGPRICELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) AVGPRICEOpenAndFill

func (c *Core) AVGPRICEOpenAndFill(inOpen, inHigh, inLow, inClose, outReal []float64) (*AVGPRICEStream, OutRange, error)

AVGPRICEOpenAndFill opens a stream as Core.AVGPRICEOpen does and also writes the outputs over the whole history, as Core.AVGPRICE writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.AVGPRICELookback values and share no memory with an input or another output.

The errors are those of Core.AVGPRICEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) BBANDS

func (c *Core) BBANDS(startIdx, endIdx int, inReal []float64, optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType, outRealUpperBand, outRealMiddleBand, outRealLowerBand []float64) (OutRange, error)

BBANDS computes the Bollinger Bands over bars startIdx through endIdx.

Bollinger Bands: a moving-average middle band with upper and lower bands offset by a multiple of the standard deviation. Used to gauge relative price volatility.

Formula and more info at https://ta-lib.org/functions/bbands.

Inputs, each at least endIdx+1 long:

  • inReal: Input data series.

Parameters:

  • optInTimePeriod: Periods for the MA and standard deviation. Default 20; range 2 to 10000; IntegerDefault selects the default.
  • optInNbDevUp: Standard-deviation multiplier for the upper band. Default 2; RealDefault selects the default.
  • optInNbDevDn: Standard-deviation multiplier for the lower band. Default 2; RealDefault selects the default.
  • optInMAType: Moving-average type for the middle band. Default MATypeSMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outRealUpperBand: Middle band plus nbDevUp standard deviations.
  • outRealMiddleBand: The moving average.
  • outRealLowerBand: Middle band minus nbDevDn standard deviations.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.BBANDSLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	upperBand := make([]float64, 252)
	middleBand := make([]float64, 252)
	lowerBand := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.BBANDS(0, len(series)-1, series, 20, 2, 2, talib.MATypeSMA,
		upperBand, middleBand, lowerBand)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("upperBand = [%.4f, ..., %.4f]\n", upperBand[0], upperBand[r.NBElement-1])
	fmt.Printf("middleBand = [%.4f, ..., %.4f]\n", middleBand[0], middleBand[r.NBElement-1])
	fmt.Printf("lowerBand = [%.4f, ..., %.4f]\n", lowerBand[0], lowerBand[r.NBElement-1])
}
Output:
233 values from bar 19:
upperBand = [109.6414, ..., 110.6508]
middleBand = [97.1750, ..., 101.5750]
lowerBand = [84.7086, ..., 92.4992]

func (*Core) BBANDSDisplayShift

func (c *Core) BBANDSDisplayShift(optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType, outputIdx int) (int, error)

BBANDSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.BBANDS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.BBANDS followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.BBANDSLookback rejects or an index that names no output.

func (*Core) BBANDSLookback

func (c *Core) BBANDSLookback(optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType) (int, error)

BBANDSLookback returns how many leading bars Core.BBANDS consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.BBANDS and returns BadParam for one out of range.

func (*Core) BBANDSOpen

func (c *Core) BBANDSOpen(inReal []float64, optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType) (*BBANDSStream, float64, float64, float64, error)

BBANDSOpen opens a live BBANDSStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outRealUpperBand, outRealMiddleBand and outRealLowerBand), the values Core.BBANDS writes there.

inReal is the history; the parameters are those of Core.BBANDS.

The error is InsufficientHistory for a history of at most Core.BBANDSLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) BBANDSOpenAndFill

func (c *Core) BBANDSOpenAndFill(inReal []float64, optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType, outRealUpperBand, outRealMiddleBand, outRealLowerBand []float64) (*BBANDSStream, OutRange, error)

BBANDSOpenAndFill opens a stream as Core.BBANDSOpen does and also writes the outputs over the whole history, as Core.BBANDS writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.BBANDSLookback values and share no memory with an input or another output.

The errors are those of Core.BBANDSOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) BBW

func (c *Core) BBW(startIdx, endIdx int, inReal []float64, optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType, outReal []float64) (OutRange, error)

BBW computes the Bollinger BandWidth over bars startIdx through endIdx.

Bollinger BandWidth: the distance between the upper and lower Bollinger Bands as a percentage of the middle band. Low values mark contracting volatility, the setup John Bollinger calls the Squeeze; high values mark expanding volatility.

Formula and more info at https://ta-lib.org/functions/bbw.

Inputs, each at least endIdx+1 long:

  • inReal: Input data series.

Parameters:

  • optInTimePeriod: Periods for the MA and standard deviation. Default 20; range 2 to 10000; IntegerDefault selects the default.
  • optInNbDevUp: Standard-deviation multiplier for the upper band. Default 2; RealDefault selects the default.
  • optInNbDevDn: Standard-deviation multiplier for the lower band. Default 2; RealDefault selects the default.
  • optInMAType: Moving-average type for the middle band. Default MATypeSMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Width of the bands as a percentage of the middle band.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.BBWLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.BBW(0, len(series)-1, series, 20, 2, 2, talib.MATypeSMA, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
233 values from bar 19: [25.6576, ..., 17.8702]

func (*Core) BBWDisplayShift

func (c *Core) BBWDisplayShift(optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType, outputIdx int) (int, error)

BBWDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.BBW. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.BBW followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.BBWLookback rejects or an index that names no output.

func (*Core) BBWLookback

func (c *Core) BBWLookback(optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType) (int, error)

BBWLookback returns how many leading bars Core.BBW consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.BBW and returns BadParam for one out of range.

func (*Core) BBWOpen

func (c *Core) BBWOpen(inReal []float64, optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType) (*BBWStream, float64, error)

BBWOpen opens a live BBWStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.BBW writes there.

inReal is the history; the parameters are those of Core.BBW.

The error is InsufficientHistory for a history of at most Core.BBWLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) BBWOpenAndFill

func (c *Core) BBWOpenAndFill(inReal []float64, optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType, outReal []float64) (*BBWStream, OutRange, error)

BBWOpenAndFill opens a stream as Core.BBWOpen does and also writes the outputs over the whole history, as Core.BBW writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.BBWLookback values and share no memory with an input or another output.

The errors are those of Core.BBWOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) BETA

func (c *Core) BETA(startIdx, endIdx int, inReal0, inReal1 []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

BETA computes the Beta over bars startIdx through endIdx.

Beta: the slope of a least-squares linear regression of one series' percentage returns (y, from inReal1) against another's (x, from inReal0) over a rolling window. Measures how much a security moves relative to a market index. Beta = 1 moves with the index; < 1 less volatile, > 1 more volatile.

Formula and more info at https://ta-lib.org/functions/beta.

Inputs, each at least endIdx+1 long:

  • inReal0: Series whose returns are the regression x (market/index)
  • inReal1: Series whose returns are the regression y (security)

Parameters:

  • optInTimePeriod: Rolling window length (number of returns) for the regression sums. Default 5; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Beta: regression slope of inReal1-returns on inReal0-returns.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.BETALookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series0 := make([]float64, 252) // your data, oldest first
	for i := range series0 {
		series0[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	series1 := make([]float64, 252) // your data, oldest first
	for i := range series1 {
		series1[i] = 90 + float64(((i+7)%40-20)*((i+7)%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.BETA(0, len(series0)-1, series0, series1, 5, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
247 values from bar 5: [1.3807, ..., 1.2096]

func (*Core) BETADisplayShift

func (c *Core) BETADisplayShift(optInTimePeriod, outputIdx int) (int, error)

BETADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.BETA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.BETA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.BETALookback rejects or an index that names no output.

func (*Core) BETALookback

func (c *Core) BETALookback(optInTimePeriod int) (int, error)

BETALookback returns how many leading bars Core.BETA consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.BETA and returns BadParam for one out of range.

func (*Core) BETAOpen

func (c *Core) BETAOpen(inReal0, inReal1 []float64, optInTimePeriod int) (*BETAStream, float64, error)

BETAOpen opens a live BETAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.BETA writes there.

inReal0 and inReal1 are the histories, of one length; the parameters are those of Core.BETA.

The error is InsufficientHistory for a history of at most Core.BETALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) BETAOpenAndFill

func (c *Core) BETAOpenAndFill(inReal0, inReal1 []float64, optInTimePeriod int, outReal []float64) (*BETAStream, OutRange, error)

BETAOpenAndFill opens a stream as Core.BETAOpen does and also writes the outputs over the whole history, as Core.BETA writes them for bars 0 through len(inReal0)-1, returning that range.

Each output must hold len(inReal0) minus Core.BETALookback values and share no memory with an input or another output.

The errors are those of Core.BETAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) BOP

func (c *Core) BOP(startIdx, endIdx int, inOpen, inHigh, inLow, inClose, outReal []float64) (OutRange, error)

BOP computes the Balance Of Power over bars startIdx through endIdx.

Balance Of Power compares where the close sits relative to the open, normalized by the bar's high-low range. A per-bar oscillator with no smoothing. Positive: close above open (buyers dominated); negative: sellers dominated.

Formula and more info at https://ta-lib.org/functions/bop.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Balance of Power value per bar.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.BOPLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.BOP(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [0.4671, ..., 0.1477]

func (*Core) BOPDisplayShift

func (c *Core) BOPDisplayShift(outputIdx int) (int, error)

BOPDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.BOP. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.BOP, from 0, and returns BadParam for an index that names no output.

func (*Core) BOPLookback

func (c *Core) BOPLookback() (int, error)

BOPLookback returns how many leading bars Core.BOP consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) BOPOpen

func (c *Core) BOPOpen(inOpen, inHigh, inLow, inClose []float64) (*BOPStream, float64, error)

BOPOpen opens a live BOPStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.BOP writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.BOPLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) BOPOpenAndFill

func (c *Core) BOPOpenAndFill(inOpen, inHigh, inLow, inClose, outReal []float64) (*BOPStream, OutRange, error)

BOPOpenAndFill opens a stream as Core.BOPOpen does and also writes the outputs over the whole history, as Core.BOP writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.BOPLookback values and share no memory with an input or another output.

The errors are those of Core.BOPOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CCI

func (c *Core) CCI(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

CCI computes the Commodity Channel Index over bars startIdx through endIdx.

Commodity Channel Index: measures the current typical price relative to its simple moving average, scaled by mean absolute deviation. Momentum oscillator flagging overbought/oversold extremes. CCI > +100 overbought; CCI < -100 oversold.

Formula and more info at https://ta-lib.org/functions/cci.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Number of bars in the averaging/deviation window. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: CCI value per bar.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CCILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CCI(0, len(high)-1, high, low, close, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [-112.8095, ..., -104.0762]

func (*Core) CCIDisplayShift

func (c *Core) CCIDisplayShift(optInTimePeriod, outputIdx int) (int, error)

CCIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CCI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CCI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CCILookback rejects or an index that names no output.

func (*Core) CCILookback

func (c *Core) CCILookback(optInTimePeriod int) (int, error)

CCILookback returns how many leading bars Core.CCI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CCI and returns BadParam for one out of range.

func (*Core) CCIOpen

func (c *Core) CCIOpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*CCIStream, float64, error)

CCIOpen opens a live CCIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CCI writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.CCI.

The error is InsufficientHistory for a history of at most Core.CCILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CCIOpenAndFill

func (c *Core) CCIOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (*CCIStream, OutRange, error)

CCIOpenAndFill opens a stream as Core.CCIOpen does and also writes the outputs over the whole history, as Core.CCI writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.CCILookback values and share no memory with an input or another output.

The errors are those of Core.CCIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CDL2CROWS

func (c *Core) CDL2CROWS(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDL2CROWS recognizes the Two Crows pattern over bars startIdx through endIdx.

Three-candle bearish reversal pattern: a long white candle, then a black candle gapping up, then a black candle that opens inside the second body and closes down inside the first white body. A hit (-100) signals a bearish reversal; significant in an uptrend, which this function does not verify.

Formula and more info at https://ta-lib.org/functions/cdl2crows.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 on a detected pattern (always bearish), 0 otherwise. Never emits +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDL2CROWSLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDL2CROWS(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDL2CROWSDisplayShift

func (c *Core) CDL2CROWSDisplayShift(outputIdx int) (int, error)

CDL2CROWSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDL2CROWS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDL2CROWS, from 0, and returns BadParam for an index that names no output.

func (*Core) CDL2CROWSLookback

func (c *Core) CDL2CROWSLookback() (int, error)

CDL2CROWSLookback returns how many leading bars Core.CDL2CROWS consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDL2CROWSOpen

func (c *Core) CDL2CROWSOpen(inOpen, inHigh, inLow, inClose []float64) (*CDL2CROWSStream, int32, error)

CDL2CROWSOpen opens a live CDL2CROWSStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDL2CROWS writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDL2CROWSLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDL2CROWSOpenAndFill

func (c *Core) CDL2CROWSOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDL2CROWSStream, OutRange, error)

CDL2CROWSOpenAndFill opens a stream as Core.CDL2CROWSOpen does and also writes the outputs over the whole history, as Core.CDL2CROWS writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDL2CROWSLookback values and share no memory with an input or another output.

The errors are those of Core.CDL2CROWSOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDL3BLACKCROWS

func (c *Core) CDL3BLACKCROWS(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDL3BLACKCROWS recognizes the Three Black Crows pattern over bars startIdx through endIdx.

A four-bar pattern: a white candle followed by three consecutive black (down) candles with successively lower closes, each opening inside the prior black's real body. It is a bearish reversal signal. A hit (-100) signals a bearish reversal.

Formula and more info at https://ta-lib.org/functions/cdl3blackcrows.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 when the bearish pattern is detected, 0 otherwise. Never emits +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDL3BLACKCROWSLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDL3BLACKCROWS(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [0, ..., 0]

func (*Core) CDL3BLACKCROWSDisplayShift

func (c *Core) CDL3BLACKCROWSDisplayShift(outputIdx int) (int, error)

CDL3BLACKCROWSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDL3BLACKCROWS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDL3BLACKCROWS, from 0, and returns BadParam for an index that names no output.

func (*Core) CDL3BLACKCROWSLookback

func (c *Core) CDL3BLACKCROWSLookback() (int, error)

CDL3BLACKCROWSLookback returns how many leading bars Core.CDL3BLACKCROWS consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDL3BLACKCROWSOpen

func (c *Core) CDL3BLACKCROWSOpen(inOpen, inHigh, inLow, inClose []float64) (*CDL3BLACKCROWSStream, int32, error)

CDL3BLACKCROWSOpen opens a live CDL3BLACKCROWSStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDL3BLACKCROWS writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDL3BLACKCROWSLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDL3BLACKCROWSOpenAndFill

func (c *Core) CDL3BLACKCROWSOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDL3BLACKCROWSStream, OutRange, error)

CDL3BLACKCROWSOpenAndFill opens a stream as Core.CDL3BLACKCROWSOpen does and also writes the outputs over the whole history, as Core.CDL3BLACKCROWS writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDL3BLACKCROWSLookback values and share no memory with an input or another output.

The errors are those of Core.CDL3BLACKCROWSOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDL3INSIDE

func (c *Core) CDL3INSIDE(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDL3INSIDE recognizes the Three Inside Up/Down pattern over bars startIdx through endIdx.

A three-candle reversal pattern: a long real body, then a short real body totally engulfed by it (a harami), then a third candle of opposite color to the first that closes past the first candle's open. Signals a bullish reversal (three inside up, significant in a downtrend) or a bearish reversal (three inside down, significant in an uptrend).

Formula and more info at https://ta-lib.org/functions/cdl3inside.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 for three inside up (bullish reversal, first candle black), -100 for three inside down (bearish reversal, first candle white), 0 when no pattern. Computed as -candlecolor(1st)*100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDL3INSIDELookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDL3INSIDE(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDL3INSIDEDisplayShift

func (c *Core) CDL3INSIDEDisplayShift(outputIdx int) (int, error)

CDL3INSIDEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDL3INSIDE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDL3INSIDE, from 0, and returns BadParam for an index that names no output.

func (*Core) CDL3INSIDELookback

func (c *Core) CDL3INSIDELookback() (int, error)

CDL3INSIDELookback returns how many leading bars Core.CDL3INSIDE consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDL3INSIDEOpen

func (c *Core) CDL3INSIDEOpen(inOpen, inHigh, inLow, inClose []float64) (*CDL3INSIDEStream, int32, error)

CDL3INSIDEOpen opens a live CDL3INSIDEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDL3INSIDE writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDL3INSIDELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDL3INSIDEOpenAndFill

func (c *Core) CDL3INSIDEOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDL3INSIDEStream, OutRange, error)

CDL3INSIDEOpenAndFill opens a stream as Core.CDL3INSIDEOpen does and also writes the outputs over the whole history, as Core.CDL3INSIDE writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDL3INSIDELookback values and share no memory with an input or another output.

The errors are those of Core.CDL3INSIDEOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDL3LINESTRIKE

func (c *Core) CDL3LINESTRIKE(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDL3LINESTRIKE recognizes the Three-Line Strike pattern over bars startIdx through endIdx.

A four-candle pattern: three same-color candles with consecutively higher (or lower) closes, each opening within or near the prior real body, then a fourth opposite-color candle that opens beyond the third close and closes past the first candle's open. TA-Lib emits a signed continuation-style signal keyed to the color of the first three candles, traditionally read as significant only inside a trend matching those three candles.

Formula and more info at https://ta-lib.org/functions/cdl3linestrike.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 for a white (rising) three-line strike, -100 for a black (falling) three-line strike, 0 otherwise. Sign is the color of the first three candles: candlecolor(i-1)*100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDL3LINESTRIKELookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDL3LINESTRIKE(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
244 values from bar 8: [0, ..., 0]

func (*Core) CDL3LINESTRIKEDisplayShift

func (c *Core) CDL3LINESTRIKEDisplayShift(outputIdx int) (int, error)

CDL3LINESTRIKEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDL3LINESTRIKE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDL3LINESTRIKE, from 0, and returns BadParam for an index that names no output.

func (*Core) CDL3LINESTRIKELookback

func (c *Core) CDL3LINESTRIKELookback() (int, error)

CDL3LINESTRIKELookback returns how many leading bars Core.CDL3LINESTRIKE consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDL3LINESTRIKEOpen

func (c *Core) CDL3LINESTRIKEOpen(inOpen, inHigh, inLow, inClose []float64) (*CDL3LINESTRIKEStream, int32, error)

CDL3LINESTRIKEOpen opens a live CDL3LINESTRIKEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDL3LINESTRIKE writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDL3LINESTRIKELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDL3LINESTRIKEOpenAndFill

func (c *Core) CDL3LINESTRIKEOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDL3LINESTRIKEStream, OutRange, error)

CDL3LINESTRIKEOpenAndFill opens a stream as Core.CDL3LINESTRIKEOpen does and also writes the outputs over the whole history, as Core.CDL3LINESTRIKE writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDL3LINESTRIKELookback values and share no memory with an input or another output.

The errors are those of Core.CDL3LINESTRIKEOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDL3OUTSIDE

func (c *Core) CDL3OUTSIDE(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDL3OUTSIDE recognizes the Three Outside Up/Down pattern over bars startIdx through endIdx.

A three-candle pattern: an engulfing pair (candle 2's body fully engulfs candle 1's body) followed by a third candle that confirms in the engulfing direction. Signals a bullish reversal (Three Outside Up) or bearish reversal (Three Outside Down).

Formula and more info at https://ta-lib.org/functions/cdl3outside.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 for Three Outside Up (bullish), -100 for Three Outside Down (bearish), 0 when no pattern. Emits both signs; value is candle i-1's color * 100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDL3OUTSIDELookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDL3OUTSIDE(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
249 values from bar 3: [0, ..., 0]

func (*Core) CDL3OUTSIDEDisplayShift

func (c *Core) CDL3OUTSIDEDisplayShift(outputIdx int) (int, error)

CDL3OUTSIDEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDL3OUTSIDE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDL3OUTSIDE, from 0, and returns BadParam for an index that names no output.

func (*Core) CDL3OUTSIDELookback

func (c *Core) CDL3OUTSIDELookback() (int, error)

CDL3OUTSIDELookback returns how many leading bars Core.CDL3OUTSIDE consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDL3OUTSIDEOpen

func (c *Core) CDL3OUTSIDEOpen(inOpen, inHigh, inLow, inClose []float64) (*CDL3OUTSIDEStream, int32, error)

CDL3OUTSIDEOpen opens a live CDL3OUTSIDEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDL3OUTSIDE writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDL3OUTSIDELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDL3OUTSIDEOpenAndFill

func (c *Core) CDL3OUTSIDEOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDL3OUTSIDEStream, OutRange, error)

CDL3OUTSIDEOpenAndFill opens a stream as Core.CDL3OUTSIDEOpen does and also writes the outputs over the whole history, as Core.CDL3OUTSIDE writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDL3OUTSIDELookback values and share no memory with an input or another output.

The errors are those of Core.CDL3OUTSIDEOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDL3STARSINSOUTH

func (c *Core) CDL3STARSINSOUTH(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDL3STARSINSOUTH recognizes the Three Stars In The South pattern over bars startIdx through endIdx.

A three-candle bullish reversal pattern of three consecutive black candles that progressively shrink and stabilize: a long black candle with a long lower shadow, a smaller black candle probing lower, then a small black marubozu contained within the second candle's range. A hit signals a bullish reversal; it is meaningful in a downtrend, which the function does not verify.

Formula and more info at https://ta-lib.org/functions/cdl3starsinsouth.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 on the bar where the pattern completes (always bullish), 0 otherwise. Never emits -100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDL3STARSINSOUTHLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDL3STARSINSOUTH(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDL3STARSINSOUTHDisplayShift

func (c *Core) CDL3STARSINSOUTHDisplayShift(outputIdx int) (int, error)

CDL3STARSINSOUTHDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDL3STARSINSOUTH. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDL3STARSINSOUTH, from 0, and returns BadParam for an index that names no output.

func (*Core) CDL3STARSINSOUTHLookback

func (c *Core) CDL3STARSINSOUTHLookback() (int, error)

CDL3STARSINSOUTHLookback returns how many leading bars Core.CDL3STARSINSOUTH consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDL3STARSINSOUTHOpen

func (c *Core) CDL3STARSINSOUTHOpen(inOpen, inHigh, inLow, inClose []float64) (*CDL3STARSINSOUTHStream, int32, error)

CDL3STARSINSOUTHOpen opens a live CDL3STARSINSOUTHStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDL3STARSINSOUTH writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDL3STARSINSOUTHLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDL3STARSINSOUTHOpenAndFill

func (c *Core) CDL3STARSINSOUTHOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDL3STARSINSOUTHStream, OutRange, error)

CDL3STARSINSOUTHOpenAndFill opens a stream as Core.CDL3STARSINSOUTHOpen does and also writes the outputs over the whole history, as Core.CDL3STARSINSOUTH writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDL3STARSINSOUTHLookback values and share no memory with an input or another output.

The errors are those of Core.CDL3STARSINSOUTHOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDL3WHITESOLDIERS

func (c *Core) CDL3WHITESOLDIERS(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDL3WHITESOLDIERS recognizes the Three Advancing White Soldiers pattern over bars startIdx through endIdx.

A three-candle pattern of consecutive white candles with progressively higher closes, each opening within/near the prior body and each with a very short upper shadow. A hit is a bullish reversal signal, most meaningful in a downtrend, which the code does not verify.

Formula and more info at https://ta-lib.org/functions/cdl3whitesoldiers.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the pattern is detected, 0 otherwise; never negative (three white soldiers is always bullish)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDL3WHITESOLDIERSLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDL3WHITESOLDIERS(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDL3WHITESOLDIERSDisplayShift

func (c *Core) CDL3WHITESOLDIERSDisplayShift(outputIdx int) (int, error)

CDL3WHITESOLDIERSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDL3WHITESOLDIERS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDL3WHITESOLDIERS, from 0, and returns BadParam for an index that names no output.

func (*Core) CDL3WHITESOLDIERSLookback

func (c *Core) CDL3WHITESOLDIERSLookback() (int, error)

CDL3WHITESOLDIERSLookback returns how many leading bars Core.CDL3WHITESOLDIERS consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDL3WHITESOLDIERSOpen

func (c *Core) CDL3WHITESOLDIERSOpen(inOpen, inHigh, inLow, inClose []float64) (*CDL3WHITESOLDIERSStream, int32, error)

CDL3WHITESOLDIERSOpen opens a live CDL3WHITESOLDIERSStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDL3WHITESOLDIERS writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDL3WHITESOLDIERSLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDL3WHITESOLDIERSOpenAndFill

func (c *Core) CDL3WHITESOLDIERSOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDL3WHITESOLDIERSStream, OutRange, error)

CDL3WHITESOLDIERSOpenAndFill opens a stream as Core.CDL3WHITESOLDIERSOpen does and also writes the outputs over the whole history, as Core.CDL3WHITESOLDIERS writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDL3WHITESOLDIERSLookback values and share no memory with an input or another output.

The errors are those of Core.CDL3WHITESOLDIERSOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLABANDONEDBABY

func (c *Core) CDLABANDONEDBABY(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (OutRange, error)

CDLABANDONEDBABY recognizes the Abandoned Baby pattern over bars startIdx through endIdx.

A three-candle reversal pattern: a long body, then a gapped-away doji, then a body of opposite color that gaps back the other way and closes deep into the first body. Bullish (bottom) or bearish (top) reversal signal.

Formula and more info at https://ta-lib.org/functions/cdlabandonedbaby.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInPenetration: Fraction of the 1st candle's real body the 3rd close must penetrate. Default 0.3; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 at a bullish abandoned baby bottom (3rd candle white), -100 at a bearish abandoned baby top (3rd candle black), 0 otherwise; sign = color of the 3rd candle.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLABANDONEDBABYLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLABANDONEDBABY(0, len(open)-1, open, high, low, close, 0.3, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDLABANDONEDBABYDisplayShift

func (c *Core) CDLABANDONEDBABYDisplayShift(optInPenetration float64, outputIdx int) (int, error)

CDLABANDONEDBABYDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLABANDONEDBABY. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CDLABANDONEDBABY followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CDLABANDONEDBABYLookback rejects or an index that names no output.

func (*Core) CDLABANDONEDBABYLookback

func (c *Core) CDLABANDONEDBABYLookback(optInPenetration float64) (int, error)

CDLABANDONEDBABYLookback returns how many leading bars Core.CDLABANDONEDBABY consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CDLABANDONEDBABY and returns BadParam for one out of range.

func (*Core) CDLABANDONEDBABYOpen

func (c *Core) CDLABANDONEDBABYOpen(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64) (*CDLABANDONEDBABYStream, int32, error)

CDLABANDONEDBABYOpen opens a live CDLABANDONEDBABYStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLABANDONEDBABY writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.CDLABANDONEDBABY.

The error is InsufficientHistory for a history of at most Core.CDLABANDONEDBABYLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CDLABANDONEDBABYOpenAndFill

func (c *Core) CDLABANDONEDBABYOpenAndFill(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (*CDLABANDONEDBABYStream, OutRange, error)

CDLABANDONEDBABYOpenAndFill opens a stream as Core.CDLABANDONEDBABYOpen does and also writes the outputs over the whole history, as Core.CDLABANDONEDBABY writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLABANDONEDBABYLookback values and share no memory with an input or another output.

The errors are those of Core.CDLABANDONEDBABYOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLADVANCEBLOCK

func (c *Core) CDLADVANCEBLOCK(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLADVANCEBLOCK recognizes the Advance Block pattern over bars startIdx through endIdx.

Three-candle bearish reversal pattern: three white candles with consecutively higher closes whose advance weakens (progressively smaller bodies and/or lengthening upper shadows). Signals that an uptrend's advance is being blocked. A hit (-100) is bearish: the advance is stalling/blocked; meaningful mainly within an existing uptrend.

Formula and more info at https://ta-lib.org/functions/cdladvanceblock.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 on a detected pattern (always bearish), 0 otherwise; never emits +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLADVANCEBLOCKLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLADVANCEBLOCK(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDLADVANCEBLOCKDisplayShift

func (c *Core) CDLADVANCEBLOCKDisplayShift(outputIdx int) (int, error)

CDLADVANCEBLOCKDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLADVANCEBLOCK. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLADVANCEBLOCK, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLADVANCEBLOCKLookback

func (c *Core) CDLADVANCEBLOCKLookback() (int, error)

CDLADVANCEBLOCKLookback returns how many leading bars Core.CDLADVANCEBLOCK consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLADVANCEBLOCKOpen

func (c *Core) CDLADVANCEBLOCKOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLADVANCEBLOCKStream, int32, error)

CDLADVANCEBLOCKOpen opens a live CDLADVANCEBLOCKStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLADVANCEBLOCK writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLADVANCEBLOCKLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLADVANCEBLOCKOpenAndFill

func (c *Core) CDLADVANCEBLOCKOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLADVANCEBLOCKStream, OutRange, error)

CDLADVANCEBLOCKOpenAndFill opens a stream as Core.CDLADVANCEBLOCKOpen does and also writes the outputs over the whole history, as Core.CDLADVANCEBLOCK writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLADVANCEBLOCKLookback values and share no memory with an input or another output.

The errors are those of Core.CDLADVANCEBLOCKOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLBELTHOLD

func (c *Core) CDLBELTHOLD(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLBELTHOLD recognizes the Belt-hold pattern over bars startIdx through endIdx.

Single-candle pattern with a long real body that opens at (or near) its extreme. A bullish belt-hold is a long white candle with no/very short lower shadow; a bearish belt-hold is a long black candle with no/very short upper shadow. A white hit is bullish (opens at the low, closes strong); a black hit is bearish (opens at the high, closes weak).

Formula and more info at https://ta-lib.org/functions/cdlbelthold.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 for a bullish (white) belt-hold, -100 for a bearish (black) belt-hold, 0 otherwise.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLBELTHOLDLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLBELTHOLD(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [0, ..., 0]

func (*Core) CDLBELTHOLDDisplayShift

func (c *Core) CDLBELTHOLDDisplayShift(outputIdx int) (int, error)

CDLBELTHOLDDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLBELTHOLD. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLBELTHOLD, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLBELTHOLDLookback

func (c *Core) CDLBELTHOLDLookback() (int, error)

CDLBELTHOLDLookback returns how many leading bars Core.CDLBELTHOLD consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLBELTHOLDOpen

func (c *Core) CDLBELTHOLDOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLBELTHOLDStream, int32, error)

CDLBELTHOLDOpen opens a live CDLBELTHOLDStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLBELTHOLD writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLBELTHOLDLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLBELTHOLDOpenAndFill

func (c *Core) CDLBELTHOLDOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLBELTHOLDStream, OutRange, error)

CDLBELTHOLDOpenAndFill opens a stream as Core.CDLBELTHOLDOpen does and also writes the outputs over the whole history, as Core.CDLBELTHOLD writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLBELTHOLDLookback values and share no memory with an input or another output.

The errors are those of Core.CDLBELTHOLDOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLBREAKAWAY

func (c *Core) CDLBREAKAWAY(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLBREAKAWAY recognizes the Breakaway pattern over bars startIdx through endIdx.

A five-candle reversal pattern: a long first candle, a same-colored second candle that gaps away from it by its real body, two more candles extending the move, and an opposite-colored fifth candle that closes back inside the gap. Emits a bullish signal (bottom reversal) or bearish signal (top reversal).

Formula and more info at https://ta-lib.org/functions/cdlbreakaway.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the fifth candle is white (bullish breakaway), -100 when it is black (bearish breakaway), 0 otherwise.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLBREAKAWAYLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLBREAKAWAY(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [0, ..., 0]

func (*Core) CDLBREAKAWAYDisplayShift

func (c *Core) CDLBREAKAWAYDisplayShift(outputIdx int) (int, error)

CDLBREAKAWAYDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLBREAKAWAY. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLBREAKAWAY, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLBREAKAWAYLookback

func (c *Core) CDLBREAKAWAYLookback() (int, error)

CDLBREAKAWAYLookback returns how many leading bars Core.CDLBREAKAWAY consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLBREAKAWAYOpen

func (c *Core) CDLBREAKAWAYOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLBREAKAWAYStream, int32, error)

CDLBREAKAWAYOpen opens a live CDLBREAKAWAYStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLBREAKAWAY writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLBREAKAWAYLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLBREAKAWAYOpenAndFill

func (c *Core) CDLBREAKAWAYOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLBREAKAWAYStream, OutRange, error)

CDLBREAKAWAYOpenAndFill opens a stream as Core.CDLBREAKAWAYOpen does and also writes the outputs over the whole history, as Core.CDLBREAKAWAY writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLBREAKAWAYLookback values and share no memory with an input or another output.

The errors are those of Core.CDLBREAKAWAYOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLCLOSINGMARUBOZU

func (c *Core) CDLCLOSINGMARUBOZU(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLCLOSINGMARUBOZU recognizes the Closing Marubozu pattern over bars startIdx through endIdx.

Single-candle pattern: a long real body whose closing end has no or very short shadow, so the close sits at the candle's extreme. A strong directional bar, not a defined reversal/continuation signal — white is bullish, black is bearish.

Formula and more info at https://ta-lib.org/functions/cdlclosingmarubozu.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 for a white (bullish) closing marubozu, -100 for a black (bearish) one, 0 otherwise.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLCLOSINGMARUBOZULookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLCLOSINGMARUBOZU(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [0, ..., 0]

func (*Core) CDLCLOSINGMARUBOZUDisplayShift

func (c *Core) CDLCLOSINGMARUBOZUDisplayShift(outputIdx int) (int, error)

CDLCLOSINGMARUBOZUDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLCLOSINGMARUBOZU. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLCLOSINGMARUBOZU, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLCLOSINGMARUBOZULookback

func (c *Core) CDLCLOSINGMARUBOZULookback() (int, error)

CDLCLOSINGMARUBOZULookback returns how many leading bars Core.CDLCLOSINGMARUBOZU consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLCLOSINGMARUBOZUOpen

func (c *Core) CDLCLOSINGMARUBOZUOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLCLOSINGMARUBOZUStream, int32, error)

CDLCLOSINGMARUBOZUOpen opens a live CDLCLOSINGMARUBOZUStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLCLOSINGMARUBOZU writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLCLOSINGMARUBOZULookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLCLOSINGMARUBOZUOpenAndFill

func (c *Core) CDLCLOSINGMARUBOZUOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLCLOSINGMARUBOZUStream, OutRange, error)

CDLCLOSINGMARUBOZUOpenAndFill opens a stream as Core.CDLCLOSINGMARUBOZUOpen does and also writes the outputs over the whole history, as Core.CDLCLOSINGMARUBOZU writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLCLOSINGMARUBOZULookback values and share no memory with an input or another output.

The errors are those of Core.CDLCLOSINGMARUBOZUOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLCONCEALBABYSWALL

func (c *Core) CDLCONCEALBABYSWALL(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLCONCEALBABYSWALL recognizes the Concealing Baby Swallow pattern over bars startIdx through endIdx.

A four-candle pattern: two black marubozus, then a black candle that gaps down but pokes its upper shadow into the prior body, then a larger black candle fully engulfing the third. A hit signals a bullish reversal.

Formula and more info at https://ta-lib.org/functions/cdlconcealbabyswall.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 on a match, 0 otherwise; never emits -100 (pattern is always bullish)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLCONCEALBABYSWALLLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLCONCEALBABYSWALL(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [0, ..., 0]

func (*Core) CDLCONCEALBABYSWALLDisplayShift

func (c *Core) CDLCONCEALBABYSWALLDisplayShift(outputIdx int) (int, error)

CDLCONCEALBABYSWALLDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLCONCEALBABYSWALL. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLCONCEALBABYSWALL, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLCONCEALBABYSWALLLookback

func (c *Core) CDLCONCEALBABYSWALLLookback() (int, error)

CDLCONCEALBABYSWALLLookback returns how many leading bars Core.CDLCONCEALBABYSWALL consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLCONCEALBABYSWALLOpen

func (c *Core) CDLCONCEALBABYSWALLOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLCONCEALBABYSWALLStream, int32, error)

CDLCONCEALBABYSWALLOpen opens a live CDLCONCEALBABYSWALLStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLCONCEALBABYSWALL writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLCONCEALBABYSWALLLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLCONCEALBABYSWALLOpenAndFill

func (c *Core) CDLCONCEALBABYSWALLOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLCONCEALBABYSWALLStream, OutRange, error)

CDLCONCEALBABYSWALLOpenAndFill opens a stream as Core.CDLCONCEALBABYSWALLOpen does and also writes the outputs over the whole history, as Core.CDLCONCEALBABYSWALL writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLCONCEALBABYSWALLLookback values and share no memory with an input or another output.

The errors are those of Core.CDLCONCEALBABYSWALLOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLCOUNTERATTACK

func (c *Core) CDLCOUNTERATTACK(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLCOUNTERATTACK recognizes the Counterattack pattern over bars startIdx through endIdx.

A two-candle pattern of two long, opposite-colored real bodies whose closing prices are (nearly) equal. Emits a bullish signal when the second candle is white and a bearish signal when it is black (a reversal signal, though its trend context is not checked).

Formula and more info at https://ta-lib.org/functions/cdlcounterattack.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the second candle is white (bullish), -100 when it is black (bearish), 0 when no pattern.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLCOUNTERATTACKLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLCOUNTERATTACK(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLCOUNTERATTACKDisplayShift

func (c *Core) CDLCOUNTERATTACKDisplayShift(outputIdx int) (int, error)

CDLCOUNTERATTACKDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLCOUNTERATTACK. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLCOUNTERATTACK, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLCOUNTERATTACKLookback

func (c *Core) CDLCOUNTERATTACKLookback() (int, error)

CDLCOUNTERATTACKLookback returns how many leading bars Core.CDLCOUNTERATTACK consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLCOUNTERATTACKOpen

func (c *Core) CDLCOUNTERATTACKOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLCOUNTERATTACKStream, int32, error)

CDLCOUNTERATTACKOpen opens a live CDLCOUNTERATTACKStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLCOUNTERATTACK writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLCOUNTERATTACKLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLCOUNTERATTACKOpenAndFill

func (c *Core) CDLCOUNTERATTACKOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLCOUNTERATTACKStream, OutRange, error)

CDLCOUNTERATTACKOpenAndFill opens a stream as Core.CDLCOUNTERATTACKOpen does and also writes the outputs over the whole history, as Core.CDLCOUNTERATTACK writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLCOUNTERATTACKLookback values and share no memory with an input or another output.

The errors are those of Core.CDLCOUNTERATTACKOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLDARKCLOUDCOVER

func (c *Core) CDLDARKCLOUDCOVER(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (OutRange, error)

CDLDARKCLOUDCOVER recognizes the Dark Cloud Cover pattern over bars startIdx through endIdx.

A two-candle bearish reversal pattern: a long white candle followed by a black candle that opens above the prior high and closes deep into the prior white body past a penetration threshold. Signals a potential top. A hit (-100) is a bearish reversal signal, most meaningful after an uptrend.

Formula and more info at https://ta-lib.org/functions/cdldarkcloudcover.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInPenetration: Fraction of candle 1's real body that candle 2's close must penetrate below close[i-1]; larger values require deeper penetration. Default 0.5; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 when the pattern is detected (always bearish), 0 otherwise; never emits +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLDARKCLOUDCOVERLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLDARKCLOUDCOVER(0, len(open)-1, open, high, low, close, 0.5, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLDARKCLOUDCOVERDisplayShift

func (c *Core) CDLDARKCLOUDCOVERDisplayShift(optInPenetration float64, outputIdx int) (int, error)

CDLDARKCLOUDCOVERDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLDARKCLOUDCOVER. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CDLDARKCLOUDCOVER followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CDLDARKCLOUDCOVERLookback rejects or an index that names no output.

func (*Core) CDLDARKCLOUDCOVERLookback

func (c *Core) CDLDARKCLOUDCOVERLookback(optInPenetration float64) (int, error)

CDLDARKCLOUDCOVERLookback returns how many leading bars Core.CDLDARKCLOUDCOVER consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CDLDARKCLOUDCOVER and returns BadParam for one out of range.

func (*Core) CDLDARKCLOUDCOVEROpen

func (c *Core) CDLDARKCLOUDCOVEROpen(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64) (*CDLDARKCLOUDCOVERStream, int32, error)

CDLDARKCLOUDCOVEROpen opens a live CDLDARKCLOUDCOVERStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLDARKCLOUDCOVER writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.CDLDARKCLOUDCOVER.

The error is InsufficientHistory for a history of at most Core.CDLDARKCLOUDCOVERLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CDLDARKCLOUDCOVEROpenAndFill

func (c *Core) CDLDARKCLOUDCOVEROpenAndFill(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (*CDLDARKCLOUDCOVERStream, OutRange, error)

CDLDARKCLOUDCOVEROpenAndFill opens a stream as Core.CDLDARKCLOUDCOVEROpen does and also writes the outputs over the whole history, as Core.CDLDARKCLOUDCOVER writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLDARKCLOUDCOVERLookback values and share no memory with an input or another output.

The errors are those of Core.CDLDARKCLOUDCOVEROpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLDOJI

func (c *Core) CDLDOJI(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLDOJI recognizes the Doji pattern over bars startIdx through endIdx.

Single-candle Doji recognizer: fires when the real body (|close-open|) is at or below the BodyDoji threshold. Market indecision; neither bullish nor bearish on its own.

Formula and more info at https://ta-lib.org/functions/cdldoji.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: 100 when a doji is detected, else 0.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLDOJILookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLDOJI(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [0, ..., 0]

func (*Core) CDLDOJIDisplayShift

func (c *Core) CDLDOJIDisplayShift(outputIdx int) (int, error)

CDLDOJIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLDOJI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLDOJI, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLDOJILookback

func (c *Core) CDLDOJILookback() (int, error)

CDLDOJILookback returns how many leading bars Core.CDLDOJI consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLDOJIOpen

func (c *Core) CDLDOJIOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLDOJIStream, int32, error)

CDLDOJIOpen opens a live CDLDOJIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLDOJI writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLDOJILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLDOJIOpenAndFill

func (c *Core) CDLDOJIOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLDOJIStream, OutRange, error)

CDLDOJIOpenAndFill opens a stream as Core.CDLDOJIOpen does and also writes the outputs over the whole history, as Core.CDLDOJI writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLDOJILookback values and share no memory with an input or another output.

The errors are those of Core.CDLDOJIOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLDOJISTAR

func (c *Core) CDLDOJISTAR(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLDOJISTAR recognizes the Doji Star pattern over bars startIdx through endIdx.

A two-candle reversal pattern: a long real body followed by a doji whose real body gaps away from it (up after a white body, down after a black body). Signals a potential reversal of the prevailing trend. A hit flags a likely trend reversal; true direction depends on the prevailing trend (bullish in a downtrend, bearish in an uptrend), which the code does not itself verify.

Formula and more info at https://ta-lib.org/functions/cdldojistar.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: Emits +100 or -100 on a hit, 0 otherwise. Value is -candlecolor(candle1)*100: -100 when candle 1 is white (gap up), +100 when candle 1 is black (gap down)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLDOJISTARLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLDOJISTAR(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLDOJISTARDisplayShift

func (c *Core) CDLDOJISTARDisplayShift(outputIdx int) (int, error)

CDLDOJISTARDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLDOJISTAR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLDOJISTAR, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLDOJISTARLookback

func (c *Core) CDLDOJISTARLookback() (int, error)

CDLDOJISTARLookback returns how many leading bars Core.CDLDOJISTAR consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLDOJISTAROpen

func (c *Core) CDLDOJISTAROpen(inOpen, inHigh, inLow, inClose []float64) (*CDLDOJISTARStream, int32, error)

CDLDOJISTAROpen opens a live CDLDOJISTARStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLDOJISTAR writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLDOJISTARLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLDOJISTAROpenAndFill

func (c *Core) CDLDOJISTAROpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLDOJISTARStream, OutRange, error)

CDLDOJISTAROpenAndFill opens a stream as Core.CDLDOJISTAROpen does and also writes the outputs over the whole history, as Core.CDLDOJISTAR writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLDOJISTARLookback values and share no memory with an input or another output.

The errors are those of Core.CDLDOJISTAROpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLDRAGONFLYDOJI

func (c *Core) CDLDRAGONFLYDOJI(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLDRAGONFLYDOJI recognizes the Dragonfly Doji pattern over bars startIdx through endIdx.

Single-candle pattern: a doji (open and close nearly equal) sitting at the top of the range, with no meaningful upper shadow and a long lower shadow. A reversal signal, but its bullish/bearish meaning depends on the prior trend (the code does not judge direction). A hit marks a dragonfly doji; treated as a potential reversal, but direction (bullish/bearish) must be read from the trend it appears in.

Formula and more info at https://ta-lib.org/functions/cdldragonflydoji.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the pattern is present, 0 otherwise; never -100. The +100 does not itself imply bullishness (must be read against the trend)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLDRAGONFLYDOJILookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLDRAGONFLYDOJI(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [0, ..., 0]

func (*Core) CDLDRAGONFLYDOJIDisplayShift

func (c *Core) CDLDRAGONFLYDOJIDisplayShift(outputIdx int) (int, error)

CDLDRAGONFLYDOJIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLDRAGONFLYDOJI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLDRAGONFLYDOJI, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLDRAGONFLYDOJILookback

func (c *Core) CDLDRAGONFLYDOJILookback() (int, error)

CDLDRAGONFLYDOJILookback returns how many leading bars Core.CDLDRAGONFLYDOJI consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLDRAGONFLYDOJIOpen

func (c *Core) CDLDRAGONFLYDOJIOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLDRAGONFLYDOJIStream, int32, error)

CDLDRAGONFLYDOJIOpen opens a live CDLDRAGONFLYDOJIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLDRAGONFLYDOJI writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLDRAGONFLYDOJILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLDRAGONFLYDOJIOpenAndFill

func (c *Core) CDLDRAGONFLYDOJIOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLDRAGONFLYDOJIStream, OutRange, error)

CDLDRAGONFLYDOJIOpenAndFill opens a stream as Core.CDLDRAGONFLYDOJIOpen does and also writes the outputs over the whole history, as Core.CDLDRAGONFLYDOJI writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLDRAGONFLYDOJILookback values and share no memory with an input or another output.

The errors are those of Core.CDLDRAGONFLYDOJIOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLENGULFING

func (c *Core) CDLENGULFING(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLENGULFING recognizes the Engulfing pattern over bars startIdx through endIdx.

A two-candle reversal pattern where the second candle's real body engulfs the first candle's opposite-colored real body. Bullish (white engulfs black) or bearish (black engulfs white) reversal signal; ideally after a downtrend (bullish) or uptrend (bearish), which the code does not verify.

Formula and more info at https://ta-lib.org/functions/cdlengulfing.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100/+80 (bullish, white engulfs black), -100/-80 (bearish, black engulfs white), 0 otherwise. Magnitude 100 when the second body strictly engulfs both ends; 80 when the bodies share an exact endpoint (open[i]==close[i-1] or close[i]==open[i-1])

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLENGULFINGLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLENGULFING(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
250 values from bar 2: [0, ..., 0]

func (*Core) CDLENGULFINGDisplayShift

func (c *Core) CDLENGULFINGDisplayShift(outputIdx int) (int, error)

CDLENGULFINGDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLENGULFING. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLENGULFING, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLENGULFINGLookback

func (c *Core) CDLENGULFINGLookback() (int, error)

CDLENGULFINGLookback returns how many leading bars Core.CDLENGULFING consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLENGULFINGOpen

func (c *Core) CDLENGULFINGOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLENGULFINGStream, int32, error)

CDLENGULFINGOpen opens a live CDLENGULFINGStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLENGULFING writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLENGULFINGLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLENGULFINGOpenAndFill

func (c *Core) CDLENGULFINGOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLENGULFINGStream, OutRange, error)

CDLENGULFINGOpenAndFill opens a stream as Core.CDLENGULFINGOpen does and also writes the outputs over the whole history, as Core.CDLENGULFING writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLENGULFINGLookback values and share no memory with an input or another output.

The errors are those of Core.CDLENGULFINGOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLEVENINGDOJISTAR

func (c *Core) CDLEVENINGDOJISTAR(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (OutRange, error)

CDLEVENINGDOJISTAR recognizes the Evening Doji Star pattern over bars startIdx through endIdx.

A three-candle bearish reversal pattern: a long white candle, a doji that gaps up (the star), then a black candle closing well down into the first candle's body. A stricter Evening Star whose middle candle must be a doji. Hit (-100) signals a bearish top reversal.

Formula and more info at https://ta-lib.org/functions/cdleveningdojistar.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInPenetration: Fraction of the 1st real body the 3rd candle's close must penetrate; larger demands a deeper close into the first body. Default 0.3; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 when the pattern is detected, 0 otherwise. Always bearish; never emits +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLEVENINGDOJISTARLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLEVENINGDOJISTAR(0, len(open)-1, open, high, low, close, 0.3, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDLEVENINGDOJISTARDisplayShift

func (c *Core) CDLEVENINGDOJISTARDisplayShift(optInPenetration float64, outputIdx int) (int, error)

CDLEVENINGDOJISTARDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLEVENINGDOJISTAR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CDLEVENINGDOJISTAR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CDLEVENINGDOJISTARLookback rejects or an index that names no output.

func (*Core) CDLEVENINGDOJISTARLookback

func (c *Core) CDLEVENINGDOJISTARLookback(optInPenetration float64) (int, error)

CDLEVENINGDOJISTARLookback returns how many leading bars Core.CDLEVENINGDOJISTAR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CDLEVENINGDOJISTAR and returns BadParam for one out of range.

func (*Core) CDLEVENINGDOJISTAROpen

func (c *Core) CDLEVENINGDOJISTAROpen(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64) (*CDLEVENINGDOJISTARStream, int32, error)

CDLEVENINGDOJISTAROpen opens a live CDLEVENINGDOJISTARStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLEVENINGDOJISTAR writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.CDLEVENINGDOJISTAR.

The error is InsufficientHistory for a history of at most Core.CDLEVENINGDOJISTARLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CDLEVENINGDOJISTAROpenAndFill

func (c *Core) CDLEVENINGDOJISTAROpenAndFill(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (*CDLEVENINGDOJISTARStream, OutRange, error)

CDLEVENINGDOJISTAROpenAndFill opens a stream as Core.CDLEVENINGDOJISTAROpen does and also writes the outputs over the whole history, as Core.CDLEVENINGDOJISTAR writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLEVENINGDOJISTARLookback values and share no memory with an input or another output.

The errors are those of Core.CDLEVENINGDOJISTAROpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLEVENINGSTAR

func (c *Core) CDLEVENINGSTAR(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (OutRange, error)

CDLEVENINGSTAR recognizes the Evening Star pattern over bars startIdx through endIdx.

A three-candle bearish reversal pattern: a long white candle, a short-bodied star gapping up, then a black candle closing well down into the first candle's body. A hit signals a bearish reversal (most significant in an uptrend).

Formula and more info at https://ta-lib.org/functions/cdleveningstar.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInPenetration: Fraction of the 1st candle's real body the 3rd close must penetrate below the 1st close; larger requires deeper penetration. Default 0.3; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 when detected (always bearish), 0 otherwise. Never emits +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLEVENINGSTARLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLEVENINGSTAR(0, len(open)-1, open, high, low, close, 0.3, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDLEVENINGSTARDisplayShift

func (c *Core) CDLEVENINGSTARDisplayShift(optInPenetration float64, outputIdx int) (int, error)

CDLEVENINGSTARDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLEVENINGSTAR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CDLEVENINGSTAR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CDLEVENINGSTARLookback rejects or an index that names no output.

func (*Core) CDLEVENINGSTARLookback

func (c *Core) CDLEVENINGSTARLookback(optInPenetration float64) (int, error)

CDLEVENINGSTARLookback returns how many leading bars Core.CDLEVENINGSTAR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CDLEVENINGSTAR and returns BadParam for one out of range.

func (*Core) CDLEVENINGSTAROpen

func (c *Core) CDLEVENINGSTAROpen(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64) (*CDLEVENINGSTARStream, int32, error)

CDLEVENINGSTAROpen opens a live CDLEVENINGSTARStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLEVENINGSTAR writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.CDLEVENINGSTAR.

The error is InsufficientHistory for a history of at most Core.CDLEVENINGSTARLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CDLEVENINGSTAROpenAndFill

func (c *Core) CDLEVENINGSTAROpenAndFill(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (*CDLEVENINGSTARStream, OutRange, error)

CDLEVENINGSTAROpenAndFill opens a stream as Core.CDLEVENINGSTAROpen does and also writes the outputs over the whole history, as Core.CDLEVENINGSTAR writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLEVENINGSTARLookback values and share no memory with an input or another output.

The errors are those of Core.CDLEVENINGSTAROpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLGAPSIDESIDEWHITE

func (c *Core) CDLGAPSIDESIDEWHITE(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLGAPSIDESIDEWHITE recognizes the Up/Down-gap side-by-side white lines pattern over bars startIdx through endIdx.

A three-candle pattern: a first candle followed by two white candles of similar body size that both gap the same direction (up or down) from the first candle's real body and open at about the same level. It is a continuation signal whose sign reports the gap direction; the code does not verify a prior trend.

Formula and more info at https://ta-lib.org/functions/cdlgapsidesidewhite.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 for an up-gap (bullish continuation), -100 for a down-gap (bearish continuation), 0 when no pattern. Sign is set solely by the C2-vs-C1 gap direction (realbodygapup ? 100 : -100)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLGAPSIDESIDEWHITELookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLGAPSIDESIDEWHITE(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
245 values from bar 7: [0, ..., 0]

func (*Core) CDLGAPSIDESIDEWHITEDisplayShift

func (c *Core) CDLGAPSIDESIDEWHITEDisplayShift(outputIdx int) (int, error)

CDLGAPSIDESIDEWHITEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLGAPSIDESIDEWHITE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLGAPSIDESIDEWHITE, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLGAPSIDESIDEWHITELookback

func (c *Core) CDLGAPSIDESIDEWHITELookback() (int, error)

CDLGAPSIDESIDEWHITELookback returns how many leading bars Core.CDLGAPSIDESIDEWHITE consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLGAPSIDESIDEWHITEOpen

func (c *Core) CDLGAPSIDESIDEWHITEOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLGAPSIDESIDEWHITEStream, int32, error)

CDLGAPSIDESIDEWHITEOpen opens a live CDLGAPSIDESIDEWHITEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLGAPSIDESIDEWHITE writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLGAPSIDESIDEWHITELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLGAPSIDESIDEWHITEOpenAndFill

func (c *Core) CDLGAPSIDESIDEWHITEOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLGAPSIDESIDEWHITEStream, OutRange, error)

CDLGAPSIDESIDEWHITEOpenAndFill opens a stream as Core.CDLGAPSIDESIDEWHITEOpen does and also writes the outputs over the whole history, as Core.CDLGAPSIDESIDEWHITE writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLGAPSIDESIDEWHITELookback values and share no memory with an input or another output.

The errors are those of Core.CDLGAPSIDESIDEWHITEOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLGRAVESTONEDOJI

func (c *Core) CDLGRAVESTONEDOJI(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLGRAVESTONEDOJI recognizes the Gravestone Doji pattern over bars startIdx through endIdx.

Single-candle doji whose open and close sit at the low of the day, leaving a long upper shadow and no lower shadow. A doji variant whose bullish/bearish meaning depends on the surrounding trend, which the code does not judge. A hit marks a gravestone doji; its bullish vs bearish reversal meaning must be read against the prevailing trend, which this function does not check.

Formula and more info at https://ta-lib.org/functions/cdlgravestonedoji.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 on a detected gravestone doji, 0 otherwise. Never negative; the positive sign is not a directional signal (evaluate relative to the trend)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLGRAVESTONEDOJILookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLGRAVESTONEDOJI(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [0, ..., 0]

func (*Core) CDLGRAVESTONEDOJIDisplayShift

func (c *Core) CDLGRAVESTONEDOJIDisplayShift(outputIdx int) (int, error)

CDLGRAVESTONEDOJIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLGRAVESTONEDOJI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLGRAVESTONEDOJI, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLGRAVESTONEDOJILookback

func (c *Core) CDLGRAVESTONEDOJILookback() (int, error)

CDLGRAVESTONEDOJILookback returns how many leading bars Core.CDLGRAVESTONEDOJI consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLGRAVESTONEDOJIOpen

func (c *Core) CDLGRAVESTONEDOJIOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLGRAVESTONEDOJIStream, int32, error)

CDLGRAVESTONEDOJIOpen opens a live CDLGRAVESTONEDOJIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLGRAVESTONEDOJI writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLGRAVESTONEDOJILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLGRAVESTONEDOJIOpenAndFill

func (c *Core) CDLGRAVESTONEDOJIOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLGRAVESTONEDOJIStream, OutRange, error)

CDLGRAVESTONEDOJIOpenAndFill opens a stream as Core.CDLGRAVESTONEDOJIOpen does and also writes the outputs over the whole history, as Core.CDLGRAVESTONEDOJI writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLGRAVESTONEDOJILookback values and share no memory with an input or another output.

The errors are those of Core.CDLGRAVESTONEDOJIOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLHAMMER

func (c *Core) CDLHAMMER(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLHAMMER recognizes the Hammer pattern over bars startIdx through endIdx.

Single-candle pattern: a small real body at the top of the range with a long lower shadow and little or no upper shadow, sitting at or near the prior candle's low. A hit flags a potential bullish reversal.

Formula and more info at https://ta-lib.org/functions/cdlhammer.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the hammer is detected, 0 otherwise. Bullish only; never emits -100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLHAMMERLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLHAMMER(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLHAMMERDisplayShift

func (c *Core) CDLHAMMERDisplayShift(outputIdx int) (int, error)

CDLHAMMERDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLHAMMER. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLHAMMER, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLHAMMERLookback

func (c *Core) CDLHAMMERLookback() (int, error)

CDLHAMMERLookback returns how many leading bars Core.CDLHAMMER consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLHAMMEROpen

func (c *Core) CDLHAMMEROpen(inOpen, inHigh, inLow, inClose []float64) (*CDLHAMMERStream, int32, error)

CDLHAMMEROpen opens a live CDLHAMMERStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLHAMMER writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLHAMMERLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLHAMMEROpenAndFill

func (c *Core) CDLHAMMEROpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLHAMMERStream, OutRange, error)

CDLHAMMEROpenAndFill opens a stream as Core.CDLHAMMEROpen does and also writes the outputs over the whole history, as Core.CDLHAMMER writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLHAMMERLookback values and share no memory with an input or another output.

The errors are those of Core.CDLHAMMEROpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLHANGINGMAN

func (c *Core) CDLHANGINGMAN(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLHANGINGMAN recognizes the Hanging Man pattern over bars startIdx through endIdx.

Single candle with a small real body, a long lower shadow, and little/no upper shadow, sitting at or near the highs of the prior candle. Bearish reversal signal. A hit is a bearish reversal signal (meaningful at the top of an uptrend).

Formula and more info at https://ta-lib.org/functions/cdlhangingman.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 when detected (always bearish), 0 otherwise. Never emits +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLHANGINGMANLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLHANGINGMAN(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLHANGINGMANDisplayShift

func (c *Core) CDLHANGINGMANDisplayShift(outputIdx int) (int, error)

CDLHANGINGMANDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLHANGINGMAN. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLHANGINGMAN, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLHANGINGMANLookback

func (c *Core) CDLHANGINGMANLookback() (int, error)

CDLHANGINGMANLookback returns how many leading bars Core.CDLHANGINGMAN consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLHANGINGMANOpen

func (c *Core) CDLHANGINGMANOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLHANGINGMANStream, int32, error)

CDLHANGINGMANOpen opens a live CDLHANGINGMANStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLHANGINGMAN writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLHANGINGMANLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLHANGINGMANOpenAndFill

func (c *Core) CDLHANGINGMANOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLHANGINGMANStream, OutRange, error)

CDLHANGINGMANOpenAndFill opens a stream as Core.CDLHANGINGMANOpen does and also writes the outputs over the whole history, as Core.CDLHANGINGMAN writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLHANGINGMANLookback values and share no memory with an input or another output.

The errors are those of Core.CDLHANGINGMANOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLHARAMI

func (c *Core) CDLHARAMI(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLHARAMI recognizes the Harami pattern over bars startIdx through endIdx.

Two-candle pattern: a long real body followed by a short real body contained within the first candle's real body. A reversal signal whose direction is the opposite of the first candle's color.

Formula and more info at https://ta-lib.org/functions/cdlharami.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100/+80 when the long 1st candle is black (bullish), -100/-80 when it is white (bearish), 0 otherwise; 80 when the two real bodies share an end, 100 when the 1st body strictly overhangs both ends of the 2nd.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLHARAMILookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLHARAMI(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLHARAMICROSS

func (c *Core) CDLHARAMICROSS(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLHARAMICROSS recognizes the Harami Cross pattern over bars startIdx through endIdx.

A two-candle reversal pattern: a long real body followed by a doji whose real body is contained within the first candle's real body (the doji variant of the Harami). Bullish after a black first candle, bearish after a white first candle.

Formula and more info at https://ta-lib.org/functions/cdlharamicross.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100/+80 when the first candle is black (bullish), -100/-80 when the first candle is white (bearish), 0 otherwise. Magnitude 100 for strict containment inside the first body, 80 when one or both real-body ends match.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLHARAMICROSSLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLHARAMICROSS(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLHARAMICROSSDisplayShift

func (c *Core) CDLHARAMICROSSDisplayShift(outputIdx int) (int, error)

CDLHARAMICROSSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLHARAMICROSS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLHARAMICROSS, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLHARAMICROSSLookback

func (c *Core) CDLHARAMICROSSLookback() (int, error)

CDLHARAMICROSSLookback returns how many leading bars Core.CDLHARAMICROSS consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLHARAMICROSSOpen

func (c *Core) CDLHARAMICROSSOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLHARAMICROSSStream, int32, error)

CDLHARAMICROSSOpen opens a live CDLHARAMICROSSStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLHARAMICROSS writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLHARAMICROSSLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLHARAMICROSSOpenAndFill

func (c *Core) CDLHARAMICROSSOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLHARAMICROSSStream, OutRange, error)

CDLHARAMICROSSOpenAndFill opens a stream as Core.CDLHARAMICROSSOpen does and also writes the outputs over the whole history, as Core.CDLHARAMICROSS writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLHARAMICROSSLookback values and share no memory with an input or another output.

The errors are those of Core.CDLHARAMICROSSOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLHARAMIDisplayShift

func (c *Core) CDLHARAMIDisplayShift(outputIdx int) (int, error)

CDLHARAMIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLHARAMI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLHARAMI, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLHARAMILookback

func (c *Core) CDLHARAMILookback() (int, error)

CDLHARAMILookback returns how many leading bars Core.CDLHARAMI consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLHARAMIOpen

func (c *Core) CDLHARAMIOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLHARAMIStream, int32, error)

CDLHARAMIOpen opens a live CDLHARAMIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLHARAMI writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLHARAMILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLHARAMIOpenAndFill

func (c *Core) CDLHARAMIOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLHARAMIStream, OutRange, error)

CDLHARAMIOpenAndFill opens a stream as Core.CDLHARAMIOpen does and also writes the outputs over the whole history, as Core.CDLHARAMI writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLHARAMILookback values and share no memory with an input or another output.

The errors are those of Core.CDLHARAMIOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLHIGHWAVE

func (c *Core) CDLHIGHWAVE(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLHIGHWAVE recognizes the High-Wave Candle pattern over bars startIdx through endIdx.

Single-candle pattern: a short real body with both a very long upper and a very long lower shadow. Signals market indecision; the output sign reports only candle color, not a bullish/bearish direction. A hit marks indecision (long-legged candle); not directional - sign encodes only the candle's color.

Formula and more info at https://ta-lib.org/functions/cdlhighwave.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: On a hit, +100 when the candle is white (close >= open) or -100 when black (close < open); 0 otherwise. Sign denotes color, NOT bull/bear.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLHIGHWAVELookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLHIGHWAVE(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [-100, ..., 0]

func (*Core) CDLHIGHWAVEDisplayShift

func (c *Core) CDLHIGHWAVEDisplayShift(outputIdx int) (int, error)

CDLHIGHWAVEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLHIGHWAVE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLHIGHWAVE, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLHIGHWAVELookback

func (c *Core) CDLHIGHWAVELookback() (int, error)

CDLHIGHWAVELookback returns how many leading bars Core.CDLHIGHWAVE consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLHIGHWAVEOpen

func (c *Core) CDLHIGHWAVEOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLHIGHWAVEStream, int32, error)

CDLHIGHWAVEOpen opens a live CDLHIGHWAVEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLHIGHWAVE writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLHIGHWAVELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLHIGHWAVEOpenAndFill

func (c *Core) CDLHIGHWAVEOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLHIGHWAVEStream, OutRange, error)

CDLHIGHWAVEOpenAndFill opens a stream as Core.CDLHIGHWAVEOpen does and also writes the outputs over the whole history, as Core.CDLHIGHWAVE writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLHIGHWAVELookback values and share no memory with an input or another output.

The errors are those of Core.CDLHIGHWAVEOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLHIKKAKE

func (c *Core) CDLHIKKAKE(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLHIKKAKE recognizes the Hikkake pattern over bars startIdx through endIdx.

A 3-bar pattern: an inside bar followed by a false breakout, optionally later confirmed by a follow-through bar. Signals a bullish or bearish reversal/continuation depending on the breakout direction. A false-breakout setup: positive = bullish, negative = bearish; magnitude 200 flags the confirming bar.

Formula and more info at https://ta-lib.org/functions/cdlhikkake.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100/-100 at the hikkake (breakout) bar for bull/bear; +200/-200 at a later confirmation bar; 0 otherwise.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLHIKKAKELookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLHIKKAKE(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
247 values from bar 5: [0, ..., 0]

func (*Core) CDLHIKKAKEDisplayShift

func (c *Core) CDLHIKKAKEDisplayShift(outputIdx int) (int, error)

CDLHIKKAKEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLHIKKAKE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLHIKKAKE, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLHIKKAKELookback

func (c *Core) CDLHIKKAKELookback() (int, error)

CDLHIKKAKELookback returns how many leading bars Core.CDLHIKKAKE consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLHIKKAKEMOD

func (c *Core) CDLHIKKAKEMOD(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLHIKKAKEMOD recognizes the Modified Hikkake pattern over bars startIdx through endIdx.

A four-candle pattern: two successively narrower inside bars, then a breakout bar, with the second candle closing near one extreme of its range. Bullish or bearish reversal signal. Bullish (+) or bearish (-) reversal; per the code's note it is significant in a downtrend (bull) or uptrend (bear), context the code does not verify.

Formula and more info at https://ta-lib.org/functions/cdlhikkakemod.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 bullish hikkake bar, -100 bearish; +200 confirmed bullish, -200 confirmed bearish; 0 otherwise.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLHIKKAKEMODLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLHIKKAKEMOD(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [0, ..., 0]

func (*Core) CDLHIKKAKEMODDisplayShift

func (c *Core) CDLHIKKAKEMODDisplayShift(outputIdx int) (int, error)

CDLHIKKAKEMODDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLHIKKAKEMOD. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLHIKKAKEMOD, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLHIKKAKEMODLookback

func (c *Core) CDLHIKKAKEMODLookback() (int, error)

CDLHIKKAKEMODLookback returns how many leading bars Core.CDLHIKKAKEMOD consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLHIKKAKEMODOpen

func (c *Core) CDLHIKKAKEMODOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLHIKKAKEMODStream, int32, error)

CDLHIKKAKEMODOpen opens a live CDLHIKKAKEMODStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLHIKKAKEMOD writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLHIKKAKEMODLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLHIKKAKEMODOpenAndFill

func (c *Core) CDLHIKKAKEMODOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLHIKKAKEMODStream, OutRange, error)

CDLHIKKAKEMODOpenAndFill opens a stream as Core.CDLHIKKAKEMODOpen does and also writes the outputs over the whole history, as Core.CDLHIKKAKEMOD writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLHIKKAKEMODLookback values and share no memory with an input or another output.

The errors are those of Core.CDLHIKKAKEMODOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLHIKKAKEOpen

func (c *Core) CDLHIKKAKEOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLHIKKAKEStream, int32, error)

CDLHIKKAKEOpen opens a live CDLHIKKAKEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLHIKKAKE writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLHIKKAKELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLHIKKAKEOpenAndFill

func (c *Core) CDLHIKKAKEOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLHIKKAKEStream, OutRange, error)

CDLHIKKAKEOpenAndFill opens a stream as Core.CDLHIKKAKEOpen does and also writes the outputs over the whole history, as Core.CDLHIKKAKE writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLHIKKAKELookback values and share no memory with an input or another output.

The errors are those of Core.CDLHIKKAKEOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLHOMINGPIGEON

func (c *Core) CDLHOMINGPIGEON(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLHOMINGPIGEON recognizes the Homing Pigeon pattern over bars startIdx through endIdx.

Two-candle pattern: a long black candle followed by a small black candle whose real body sits inside the prior body. A hit signals a bullish reversal, most meaningful in a downtrend, which the code does not verify.

Formula and more info at https://ta-lib.org/functions/cdlhomingpigeon.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the pattern is detected, 0 otherwise. Never emits -100 (always bullish)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLHOMINGPIGEONLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLHOMINGPIGEON(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLHOMINGPIGEONDisplayShift

func (c *Core) CDLHOMINGPIGEONDisplayShift(outputIdx int) (int, error)

CDLHOMINGPIGEONDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLHOMINGPIGEON. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLHOMINGPIGEON, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLHOMINGPIGEONLookback

func (c *Core) CDLHOMINGPIGEONLookback() (int, error)

CDLHOMINGPIGEONLookback returns how many leading bars Core.CDLHOMINGPIGEON consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLHOMINGPIGEONOpen

func (c *Core) CDLHOMINGPIGEONOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLHOMINGPIGEONStream, int32, error)

CDLHOMINGPIGEONOpen opens a live CDLHOMINGPIGEONStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLHOMINGPIGEON writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLHOMINGPIGEONLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLHOMINGPIGEONOpenAndFill

func (c *Core) CDLHOMINGPIGEONOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLHOMINGPIGEONStream, OutRange, error)

CDLHOMINGPIGEONOpenAndFill opens a stream as Core.CDLHOMINGPIGEONOpen does and also writes the outputs over the whole history, as Core.CDLHOMINGPIGEON writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLHOMINGPIGEONLookback values and share no memory with an input or another output.

The errors are those of Core.CDLHOMINGPIGEONOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLIDENTICAL3CROWS

func (c *Core) CDLIDENTICAL3CROWS(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLIDENTICAL3CROWS recognizes the Identical Three Crows pattern over bars startIdx through endIdx.

A three-candle bearish reversal pattern: three consecutive declining black candles, each with a very short (or no) lower shadow, where each candle after the first opens at or very near the prior candle's close. A hit signals a bearish reversal (pattern is always bearish).

Formula and more info at https://ta-lib.org/functions/cdlidentical3crows.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 when the pattern is detected (always bearish), 0 otherwise. Never emits +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLIDENTICAL3CROWSLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLIDENTICAL3CROWS(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDLIDENTICAL3CROWSDisplayShift

func (c *Core) CDLIDENTICAL3CROWSDisplayShift(outputIdx int) (int, error)

CDLIDENTICAL3CROWSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLIDENTICAL3CROWS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLIDENTICAL3CROWS, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLIDENTICAL3CROWSLookback

func (c *Core) CDLIDENTICAL3CROWSLookback() (int, error)

CDLIDENTICAL3CROWSLookback returns how many leading bars Core.CDLIDENTICAL3CROWS consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLIDENTICAL3CROWSOpen

func (c *Core) CDLIDENTICAL3CROWSOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLIDENTICAL3CROWSStream, int32, error)

CDLIDENTICAL3CROWSOpen opens a live CDLIDENTICAL3CROWSStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLIDENTICAL3CROWS writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLIDENTICAL3CROWSLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLIDENTICAL3CROWSOpenAndFill

func (c *Core) CDLIDENTICAL3CROWSOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLIDENTICAL3CROWSStream, OutRange, error)

CDLIDENTICAL3CROWSOpenAndFill opens a stream as Core.CDLIDENTICAL3CROWSOpen does and also writes the outputs over the whole history, as Core.CDLIDENTICAL3CROWS writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLIDENTICAL3CROWSLookback values and share no memory with an input or another output.

The errors are those of Core.CDLIDENTICAL3CROWSOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLINNECK

func (c *Core) CDLINNECK(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLINNECK recognizes the In-Neck pattern over bars startIdx through endIdx.

A two-candle in-neck pattern: a long black candle followed by a white candle that opens below the prior low and closes just barely into the prior body (near the prior close). It is a bearish continuation signal. A hit signals bearish continuation (the down move is expected to resume).

Formula and more info at https://ta-lib.org/functions/cdlinneck.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 when the in-neck pattern is detected, 0 otherwise. This pattern only ever emits the negative (bearish) signal; it never emits +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLINNECKLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLINNECK(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLINNECKDisplayShift

func (c *Core) CDLINNECKDisplayShift(outputIdx int) (int, error)

CDLINNECKDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLINNECK. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLINNECK, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLINNECKLookback

func (c *Core) CDLINNECKLookback() (int, error)

CDLINNECKLookback returns how many leading bars Core.CDLINNECK consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLINNECKOpen

func (c *Core) CDLINNECKOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLINNECKStream, int32, error)

CDLINNECKOpen opens a live CDLINNECKStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLINNECK writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLINNECKLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLINNECKOpenAndFill

func (c *Core) CDLINNECKOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLINNECKStream, OutRange, error)

CDLINNECKOpenAndFill opens a stream as Core.CDLINNECKOpen does and also writes the outputs over the whole history, as Core.CDLINNECK writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLINNECKLookback values and share no memory with an input or another output.

The errors are those of Core.CDLINNECKOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLINVERTEDHAMMER

func (c *Core) CDLINVERTEDHAMMER(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLINVERTEDHAMMER recognizes the Inverted Hammer pattern over bars startIdx through endIdx.

Single-candle pattern: a small real body with a long upper shadow and little-to-no lower shadow that gaps down from the prior candle. A hit flags a potential bullish reversal.

Formula and more info at https://ta-lib.org/functions/cdlinvertedhammer.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the inverted hammer is detected, 0 otherwise. Never emits -100; the pattern is always bullish.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLINVERTEDHAMMERLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLINVERTEDHAMMER(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLINVERTEDHAMMERDisplayShift

func (c *Core) CDLINVERTEDHAMMERDisplayShift(outputIdx int) (int, error)

CDLINVERTEDHAMMERDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLINVERTEDHAMMER. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLINVERTEDHAMMER, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLINVERTEDHAMMERLookback

func (c *Core) CDLINVERTEDHAMMERLookback() (int, error)

CDLINVERTEDHAMMERLookback returns how many leading bars Core.CDLINVERTEDHAMMER consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLINVERTEDHAMMEROpen

func (c *Core) CDLINVERTEDHAMMEROpen(inOpen, inHigh, inLow, inClose []float64) (*CDLINVERTEDHAMMERStream, int32, error)

CDLINVERTEDHAMMEROpen opens a live CDLINVERTEDHAMMERStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLINVERTEDHAMMER writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLINVERTEDHAMMERLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLINVERTEDHAMMEROpenAndFill

func (c *Core) CDLINVERTEDHAMMEROpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLINVERTEDHAMMERStream, OutRange, error)

CDLINVERTEDHAMMEROpenAndFill opens a stream as Core.CDLINVERTEDHAMMEROpen does and also writes the outputs over the whole history, as Core.CDLINVERTEDHAMMER writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLINVERTEDHAMMERLookback values and share no memory with an input or another output.

The errors are those of Core.CDLINVERTEDHAMMEROpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLKICKING

func (c *Core) CDLKICKING(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLKICKING recognizes the Kicking pattern over bars startIdx through endIdx.

Two-candle pattern of two opposite-color marubozu (long bodies with very short shadows) separated by a price gap. A reversal signal whose direction is set by the second candle's color.

Formula and more info at https://ta-lib.org/functions/cdlkicking.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the second candle is white (bullish), -100 when it is black (bearish), 0 otherwise.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLKICKINGLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLKICKING(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLKICKINGBYLENGTH

func (c *Core) CDLKICKINGBYLENGTH(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLKICKINGBYLENGTH recognizes the Kicking - bull/bear determined by the longer marubozu pattern over bars startIdx through endIdx.

A two-candle pattern of two opposite-color marubozu (long body, very short shadows on both ends) separated by a gap. A strong directional/reversal signal whose bull/bear bias is set by the longer of the two marubozu.

Formula and more info at https://ta-lib.org/functions/cdlkickingbylength.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 or -100 on a hit, 0 otherwise. Sign = candlecolor of the candle with the larger realbody (i if realbody(i) > realbody(i-1), else i-1; tie goes to i-1): +100 if that marubozu is white, -100 if black.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLKICKINGBYLENGTHLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLKICKINGBYLENGTH(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLKICKINGBYLENGTHDisplayShift

func (c *Core) CDLKICKINGBYLENGTHDisplayShift(outputIdx int) (int, error)

CDLKICKINGBYLENGTHDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLKICKINGBYLENGTH. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLKICKINGBYLENGTH, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLKICKINGBYLENGTHLookback

func (c *Core) CDLKICKINGBYLENGTHLookback() (int, error)

CDLKICKINGBYLENGTHLookback returns how many leading bars Core.CDLKICKINGBYLENGTH consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLKICKINGBYLENGTHOpen

func (c *Core) CDLKICKINGBYLENGTHOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLKICKINGBYLENGTHStream, int32, error)

CDLKICKINGBYLENGTHOpen opens a live CDLKICKINGBYLENGTHStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLKICKINGBYLENGTH writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLKICKINGBYLENGTHLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLKICKINGBYLENGTHOpenAndFill

func (c *Core) CDLKICKINGBYLENGTHOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLKICKINGBYLENGTHStream, OutRange, error)

CDLKICKINGBYLENGTHOpenAndFill opens a stream as Core.CDLKICKINGBYLENGTHOpen does and also writes the outputs over the whole history, as Core.CDLKICKINGBYLENGTH writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLKICKINGBYLENGTHLookback values and share no memory with an input or another output.

The errors are those of Core.CDLKICKINGBYLENGTHOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLKICKINGDisplayShift

func (c *Core) CDLKICKINGDisplayShift(outputIdx int) (int, error)

CDLKICKINGDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLKICKING. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLKICKING, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLKICKINGLookback

func (c *Core) CDLKICKINGLookback() (int, error)

CDLKICKINGLookback returns how many leading bars Core.CDLKICKING consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLKICKINGOpen

func (c *Core) CDLKICKINGOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLKICKINGStream, int32, error)

CDLKICKINGOpen opens a live CDLKICKINGStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLKICKING writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLKICKINGLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLKICKINGOpenAndFill

func (c *Core) CDLKICKINGOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLKICKINGStream, OutRange, error)

CDLKICKINGOpenAndFill opens a stream as Core.CDLKICKINGOpen does and also writes the outputs over the whole history, as Core.CDLKICKING writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLKICKINGLookback values and share no memory with an input or another output.

The errors are those of Core.CDLKICKINGOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLLADDERBOTTOM

func (c *Core) CDLLADDERBOTTOM(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLLADDERBOTTOM recognizes the Ladder Bottom pattern over bars startIdx through endIdx.

Five-candle bullish reversal pattern: three consecutively lower black candles, a fourth black candle with a non-very-short upper shadow, then a white candle that opens above the prior open and closes above the prior high. A hit is a bullish reversal signal, most meaningful after a downtrend.

Formula and more info at https://ta-lib.org/functions/cdlladderbottom.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 on a detected ladder bottom, 0 otherwise. Only ever emits +100 (never -100); inherently bullish.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLLADDERBOTTOMLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLLADDERBOTTOM(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [0, ..., 0]

func (*Core) CDLLADDERBOTTOMDisplayShift

func (c *Core) CDLLADDERBOTTOMDisplayShift(outputIdx int) (int, error)

CDLLADDERBOTTOMDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLLADDERBOTTOM. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLLADDERBOTTOM, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLLADDERBOTTOMLookback

func (c *Core) CDLLADDERBOTTOMLookback() (int, error)

CDLLADDERBOTTOMLookback returns how many leading bars Core.CDLLADDERBOTTOM consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLLADDERBOTTOMOpen

func (c *Core) CDLLADDERBOTTOMOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLLADDERBOTTOMStream, int32, error)

CDLLADDERBOTTOMOpen opens a live CDLLADDERBOTTOMStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLLADDERBOTTOM writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLLADDERBOTTOMLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLLADDERBOTTOMOpenAndFill

func (c *Core) CDLLADDERBOTTOMOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLLADDERBOTTOMStream, OutRange, error)

CDLLADDERBOTTOMOpenAndFill opens a stream as Core.CDLLADDERBOTTOMOpen does and also writes the outputs over the whole history, as Core.CDLLADDERBOTTOM writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLLADDERBOTTOMLookback values and share no memory with an input or another output.

The errors are those of Core.CDLLADDERBOTTOMOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLLONGLEGGEDDOJI

func (c *Core) CDLLONGLEGGEDDOJI(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLLONGLEGGEDDOJI recognizes the Long Legged Doji pattern over bars startIdx through endIdx.

Single-candle doji (open ~ close) with at least one long shadow. Signals market indecision, not a directional bias. Marks indecision/uncertainty; not inherently bullish or bearish despite the positive sign.

Formula and more info at https://ta-lib.org/functions/cdllongleggeddoji.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the pattern is present, 0 otherwise. Only +100 is emitted; the code never emits -100, and the positive sign does NOT mean bullish.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLLONGLEGGEDDOJILookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLLONGLEGGEDDOJI(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [0, ..., 0]

func (*Core) CDLLONGLEGGEDDOJIDisplayShift

func (c *Core) CDLLONGLEGGEDDOJIDisplayShift(outputIdx int) (int, error)

CDLLONGLEGGEDDOJIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLLONGLEGGEDDOJI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLLONGLEGGEDDOJI, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLLONGLEGGEDDOJILookback

func (c *Core) CDLLONGLEGGEDDOJILookback() (int, error)

CDLLONGLEGGEDDOJILookback returns how many leading bars Core.CDLLONGLEGGEDDOJI consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLLONGLEGGEDDOJIOpen

func (c *Core) CDLLONGLEGGEDDOJIOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLLONGLEGGEDDOJIStream, int32, error)

CDLLONGLEGGEDDOJIOpen opens a live CDLLONGLEGGEDDOJIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLLONGLEGGEDDOJI writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLLONGLEGGEDDOJILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLLONGLEGGEDDOJIOpenAndFill

func (c *Core) CDLLONGLEGGEDDOJIOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLLONGLEGGEDDOJIStream, OutRange, error)

CDLLONGLEGGEDDOJIOpenAndFill opens a stream as Core.CDLLONGLEGGEDDOJIOpen does and also writes the outputs over the whole history, as Core.CDLLONGLEGGEDDOJI writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLLONGLEGGEDDOJILookback values and share no memory with an input or another output.

The errors are those of Core.CDLLONGLEGGEDDOJIOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLLONGLINE

func (c *Core) CDLLONGLINE(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLLONGLINE recognizes the Long Line Candle pattern over bars startIdx through endIdx.

A single-candle pattern: a long real body with short upper and short lower shadow. The signal direction follows the candle color (bullish if white, bearish if black). Signals strong directional conviction on the bar. Not intrinsically a reversal or continuation signal.

Formula and more info at https://ta-lib.org/functions/cdllongline.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 on a white (close>=open) long line, -100 on a black long line, 0 when no pattern.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLLONGLINELookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLLONGLINE(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [0, ..., 0]

func (*Core) CDLLONGLINEDisplayShift

func (c *Core) CDLLONGLINEDisplayShift(outputIdx int) (int, error)

CDLLONGLINEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLLONGLINE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLLONGLINE, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLLONGLINELookback

func (c *Core) CDLLONGLINELookback() (int, error)

CDLLONGLINELookback returns how many leading bars Core.CDLLONGLINE consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLLONGLINEOpen

func (c *Core) CDLLONGLINEOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLLONGLINEStream, int32, error)

CDLLONGLINEOpen opens a live CDLLONGLINEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLLONGLINE writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLLONGLINELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLLONGLINEOpenAndFill

func (c *Core) CDLLONGLINEOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLLONGLINEStream, OutRange, error)

CDLLONGLINEOpenAndFill opens a stream as Core.CDLLONGLINEOpen does and also writes the outputs over the whole history, as Core.CDLLONGLINE writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLLONGLINELookback values and share no memory with an input or another output.

The errors are those of Core.CDLLONGLINEOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLMARUBOZU

func (c *Core) CDLMARUBOZU(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLMARUBOZU recognizes the Marubozu pattern over bars startIdx through endIdx.

Single candle with a long real body and no/very-short upper and lower shadows, so open and close sit at the range extremes. Bullish (white) or bearish (black) reversal/strength signal per the body color.

Formula and more info at https://ta-lib.org/functions/cdlmarubozu.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 on a white (bullish) marubozu, -100 on a black (bearish) marubozu, 0 when no pattern. Sign follows the candle color.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLMARUBOZULookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLMARUBOZU(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [0, ..., 0]

func (*Core) CDLMARUBOZUDisplayShift

func (c *Core) CDLMARUBOZUDisplayShift(outputIdx int) (int, error)

CDLMARUBOZUDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLMARUBOZU. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLMARUBOZU, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLMARUBOZULookback

func (c *Core) CDLMARUBOZULookback() (int, error)

CDLMARUBOZULookback returns how many leading bars Core.CDLMARUBOZU consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLMARUBOZUOpen

func (c *Core) CDLMARUBOZUOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLMARUBOZUStream, int32, error)

CDLMARUBOZUOpen opens a live CDLMARUBOZUStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLMARUBOZU writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLMARUBOZULookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLMARUBOZUOpenAndFill

func (c *Core) CDLMARUBOZUOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLMARUBOZUStream, OutRange, error)

CDLMARUBOZUOpenAndFill opens a stream as Core.CDLMARUBOZUOpen does and also writes the outputs over the whole history, as Core.CDLMARUBOZU writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLMARUBOZULookback values and share no memory with an input or another output.

The errors are those of Core.CDLMARUBOZUOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLMATCHINGLOW

func (c *Core) CDLMATCHINGLOW(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLMATCHINGLOW recognizes the Matching Low pattern over bars startIdx through endIdx.

A two-candle pattern of two consecutive black (bearish) candles with equal closes (within a tolerance). Treated as a bullish reversal signal. A hit signals a potential bullish reversal (shared support close after two down candles).

Formula and more info at https://ta-lib.org/functions/cdlmatchinglow.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the pattern is present, 0 otherwise. Only +100 is ever emitted (matching low is always bullish); never -100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLMATCHINGLOWLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLMATCHINGLOW(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
246 values from bar 6: [0, ..., 0]

func (*Core) CDLMATCHINGLOWDisplayShift

func (c *Core) CDLMATCHINGLOWDisplayShift(outputIdx int) (int, error)

CDLMATCHINGLOWDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLMATCHINGLOW. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLMATCHINGLOW, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLMATCHINGLOWLookback

func (c *Core) CDLMATCHINGLOWLookback() (int, error)

CDLMATCHINGLOWLookback returns how many leading bars Core.CDLMATCHINGLOW consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLMATCHINGLOWOpen

func (c *Core) CDLMATCHINGLOWOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLMATCHINGLOWStream, int32, error)

CDLMATCHINGLOWOpen opens a live CDLMATCHINGLOWStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLMATCHINGLOW writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLMATCHINGLOWLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLMATCHINGLOWOpenAndFill

func (c *Core) CDLMATCHINGLOWOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLMATCHINGLOWStream, OutRange, error)

CDLMATCHINGLOWOpenAndFill opens a stream as Core.CDLMATCHINGLOWOpen does and also writes the outputs over the whole history, as Core.CDLMATCHINGLOW writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLMATCHINGLOWLookback values and share no memory with an input or another output.

The errors are those of Core.CDLMATCHINGLOWOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLMATHOLD

func (c *Core) CDLMATHOLD(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (OutRange, error)

CDLMATHOLD recognizes the Mat Hold pattern over bars startIdx through endIdx.

A five-candle bullish continuation pattern: a long white candle, an upside real-body-gapped small black candle, two more small falling candles that hold within the first body, and a final white candle closing above the reaction days' highs. Signals continuation of the prior uptrend. Hit = bullish continuation of the existing uptrend.

Formula and more info at https://ta-lib.org/functions/cdlmathold.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInPenetration: Max fraction of the 1st white body the reaction days (3rd, 4th) may penetrate. Default 0.5; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the bullish Mat Hold is detected, 0 otherwise. Never emits -100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLMATHOLDLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLMATHOLD(0, len(open)-1, open, high, low, close, 0.5, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [0, ..., 0]

func (*Core) CDLMATHOLDDisplayShift

func (c *Core) CDLMATHOLDDisplayShift(optInPenetration float64, outputIdx int) (int, error)

CDLMATHOLDDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLMATHOLD. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CDLMATHOLD followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CDLMATHOLDLookback rejects or an index that names no output.

func (*Core) CDLMATHOLDLookback

func (c *Core) CDLMATHOLDLookback(optInPenetration float64) (int, error)

CDLMATHOLDLookback returns how many leading bars Core.CDLMATHOLD consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CDLMATHOLD and returns BadParam for one out of range.

func (*Core) CDLMATHOLDOpen

func (c *Core) CDLMATHOLDOpen(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64) (*CDLMATHOLDStream, int32, error)

CDLMATHOLDOpen opens a live CDLMATHOLDStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLMATHOLD writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.CDLMATHOLD.

The error is InsufficientHistory for a history of at most Core.CDLMATHOLDLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CDLMATHOLDOpenAndFill

func (c *Core) CDLMATHOLDOpenAndFill(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (*CDLMATHOLDStream, OutRange, error)

CDLMATHOLDOpenAndFill opens a stream as Core.CDLMATHOLDOpen does and also writes the outputs over the whole history, as Core.CDLMATHOLD writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLMATHOLDLookback values and share no memory with an input or another output.

The errors are those of Core.CDLMATHOLDOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLMORNINGDOJISTAR

func (c *Core) CDLMORNINGDOJISTAR(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (OutRange, error)

CDLMORNINGDOJISTAR recognizes the Morning Doji Star pattern over bars startIdx through endIdx.

A three-candle bullish reversal pattern: a long black candle, then a doji that gaps down, then a white candle closing well up into the first candle's body. It is the doji-star variant of the morning star. A hit (+100) signals a bullish reversal; most meaningful after a downtrend, which this function does not verify.

Formula and more info at https://ta-lib.org/functions/cdlmorningdojistar.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInPenetration: Fraction of the 1st candle's real body the 3rd close must exceed above close[i-2]; larger values demand deeper penetration into the black body. Default 0.3; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the pattern is detected, 0 otherwise. Always bullish; never emits -100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLMORNINGDOJISTARLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLMORNINGDOJISTAR(0, len(open)-1, open, high, low, close, 0.3, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDLMORNINGDOJISTARDisplayShift

func (c *Core) CDLMORNINGDOJISTARDisplayShift(optInPenetration float64, outputIdx int) (int, error)

CDLMORNINGDOJISTARDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLMORNINGDOJISTAR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CDLMORNINGDOJISTAR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CDLMORNINGDOJISTARLookback rejects or an index that names no output.

func (*Core) CDLMORNINGDOJISTARLookback

func (c *Core) CDLMORNINGDOJISTARLookback(optInPenetration float64) (int, error)

CDLMORNINGDOJISTARLookback returns how many leading bars Core.CDLMORNINGDOJISTAR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CDLMORNINGDOJISTAR and returns BadParam for one out of range.

func (*Core) CDLMORNINGDOJISTAROpen

func (c *Core) CDLMORNINGDOJISTAROpen(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64) (*CDLMORNINGDOJISTARStream, int32, error)

CDLMORNINGDOJISTAROpen opens a live CDLMORNINGDOJISTARStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLMORNINGDOJISTAR writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.CDLMORNINGDOJISTAR.

The error is InsufficientHistory for a history of at most Core.CDLMORNINGDOJISTARLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CDLMORNINGDOJISTAROpenAndFill

func (c *Core) CDLMORNINGDOJISTAROpenAndFill(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (*CDLMORNINGDOJISTARStream, OutRange, error)

CDLMORNINGDOJISTAROpenAndFill opens a stream as Core.CDLMORNINGDOJISTAROpen does and also writes the outputs over the whole history, as Core.CDLMORNINGDOJISTAR writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLMORNINGDOJISTARLookback values and share no memory with an input or another output.

The errors are those of Core.CDLMORNINGDOJISTAROpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLMORNINGSTAR

func (c *Core) CDLMORNINGSTAR(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (OutRange, error)

CDLMORNINGSTAR recognizes the Morning Star pattern over bars startIdx through endIdx.

A three-candle bottom-reversal pattern: a long black candle, a small-bodied star gapping down, then a white candle closing well up into the first candle's body. Bullish reversal signal. A hit signals a bullish reversal (most meaningful after a downtrend, which the code does not check).

Formula and more info at https://ta-lib.org/functions/cdlmorningstar.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInPenetration: Fraction of the 1st candle's body the 3rd close must exceed above the 1st close; larger = deeper penetration required. Default 0.3; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the morning star is detected, 0 otherwise. Never negative (pattern is exclusively bullish)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLMORNINGSTARLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLMORNINGSTAR(0, len(open)-1, open, high, low, close, 0.3, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDLMORNINGSTARDisplayShift

func (c *Core) CDLMORNINGSTARDisplayShift(optInPenetration float64, outputIdx int) (int, error)

CDLMORNINGSTARDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLMORNINGSTAR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CDLMORNINGSTAR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CDLMORNINGSTARLookback rejects or an index that names no output.

func (*Core) CDLMORNINGSTARLookback

func (c *Core) CDLMORNINGSTARLookback(optInPenetration float64) (int, error)

CDLMORNINGSTARLookback returns how many leading bars Core.CDLMORNINGSTAR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CDLMORNINGSTAR and returns BadParam for one out of range.

func (*Core) CDLMORNINGSTAROpen

func (c *Core) CDLMORNINGSTAROpen(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64) (*CDLMORNINGSTARStream, int32, error)

CDLMORNINGSTAROpen opens a live CDLMORNINGSTARStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLMORNINGSTAR writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.CDLMORNINGSTAR.

The error is InsufficientHistory for a history of at most Core.CDLMORNINGSTARLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CDLMORNINGSTAROpenAndFill

func (c *Core) CDLMORNINGSTAROpenAndFill(inOpen, inHigh, inLow, inClose []float64, optInPenetration float64, outInteger []int32) (*CDLMORNINGSTARStream, OutRange, error)

CDLMORNINGSTAROpenAndFill opens a stream as Core.CDLMORNINGSTAROpen does and also writes the outputs over the whole history, as Core.CDLMORNINGSTAR writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLMORNINGSTARLookback values and share no memory with an input or another output.

The errors are those of Core.CDLMORNINGSTAROpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLONNECK

func (c *Core) CDLONNECK(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLONNECK recognizes the On-Neck pattern over bars startIdx through endIdx.

A two-candle on-neck pattern: a long black candle followed by a white candle that opens below the prior candle's low and closes right at that low. Bearish continuation signal. A hit is bearish (bearish continuation); the code does not verify the assumed prior downtrend.

Formula and more info at https://ta-lib.org/functions/cdlonneck.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 on a match, 0 otherwise. Only -100 is ever emitted (never +100); on-neck is always bearish.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLONNECKLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLONNECK(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLONNECKDisplayShift

func (c *Core) CDLONNECKDisplayShift(outputIdx int) (int, error)

CDLONNECKDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLONNECK. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLONNECK, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLONNECKLookback

func (c *Core) CDLONNECKLookback() (int, error)

CDLONNECKLookback returns how many leading bars Core.CDLONNECK consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLONNECKOpen

func (c *Core) CDLONNECKOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLONNECKStream, int32, error)

CDLONNECKOpen opens a live CDLONNECKStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLONNECK writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLONNECKLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLONNECKOpenAndFill

func (c *Core) CDLONNECKOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLONNECKStream, OutRange, error)

CDLONNECKOpenAndFill opens a stream as Core.CDLONNECKOpen does and also writes the outputs over the whole history, as Core.CDLONNECK writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLONNECKLookback values and share no memory with an input or another output.

The errors are those of Core.CDLONNECKOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLPIERCING

func (c *Core) CDLPIERCING(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLPIERCING recognizes the Piercing pattern over bars startIdx through endIdx.

Two-candle pattern: a long black candle followed by a long white candle that opens below the prior low and closes back above the midpoint of the prior black body. Bullish reversal signal. A hit (+100) is a bullish reversal signal.

Formula and more info at https://ta-lib.org/functions/cdlpiercing.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the piercing pattern is detected; 0 otherwise. Always bullish, never emits -100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLPIERCINGLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLPIERCING(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLPIERCINGDisplayShift

func (c *Core) CDLPIERCINGDisplayShift(outputIdx int) (int, error)

CDLPIERCINGDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLPIERCING. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLPIERCING, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLPIERCINGLookback

func (c *Core) CDLPIERCINGLookback() (int, error)

CDLPIERCINGLookback returns how many leading bars Core.CDLPIERCING consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLPIERCINGOpen

func (c *Core) CDLPIERCINGOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLPIERCINGStream, int32, error)

CDLPIERCINGOpen opens a live CDLPIERCINGStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLPIERCING writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLPIERCINGLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLPIERCINGOpenAndFill

func (c *Core) CDLPIERCINGOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLPIERCINGStream, OutRange, error)

CDLPIERCINGOpenAndFill opens a stream as Core.CDLPIERCINGOpen does and also writes the outputs over the whole history, as Core.CDLPIERCING writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLPIERCINGLookback values and share no memory with an input or another output.

The errors are those of Core.CDLPIERCINGOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLRICKSHAWMAN

func (c *Core) CDLRICKSHAWMAN(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLRICKSHAWMAN recognizes the Rickshaw Man pattern over bars startIdx through endIdx.

Single-candle doji with two long shadows whose body sits near the midpoint of the high-low range. It is a neutral indecision signal, not a directional (bullish/bearish) reversal. A hit marks market indecision/uncertainty; neutral, neither bullish nor bearish.

Formula and more info at https://ta-lib.org/functions/cdlrickshawman.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the pattern is present, 0 otherwise. Never -100; the positive value does not imply bullish, it signals uncertainty.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLRICKSHAWMANLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLRICKSHAWMAN(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [0, ..., 0]

func (*Core) CDLRICKSHAWMANDisplayShift

func (c *Core) CDLRICKSHAWMANDisplayShift(outputIdx int) (int, error)

CDLRICKSHAWMANDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLRICKSHAWMAN. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLRICKSHAWMAN, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLRICKSHAWMANLookback

func (c *Core) CDLRICKSHAWMANLookback() (int, error)

CDLRICKSHAWMANLookback returns how many leading bars Core.CDLRICKSHAWMAN consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLRICKSHAWMANOpen

func (c *Core) CDLRICKSHAWMANOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLRICKSHAWMANStream, int32, error)

CDLRICKSHAWMANOpen opens a live CDLRICKSHAWMANStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLRICKSHAWMAN writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLRICKSHAWMANLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLRICKSHAWMANOpenAndFill

func (c *Core) CDLRICKSHAWMANOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLRICKSHAWMANStream, OutRange, error)

CDLRICKSHAWMANOpenAndFill opens a stream as Core.CDLRICKSHAWMANOpen does and also writes the outputs over the whole history, as Core.CDLRICKSHAWMAN writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLRICKSHAWMANLookback values and share no memory with an input or another output.

The errors are those of Core.CDLRICKSHAWMANOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLRISEFALL3METHODS

func (c *Core) CDLRISEFALL3METHODS(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLRISEFALL3METHODS recognizes the Rising/Falling Three Methods pattern over bars startIdx through endIdx.

A five-candle continuation pattern: a long candle, three small counter-color candles that stay partly within the first candle's high-low range, then a long same-color candle that resumes the trend. Bullish (rising) or bearish (falling) continuation signal.

Formula and more info at https://ta-lib.org/functions/cdlrisefall3methods.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when candle 1 is white (rising/bullish continuation), -100 when candle 1 is black (falling/bearish continuation), 0 otherwise. Sign = 100 * color of candle 1.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLRISEFALL3METHODSLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLRISEFALL3METHODS(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [0, ..., 0]

func (*Core) CDLRISEFALL3METHODSDisplayShift

func (c *Core) CDLRISEFALL3METHODSDisplayShift(outputIdx int) (int, error)

CDLRISEFALL3METHODSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLRISEFALL3METHODS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLRISEFALL3METHODS, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLRISEFALL3METHODSLookback

func (c *Core) CDLRISEFALL3METHODSLookback() (int, error)

CDLRISEFALL3METHODSLookback returns how many leading bars Core.CDLRISEFALL3METHODS consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLRISEFALL3METHODSOpen

func (c *Core) CDLRISEFALL3METHODSOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLRISEFALL3METHODSStream, int32, error)

CDLRISEFALL3METHODSOpen opens a live CDLRISEFALL3METHODSStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLRISEFALL3METHODS writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLRISEFALL3METHODSLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLRISEFALL3METHODSOpenAndFill

func (c *Core) CDLRISEFALL3METHODSOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLRISEFALL3METHODSStream, OutRange, error)

CDLRISEFALL3METHODSOpenAndFill opens a stream as Core.CDLRISEFALL3METHODSOpen does and also writes the outputs over the whole history, as Core.CDLRISEFALL3METHODS writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLRISEFALL3METHODSLookback values and share no memory with an input or another output.

The errors are those of Core.CDLRISEFALL3METHODSOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLSEPARATINGLINES

func (c *Core) CDLSEPARATINGLINES(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLSEPARATINGLINES recognizes the Separating Lines pattern over bars startIdx through endIdx.

A two-candle continuation pattern: the second candle opposes the first in color, opens at the same price as the first, and is a long-bodied belt hold. Bullish (white second candle) or bearish (black second candle) continuation signal.

Formula and more info at https://ta-lib.org/functions/cdlseparatinglines.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 for a bullish (white second candle) hit, -100 for a bearish (black second candle) hit, 0 otherwise.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLSEPARATINGLINESLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLSEPARATINGLINES(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLSEPARATINGLINESDisplayShift

func (c *Core) CDLSEPARATINGLINESDisplayShift(outputIdx int) (int, error)

CDLSEPARATINGLINESDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLSEPARATINGLINES. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLSEPARATINGLINES, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLSEPARATINGLINESLookback

func (c *Core) CDLSEPARATINGLINESLookback() (int, error)

CDLSEPARATINGLINESLookback returns how many leading bars Core.CDLSEPARATINGLINES consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLSEPARATINGLINESOpen

func (c *Core) CDLSEPARATINGLINESOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLSEPARATINGLINESStream, int32, error)

CDLSEPARATINGLINESOpen opens a live CDLSEPARATINGLINESStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLSEPARATINGLINES writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLSEPARATINGLINESLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLSEPARATINGLINESOpenAndFill

func (c *Core) CDLSEPARATINGLINESOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLSEPARATINGLINESStream, OutRange, error)

CDLSEPARATINGLINESOpenAndFill opens a stream as Core.CDLSEPARATINGLINESOpen does and also writes the outputs over the whole history, as Core.CDLSEPARATINGLINES writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLSEPARATINGLINESLookback values and share no memory with an input or another output.

The errors are those of Core.CDLSEPARATINGLINESOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLSHOOTINGSTAR

func (c *Core) CDLSHOOTINGSTAR(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLSHOOTINGSTAR recognizes the Shooting Star pattern over bars startIdx through endIdx.

Single-candle pattern: a small real body with a long upper shadow and little-to-no lower shadow that gaps up from the prior candle's real body. Bearish reversal signal. A hit (-100) flags a bearish reversal at the top of an uptrend.

Formula and more info at https://ta-lib.org/functions/cdlshootingstar.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 when the shooting star is detected, 0 otherwise. Only ever emits negative (bearish); never +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLSHOOTINGSTARLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLSHOOTINGSTAR(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLSHOOTINGSTARDisplayShift

func (c *Core) CDLSHOOTINGSTARDisplayShift(outputIdx int) (int, error)

CDLSHOOTINGSTARDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLSHOOTINGSTAR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLSHOOTINGSTAR, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLSHOOTINGSTARLookback

func (c *Core) CDLSHOOTINGSTARLookback() (int, error)

CDLSHOOTINGSTARLookback returns how many leading bars Core.CDLSHOOTINGSTAR consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLSHOOTINGSTAROpen

func (c *Core) CDLSHOOTINGSTAROpen(inOpen, inHigh, inLow, inClose []float64) (*CDLSHOOTINGSTARStream, int32, error)

CDLSHOOTINGSTAROpen opens a live CDLSHOOTINGSTARStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLSHOOTINGSTAR writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLSHOOTINGSTARLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLSHOOTINGSTAROpenAndFill

func (c *Core) CDLSHOOTINGSTAROpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLSHOOTINGSTARStream, OutRange, error)

CDLSHOOTINGSTAROpenAndFill opens a stream as Core.CDLSHOOTINGSTAROpen does and also writes the outputs over the whole history, as Core.CDLSHOOTINGSTAR writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLSHOOTINGSTARLookback values and share no memory with an input or another output.

The errors are those of Core.CDLSHOOTINGSTAROpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLSHORTLINE

func (c *Core) CDLSHORTLINE(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLSHORTLINE recognizes the Short Line Candle pattern over bars startIdx through endIdx.

Single-candle pattern: a short real body with short upper and lower shadows (a small-range candle). Not a directional signal — the output sign encodes candle color, not bullish/bearish sentiment.

Formula and more info at https://ta-lib.org/functions/cdlshortline.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 for a matching white candle (close>=open), -100 for a matching black candle (close<open), 0 when no pattern. Sign is candle color, NOT bullish/bearish.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLSHORTLINELookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLSHORTLINE(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [0, ..., 0]

func (*Core) CDLSHORTLINEDisplayShift

func (c *Core) CDLSHORTLINEDisplayShift(outputIdx int) (int, error)

CDLSHORTLINEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLSHORTLINE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLSHORTLINE, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLSHORTLINELookback

func (c *Core) CDLSHORTLINELookback() (int, error)

CDLSHORTLINELookback returns how many leading bars Core.CDLSHORTLINE consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLSHORTLINEOpen

func (c *Core) CDLSHORTLINEOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLSHORTLINEStream, int32, error)

CDLSHORTLINEOpen opens a live CDLSHORTLINEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLSHORTLINE writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLSHORTLINELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLSHORTLINEOpenAndFill

func (c *Core) CDLSHORTLINEOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLSHORTLINEStream, OutRange, error)

CDLSHORTLINEOpenAndFill opens a stream as Core.CDLSHORTLINEOpen does and also writes the outputs over the whole history, as Core.CDLSHORTLINE writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLSHORTLINELookback values and share no memory with an input or another output.

The errors are those of Core.CDLSHORTLINEOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLSPINNINGTOP

func (c *Core) CDLSPINNINGTOP(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLSPINNINGTOP recognizes the Spinning Top pattern over bars startIdx through endIdx.

Single-candle pattern: a small real body with both an upper and a lower shadow longer than the body. Signals indecision; the code does not classify it as bullish or bearish.

Formula and more info at https://ta-lib.org/functions/cdlspinningtop.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the candle is white (close>=open), -100 when black (close<open), 0 when no pattern. Sign is candle color, NOT bullish/bearish.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLSPINNINGTOPLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLSPINNINGTOP(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [-100, ..., 0]

func (*Core) CDLSPINNINGTOPDisplayShift

func (c *Core) CDLSPINNINGTOPDisplayShift(outputIdx int) (int, error)

CDLSPINNINGTOPDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLSPINNINGTOP. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLSPINNINGTOP, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLSPINNINGTOPLookback

func (c *Core) CDLSPINNINGTOPLookback() (int, error)

CDLSPINNINGTOPLookback returns how many leading bars Core.CDLSPINNINGTOP consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLSPINNINGTOPOpen

func (c *Core) CDLSPINNINGTOPOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLSPINNINGTOPStream, int32, error)

CDLSPINNINGTOPOpen opens a live CDLSPINNINGTOPStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLSPINNINGTOP writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLSPINNINGTOPLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLSPINNINGTOPOpenAndFill

func (c *Core) CDLSPINNINGTOPOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLSPINNINGTOPStream, OutRange, error)

CDLSPINNINGTOPOpenAndFill opens a stream as Core.CDLSPINNINGTOPOpen does and also writes the outputs over the whole history, as Core.CDLSPINNINGTOP writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLSPINNINGTOPLookback values and share no memory with an input or another output.

The errors are those of Core.CDLSPINNINGTOPOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLSTALLEDPATTERN

func (c *Core) CDLSTALLEDPATTERN(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLSTALLEDPATTERN recognizes the Stalled pattern over bars startIdx through endIdx.

A three-candle pattern of three white candles with consecutively higher closes where the third loses momentum (a small body riding on the shoulder of the second's long body). It is a bearish reversal signal of a stalling advance. A hit (-100) is bearish: the uptrend is stalling and may reverse.

Formula and more info at https://ta-lib.org/functions/cdlstalledpattern.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 when the pattern is detected (always bearish), 0 otherwise. Never emits +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLSTALLEDPATTERNLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLSTALLEDPATTERN(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDLSTALLEDPATTERNDisplayShift

func (c *Core) CDLSTALLEDPATTERNDisplayShift(outputIdx int) (int, error)

CDLSTALLEDPATTERNDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLSTALLEDPATTERN. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLSTALLEDPATTERN, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLSTALLEDPATTERNLookback

func (c *Core) CDLSTALLEDPATTERNLookback() (int, error)

CDLSTALLEDPATTERNLookback returns how many leading bars Core.CDLSTALLEDPATTERN consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLSTALLEDPATTERNOpen

func (c *Core) CDLSTALLEDPATTERNOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLSTALLEDPATTERNStream, int32, error)

CDLSTALLEDPATTERNOpen opens a live CDLSTALLEDPATTERNStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLSTALLEDPATTERN writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLSTALLEDPATTERNLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLSTALLEDPATTERNOpenAndFill

func (c *Core) CDLSTALLEDPATTERNOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLSTALLEDPATTERNStream, OutRange, error)

CDLSTALLEDPATTERNOpenAndFill opens a stream as Core.CDLSTALLEDPATTERNOpen does and also writes the outputs over the whole history, as Core.CDLSTALLEDPATTERN writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLSTALLEDPATTERNLookback values and share no memory with an input or another output.

The errors are those of Core.CDLSTALLEDPATTERNOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLSTICKSANDWICH

func (c *Core) CDLSTICKSANDWICH(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLSTICKSANDWICH recognizes the Stick Sandwich pattern over bars startIdx through endIdx.

A three-candle bullish reversal pattern: two black candles (1st and 3rd) sandwiching a white candle, where the 3rd black candle closes at the same level as the 1st (the "bread"). A hit signals a bullish reversal (significant in a downtrend, which the function does not verify).

Formula and more info at https://ta-lib.org/functions/cdlsticksandwich.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the pattern is present, 0 otherwise. Never -100 — Stick Sandwich is always bullish.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLSTICKSANDWICHLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLSTICKSANDWICH(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
245 values from bar 7: [0, ..., 0]

func (*Core) CDLSTICKSANDWICHDisplayShift

func (c *Core) CDLSTICKSANDWICHDisplayShift(outputIdx int) (int, error)

CDLSTICKSANDWICHDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLSTICKSANDWICH. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLSTICKSANDWICH, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLSTICKSANDWICHLookback

func (c *Core) CDLSTICKSANDWICHLookback() (int, error)

CDLSTICKSANDWICHLookback returns how many leading bars Core.CDLSTICKSANDWICH consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLSTICKSANDWICHOpen

func (c *Core) CDLSTICKSANDWICHOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLSTICKSANDWICHStream, int32, error)

CDLSTICKSANDWICHOpen opens a live CDLSTICKSANDWICHStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLSTICKSANDWICH writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLSTICKSANDWICHLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLSTICKSANDWICHOpenAndFill

func (c *Core) CDLSTICKSANDWICHOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLSTICKSANDWICHStream, OutRange, error)

CDLSTICKSANDWICHOpenAndFill opens a stream as Core.CDLSTICKSANDWICHOpen does and also writes the outputs over the whole history, as Core.CDLSTICKSANDWICH writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLSTICKSANDWICHLookback values and share no memory with an input or another output.

The errors are those of Core.CDLSTICKSANDWICHOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLTAKURI

func (c *Core) CDLTAKURI(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLTAKURI recognizes the Takuri (Dragonfly Doji with very long lower shadow) pattern over bars startIdx through endIdx.

Single-candle pattern: a doji whose open and close sit at the high (no/very short upper shadow) with a very long lower shadow, i.e. a dragonfly doji with an exceptionally long lower shadow. Emitted as a positive signal, but its directional meaning depends on the prevailing trend, which the code does not check. A hit marks a takuri (dragonfly-doji) line; a potential reversal only when read against the trend (typically a bottom/bullish reversal after a downtrend), which the code itself does not verify.

Formula and more info at https://ta-lib.org/functions/cdltakuri.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the takuri pattern is detected, 0 otherwise. Never negative; the positive sign is a convention and does not by itself imply bullishness.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLTAKURILookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLTAKURI(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [0, ..., 0]

func (*Core) CDLTAKURIDisplayShift

func (c *Core) CDLTAKURIDisplayShift(outputIdx int) (int, error)

CDLTAKURIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLTAKURI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLTAKURI, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLTAKURILookback

func (c *Core) CDLTAKURILookback() (int, error)

CDLTAKURILookback returns how many leading bars Core.CDLTAKURI consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLTAKURIOpen

func (c *Core) CDLTAKURIOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLTAKURIStream, int32, error)

CDLTAKURIOpen opens a live CDLTAKURIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLTAKURI writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLTAKURILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLTAKURIOpenAndFill

func (c *Core) CDLTAKURIOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLTAKURIStream, OutRange, error)

CDLTAKURIOpenAndFill opens a stream as Core.CDLTAKURIOpen does and also writes the outputs over the whole history, as Core.CDLTAKURI writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLTAKURILookback values and share no memory with an input or another output.

The errors are those of Core.CDLTAKURIOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLTASUKIGAP

func (c *Core) CDLTASUKIGAP(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLTASUKIGAP recognizes the Tasuki Gap pattern over bars startIdx through endIdx.

A three-candle pattern: a real-body-gapping candle followed by an opposite-color candle that opens inside its body and closes back into the gap without filling it. An upside gap is a bullish continuation signal; a downside gap is a bearish continuation signal.

Formula and more info at https://ta-lib.org/functions/cdltasukigap.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 on a bullish (upside-gap) tasuki gap, -100 on a bearish (downside-gap) tasuki gap, 0 otherwise. Sign equals the color of the gap candle i-1 (candlecolor(i-1)*100)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLTASUKIGAPLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLTASUKIGAP(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
245 values from bar 7: [0, ..., 0]

func (*Core) CDLTASUKIGAPDisplayShift

func (c *Core) CDLTASUKIGAPDisplayShift(outputIdx int) (int, error)

CDLTASUKIGAPDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLTASUKIGAP. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLTASUKIGAP, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLTASUKIGAPLookback

func (c *Core) CDLTASUKIGAPLookback() (int, error)

CDLTASUKIGAPLookback returns how many leading bars Core.CDLTASUKIGAP consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLTASUKIGAPOpen

func (c *Core) CDLTASUKIGAPOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLTASUKIGAPStream, int32, error)

CDLTASUKIGAPOpen opens a live CDLTASUKIGAPStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLTASUKIGAP writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLTASUKIGAPLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLTASUKIGAPOpenAndFill

func (c *Core) CDLTASUKIGAPOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLTASUKIGAPStream, OutRange, error)

CDLTASUKIGAPOpenAndFill opens a stream as Core.CDLTASUKIGAPOpen does and also writes the outputs over the whole history, as Core.CDLTASUKIGAP writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLTASUKIGAPLookback values and share no memory with an input or another output.

The errors are those of Core.CDLTASUKIGAPOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLTHRUSTING

func (c *Core) CDLTHRUSTING(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLTHRUSTING recognizes the Thrusting pattern over bars startIdx through endIdx.

A two-candle pattern: a long black candle followed by a white candle that opens below the prior low and closes back into the prior body but below its midpoint. It is a bearish continuation signal. A hit is bearish: the failed white push back into the black body signals continuation of the down move.

Formula and more info at https://ta-lib.org/functions/cdlthrusting.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 when the pattern is detected, 0 otherwise. Always bearish; never emits +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLTHRUSTINGLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLTHRUSTING(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
241 values from bar 11: [0, ..., 0]

func (*Core) CDLTHRUSTINGDisplayShift

func (c *Core) CDLTHRUSTINGDisplayShift(outputIdx int) (int, error)

CDLTHRUSTINGDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLTHRUSTING. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLTHRUSTING, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLTHRUSTINGLookback

func (c *Core) CDLTHRUSTINGLookback() (int, error)

CDLTHRUSTINGLookback returns how many leading bars Core.CDLTHRUSTING consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLTHRUSTINGOpen

func (c *Core) CDLTHRUSTINGOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLTHRUSTINGStream, int32, error)

CDLTHRUSTINGOpen opens a live CDLTHRUSTINGStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLTHRUSTING writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLTHRUSTINGLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLTHRUSTINGOpenAndFill

func (c *Core) CDLTHRUSTINGOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLTHRUSTINGStream, OutRange, error)

CDLTHRUSTINGOpenAndFill opens a stream as Core.CDLTHRUSTINGOpen does and also writes the outputs over the whole history, as Core.CDLTHRUSTING writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLTHRUSTINGLookback values and share no memory with an input or another output.

The errors are those of Core.CDLTHRUSTINGOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLTRISTAR

func (c *Core) CDLTRISTAR(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLTRISTAR recognizes the Tristar pattern over bars startIdx through endIdx.

A three-candle pattern of three consecutive doji where the middle doji is a star (its body gaps away from the first). Bullish or bearish reversal signal.

Formula and more info at https://ta-lib.org/functions/cdltristar.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 (bullish, star gapped down), -100 (bearish, star gapped up), or 0 when no pattern. Both signs are emitted.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLTRISTARLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLTRISTAR(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDLTRISTARDisplayShift

func (c *Core) CDLTRISTARDisplayShift(outputIdx int) (int, error)

CDLTRISTARDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLTRISTAR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLTRISTAR, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLTRISTARLookback

func (c *Core) CDLTRISTARLookback() (int, error)

CDLTRISTARLookback returns how many leading bars Core.CDLTRISTAR consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLTRISTAROpen

func (c *Core) CDLTRISTAROpen(inOpen, inHigh, inLow, inClose []float64) (*CDLTRISTARStream, int32, error)

CDLTRISTAROpen opens a live CDLTRISTARStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLTRISTAR writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLTRISTARLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLTRISTAROpenAndFill

func (c *Core) CDLTRISTAROpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLTRISTARStream, OutRange, error)

CDLTRISTAROpenAndFill opens a stream as Core.CDLTRISTAROpen does and also writes the outputs over the whole history, as Core.CDLTRISTAR writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLTRISTARLookback values and share no memory with an input or another output.

The errors are those of Core.CDLTRISTAROpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLUNIQUE3RIVER

func (c *Core) CDLUNIQUE3RIVER(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLUNIQUE3RIVER recognizes the Unique 3 River pattern over bars startIdx through endIdx.

A three-candle bullish reversal pattern: a long black candle, then a black harami candle that makes a lower low, then a small white candle. Signals a potential bullish reversal, ideally in a downtrend (trend not checked by the code). A hit (+100) marks a bullish reversal; significant in a downtrend, which the function does not verify.

Formula and more info at https://ta-lib.org/functions/cdlunique3river.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the pattern is present, 0 otherwise. Bullish-only: never emits -100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLUNIQUE3RIVERLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLUNIQUE3RIVER(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDLUNIQUE3RIVERDisplayShift

func (c *Core) CDLUNIQUE3RIVERDisplayShift(outputIdx int) (int, error)

CDLUNIQUE3RIVERDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLUNIQUE3RIVER. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLUNIQUE3RIVER, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLUNIQUE3RIVERLookback

func (c *Core) CDLUNIQUE3RIVERLookback() (int, error)

CDLUNIQUE3RIVERLookback returns how many leading bars Core.CDLUNIQUE3RIVER consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLUNIQUE3RIVEROpen

func (c *Core) CDLUNIQUE3RIVEROpen(inOpen, inHigh, inLow, inClose []float64) (*CDLUNIQUE3RIVERStream, int32, error)

CDLUNIQUE3RIVEROpen opens a live CDLUNIQUE3RIVERStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLUNIQUE3RIVER writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLUNIQUE3RIVERLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLUNIQUE3RIVEROpenAndFill

func (c *Core) CDLUNIQUE3RIVEROpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLUNIQUE3RIVERStream, OutRange, error)

CDLUNIQUE3RIVEROpenAndFill opens a stream as Core.CDLUNIQUE3RIVEROpen does and also writes the outputs over the whole history, as Core.CDLUNIQUE3RIVER writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLUNIQUE3RIVERLookback values and share no memory with an input or another output.

The errors are those of Core.CDLUNIQUE3RIVEROpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLUPSIDEGAP2CROWS

func (c *Core) CDLUPSIDEGAP2CROWS(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLUPSIDEGAP2CROWS recognizes the Upside Gap Two Crows pattern over bars startIdx through endIdx.

A three-candle bearish reversal pattern: a long white candle, then a small black candle gapping up (a gap between the real bodies), then a black candle that engulfs the second candle's real body but still closes above the first candle's close. Signals a bearish reversal. A hit (-100) is a bearish reversal signal, most meaningful in an uptrend.

Formula and more info at https://ta-lib.org/functions/cdlupsidegap2crows.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: -100 on a pattern bar, 0 otherwise. Bearish-only: this pattern never emits +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLUPSIDEGAP2CROWSLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLUPSIDEGAP2CROWS(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0, ..., 0]

func (*Core) CDLUPSIDEGAP2CROWSDisplayShift

func (c *Core) CDLUPSIDEGAP2CROWSDisplayShift(outputIdx int) (int, error)

CDLUPSIDEGAP2CROWSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLUPSIDEGAP2CROWS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLUPSIDEGAP2CROWS, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLUPSIDEGAP2CROWSLookback

func (c *Core) CDLUPSIDEGAP2CROWSLookback() (int, error)

CDLUPSIDEGAP2CROWSLookback returns how many leading bars Core.CDLUPSIDEGAP2CROWS consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLUPSIDEGAP2CROWSOpen

func (c *Core) CDLUPSIDEGAP2CROWSOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLUPSIDEGAP2CROWSStream, int32, error)

CDLUPSIDEGAP2CROWSOpen opens a live CDLUPSIDEGAP2CROWSStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLUPSIDEGAP2CROWS writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLUPSIDEGAP2CROWSLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLUPSIDEGAP2CROWSOpenAndFill

func (c *Core) CDLUPSIDEGAP2CROWSOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLUPSIDEGAP2CROWSStream, OutRange, error)

CDLUPSIDEGAP2CROWSOpenAndFill opens a stream as Core.CDLUPSIDEGAP2CROWSOpen does and also writes the outputs over the whole history, as Core.CDLUPSIDEGAP2CROWS writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLUPSIDEGAP2CROWSLookback values and share no memory with an input or another output.

The errors are those of Core.CDLUPSIDEGAP2CROWSOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CDLXSIDEGAP3METHODS

func (c *Core) CDLXSIDEGAP3METHODS(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (OutRange, error)

CDLXSIDEGAP3METHODS recognizes the Upside/Downside Gap Three Methods pattern over bars startIdx through endIdx.

A three-candle continuation pattern: two same-color candles separated by a real-body gap, followed by an opposite-color candle that fills into the gap. Bullish (upside) when the first two candles are white, bearish (downside) when they are black.

Formula and more info at https://ta-lib.org/functions/cdlxsidegap3methods.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: +100 when the two same-color candles are white (bullish/upside continuation), -100 when black (bearish/downside continuation), 0 otherwise. Equals candlecolor(1st candle) * 100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CDLXSIDEGAP3METHODSLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.CDLXSIDEGAP3METHODS(0, len(open)-1, open, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
250 values from bar 2: [0, ..., 0]

func (*Core) CDLXSIDEGAP3METHODSDisplayShift

func (c *Core) CDLXSIDEGAP3METHODSDisplayShift(outputIdx int) (int, error)

CDLXSIDEGAP3METHODSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CDLXSIDEGAP3METHODS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CDLXSIDEGAP3METHODS, from 0, and returns BadParam for an index that names no output.

func (*Core) CDLXSIDEGAP3METHODSLookback

func (c *Core) CDLXSIDEGAP3METHODSLookback() (int, error)

CDLXSIDEGAP3METHODSLookback returns how many leading bars Core.CDLXSIDEGAP3METHODS consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CDLXSIDEGAP3METHODSOpen

func (c *Core) CDLXSIDEGAP3METHODSOpen(inOpen, inHigh, inLow, inClose []float64) (*CDLXSIDEGAP3METHODSStream, int32, error)

CDLXSIDEGAP3METHODSOpen opens a live CDLXSIDEGAP3METHODSStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CDLXSIDEGAP3METHODS writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CDLXSIDEGAP3METHODSLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CDLXSIDEGAP3METHODSOpenAndFill

func (c *Core) CDLXSIDEGAP3METHODSOpenAndFill(inOpen, inHigh, inLow, inClose []float64, outInteger []int32) (*CDLXSIDEGAP3METHODSStream, OutRange, error)

CDLXSIDEGAP3METHODSOpenAndFill opens a stream as Core.CDLXSIDEGAP3METHODSOpen does and also writes the outputs over the whole history, as Core.CDLXSIDEGAP3METHODS writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.CDLXSIDEGAP3METHODSLookback values and share no memory with an input or another output.

The errors are those of Core.CDLXSIDEGAP3METHODSOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) CE

func (c *Core) CE(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, optInMultiplier float64, outRealLong, outRealShort []float64) (OutRange, error)

CE computes the Chandelier Exit over bars startIdx through endIdx.

Le Beau's Chandelier Exit, a two-line volatility stop. The highest high of the window is offset down, and the lowest low up, by a multiple of the Average True Range, so each line hangs from the recent extreme at a distance that widens as the true range grows. The long line is the exit for a long position and hangs below the recent highs; the short line is the mirror for a short position, above the recent lows.

Formula and more info at https://ta-lib.org/functions/ce.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Window of the highest high and lowest low, and smoothing period of the Average True Range. Default 22; range 2 to 100000; IntegerDefault selects the default.
  • optInMultiplier: Multiplier applied to the Average True Range to offset the lines. Default 3; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outRealLong: Highest high less the multiple of the Average True Range; the stop for a long position.
  • outRealShort: Lowest low plus the multiple of the Average True Range; the stop for a short position.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CELookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	outLong := make([]float64, 252)
	outShort := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CE(0, len(high)-1, high, low, close, 22, 3, outLong, outShort)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("outLong = [%.4f, ..., %.4f]\n", outLong[0], outLong[r.NBElement-1])
	fmt.Printf("outShort = [%.4f, ..., %.4f]\n", outShort[0], outShort[r.NBElement-1])
}
Output:
230 values from bar 22:
outLong = [95.7955, ..., 95.1192]
outShort = [103.2545, ..., 108.7308]

func (*Core) CEDisplayShift

func (c *Core) CEDisplayShift(optInTimePeriod int, optInMultiplier float64, outputIdx int) (int, error)

CEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CE followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CELookback rejects or an index that names no output.

func (*Core) CEIL

func (c *Core) CEIL(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

CEIL computes the Vector Ceil over bars startIdx through endIdx.

Element-wise ceiling (round up to the nearest integer) of the input series.

Formula and more info at https://ta-lib.org/functions/ceil.

Inputs, each at least endIdx+1 long:

  • inReal: Input values.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Each input rounded up to nearest integer.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CEILLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = -3 + 6*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CEIL(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [-3.0000, ..., 3.0000]

func (*Core) CEILDisplayShift

func (c *Core) CEILDisplayShift(outputIdx int) (int, error)

CEILDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CEIL. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CEIL, from 0, and returns BadParam for an index that names no output.

func (*Core) CEILLookback

func (c *Core) CEILLookback() (int, error)

CEILLookback returns how many leading bars Core.CEIL consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CEILOpen

func (c *Core) CEILOpen(inReal []float64) (*CEILStream, float64, error)

CEILOpen opens a live CEILStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CEIL writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.CEILLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) CEILOpenAndFill

func (c *Core) CEILOpenAndFill(inReal, outReal []float64) (*CEILStream, OutRange, error)

CEILOpenAndFill opens a stream as Core.CEILOpen does and also writes the outputs over the whole history, as Core.CEIL writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.CEILLookback values and share no memory with an input or another output.

The errors are those of Core.CEILOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CELookback

func (c *Core) CELookback(optInTimePeriod int, optInMultiplier float64) (int, error)

CELookback returns how many leading bars Core.CE consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CE and returns BadParam for one out of range.

func (*Core) CEOpen

func (c *Core) CEOpen(inHigh, inLow, inClose []float64, optInTimePeriod int, optInMultiplier float64) (*CEStream, float64, float64, error)

CEOpen opens a live CEStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outRealLong and outRealShort), the values Core.CE writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.CE.

The error is InsufficientHistory for a history of at most Core.CELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CEOpenAndFill

func (c *Core) CEOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, optInMultiplier float64, outRealLong, outRealShort []float64) (*CEStream, OutRange, error)

CEOpenAndFill opens a stream as Core.CEOpen does and also writes the outputs over the whole history, as Core.CE writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.CELookback values and share no memory with an input or another output.

The errors are those of Core.CEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CG

func (c *Core) CG(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

CG computes the Center of Gravity Oscillator over bars startIdx through endIdx.

John Ehlers' Center of Gravity oscillator: the balance point of the last optInTimePeriod values, each weighted by its value and placed at its position counting back from the current bar, which is position 1, negated so that it rises with price. It is smooth and has essentially no lag. Ehlers reads turning points from it and trades its crossings with a copy of itself delayed by one bar. For a positive series it stays between -optInTimePeriod and -1, and a flat window sits at the midpoint, -(optInTimePeriod+1)/2.

Formula and more info at https://ta-lib.org/functions/cg.

Inputs, each at least endIdx+1 long:

  • inReal: The series to measure.

Parameters:

  • optInTimePeriod: Number of bars in the window. Default 10; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Negated center of gravity of the window.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CGLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CG(0, len(series)-1, series, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
243 values from bar 9: [-5.6248, ..., -5.6119]

func (*Core) CGDisplayShift

func (c *Core) CGDisplayShift(optInTimePeriod, outputIdx int) (int, error)

CGDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CG. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CG followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CGLookback rejects or an index that names no output.

func (*Core) CGLookback

func (c *Core) CGLookback(optInTimePeriod int) (int, error)

CGLookback returns how many leading bars Core.CG consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CG and returns BadParam for one out of range.

func (*Core) CGOpen

func (c *Core) CGOpen(inReal []float64, optInTimePeriod int) (*CGStream, float64, error)

CGOpen opens a live CGStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CG writes there.

inReal is the history; the parameters are those of Core.CG.

The error is InsufficientHistory for a history of at most Core.CGLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) CGOpenAndFill

func (c *Core) CGOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*CGStream, OutRange, error)

CGOpenAndFill opens a stream as Core.CGOpen does and also writes the outputs over the whole history, as Core.CG writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.CGLookback values and share no memory with an input or another output.

The errors are those of Core.CGOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CHOP

func (c *Core) CHOP(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

CHOP computes the Choppiness Index over bars startIdx through endIdx.

Choppiness Index: a trend-versus-consolidation gauge, the true range travelled over a window against the height of the box its bars span. Devised by Bill Dreiss. Log-scaled so that a straight run reads 0 and bars that each fill the whole box read 100. Like ADX and VHF it measures whether the market is trending, not in which direction: low values mean a directional run, high values sideways chop.

Formula and more info at https://ta-lib.org/functions/chop.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Number of bars in the window. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Choppiness Index value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CHOPLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CHOP(0, len(high)-1, high, low, close, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [46.3472, ..., 52.0806]

func (*Core) CHOPDisplayShift

func (c *Core) CHOPDisplayShift(optInTimePeriod, outputIdx int) (int, error)

CHOPDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CHOP. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CHOP followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CHOPLookback rejects or an index that names no output.

func (*Core) CHOPLookback

func (c *Core) CHOPLookback(optInTimePeriod int) (int, error)

CHOPLookback returns how many leading bars Core.CHOP consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CHOP and returns BadParam for one out of range.

func (*Core) CHOPOpen

func (c *Core) CHOPOpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*CHOPStream, float64, error)

CHOPOpen opens a live CHOPStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CHOP writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.CHOP.

The error is InsufficientHistory for a history of at most Core.CHOPLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CHOPOpenAndFill

func (c *Core) CHOPOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (*CHOPStream, OutRange, error)

CHOPOpenAndFill opens a stream as Core.CHOPOpen does and also writes the outputs over the whole history, as Core.CHOP writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.CHOPLookback values and share no memory with an input or another output.

The errors are those of Core.CHOPOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CHOPTR

func (c *Core) CHOPTR(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

CHOPTR computes the Choppiness Index (True Range Box) over bars startIdx through endIdx.

Choppiness Index with a true-range box: the true range travelled over a window against the span from its highest true high to its lowest true low. Bill Dreiss's form as published in 1993. Log-scaled so that a straight run reads 0 and bars that each fill the whole box read 100. Measures whether the market is trending, not in which direction: low values mean a directional run, high values sideways chop.

Formula and more info at https://ta-lib.org/functions/choptr.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Number of bars in the window. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Choppiness Index value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CHOPTRLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CHOPTR(0, len(high)-1, high, low, close, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [45.8508, ..., 52.0806]

func (*Core) CHOPTRDisplayShift

func (c *Core) CHOPTRDisplayShift(optInTimePeriod, outputIdx int) (int, error)

CHOPTRDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CHOPTR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CHOPTR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CHOPTRLookback rejects or an index that names no output.

func (*Core) CHOPTRLookback

func (c *Core) CHOPTRLookback(optInTimePeriod int) (int, error)

CHOPTRLookback returns how many leading bars Core.CHOPTR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CHOPTR and returns BadParam for one out of range.

func (*Core) CHOPTROpen

func (c *Core) CHOPTROpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*CHOPTRStream, float64, error)

CHOPTROpen opens a live CHOPTRStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CHOPTR writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.CHOPTR.

The error is InsufficientHistory for a history of at most Core.CHOPTRLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CHOPTROpenAndFill

func (c *Core) CHOPTROpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (*CHOPTRStream, OutRange, error)

CHOPTROpenAndFill opens a stream as Core.CHOPTROpen does and also writes the outputs over the whole history, as Core.CHOPTR writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.CHOPTRLookback values and share no memory with an input or another output.

The errors are those of Core.CHOPTROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CKSP

func (c *Core) CKSP(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, optInMultiplier float64, optInStopPeriod int, outHighStop, outLowStop []float64) (OutRange, error)

CKSP computes the Chande Kroll Stop over bars startIdx through endIdx.

Chande and Kroll's two-line volatility stop. The highest high is offset down, and the lowest low up, by a multiple of the Average True Range, and each line then takes the extreme of its own recent values, so it moves only when a new extreme enters the stop window or an old one leaves it. Price above both lines reads as an uptrend and price below both as a downtrend.

Formula and more info at https://ta-lib.org/functions/cksp.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Window of the highest high and lowest low, and smoothing period of the Average True Range. Default 10; range 2 to 100000; IntegerDefault selects the default.
  • optInMultiplier: Multiplier applied to the Average True Range to offset the first stops. Default 1; minimum 0; RealDefault selects the default.
  • optInStopPeriod: Window over which each first stop takes its extreme. Default 9; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outHighStop: Highest of the recent first high stops; usually plotted as the short stop.
  • outLowStop: Lowest of the recent first low stops; usually plotted as the long stop.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CKSPLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	highStop := make([]float64, 252)
	lowStop := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CKSP(0, len(high)-1, high, low, close, 10, 1, 9, highStop, lowStop)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("highStop = [%.4f, ..., %.4f]\n", highStop[0], highStop[r.NBElement-1])
	fmt.Printf("lowStop = [%.4f, ..., %.4f]\n", lowStop[0], lowStop[r.NBElement-1])
}
Output:
234 values from bar 18:
highStop = [106.3900, ..., 106.6075]
lowStop = [93.4648, ..., 97.5620]

func (*Core) CKSPDisplayShift

func (c *Core) CKSPDisplayShift(optInTimePeriod int, optInMultiplier float64, optInStopPeriod, outputIdx int) (int, error)

CKSPDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CKSP. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CKSP followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CKSPLookback rejects or an index that names no output.

func (*Core) CKSPLookback

func (c *Core) CKSPLookback(optInTimePeriod int, optInMultiplier float64, optInStopPeriod int) (int, error)

CKSPLookback returns how many leading bars Core.CKSP consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CKSP and returns BadParam for one out of range.

func (*Core) CKSPOpen

func (c *Core) CKSPOpen(inHigh, inLow, inClose []float64, optInTimePeriod int, optInMultiplier float64, optInStopPeriod int) (*CKSPStream, float64, float64, error)

CKSPOpen opens a live CKSPStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outHighStop and outLowStop), the values Core.CKSP writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.CKSP.

The error is InsufficientHistory for a history of at most Core.CKSPLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CKSPOpenAndFill

func (c *Core) CKSPOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, optInMultiplier float64, optInStopPeriod int, outHighStop, outLowStop []float64) (*CKSPStream, OutRange, error)

CKSPOpenAndFill opens a stream as Core.CKSPOpen does and also writes the outputs over the whole history, as Core.CKSP writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.CKSPLookback values and share no memory with an input or another output.

The errors are those of Core.CKSPOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CMF

func (c *Core) CMF(startIdx, endIdx int, inHigh, inLow, inClose, inVolume []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

CMF computes the Chaikin Money Flow over bars startIdx through endIdx.

Chaikin Money Flow: over a trailing window of optInTimePeriod bars, the sum of each bar's money flow volume divided by the sum of its volume. The result is a ratio in [-1, +1].

Formula and more info at https://ta-lib.org/functions/cmf.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.
  • inVolume: Volume of each bar.

Parameters:

  • optInTimePeriod: Number of bars in the window. Default 20; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Chaikin money flow, in the range -1 to +1.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CMFLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CMF(0, len(high)-1, high, low, close, volume, 20, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
233 values from bar 19: [-0.0214, ..., -0.0572]

func (*Core) CMFDisplayShift

func (c *Core) CMFDisplayShift(optInTimePeriod, outputIdx int) (int, error)

CMFDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CMF. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CMF followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CMFLookback rejects or an index that names no output.

func (*Core) CMFLookback

func (c *Core) CMFLookback(optInTimePeriod int) (int, error)

CMFLookback returns how many leading bars Core.CMF consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CMF and returns BadParam for one out of range.

func (*Core) CMFOpen

func (c *Core) CMFOpen(inHigh, inLow, inClose, inVolume []float64, optInTimePeriod int) (*CMFStream, float64, error)

CMFOpen opens a live CMFStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CMF writes there.

inHigh, inLow, inClose and inVolume are the histories, of one length; the parameters are those of Core.CMF.

The error is InsufficientHistory for a history of at most Core.CMFLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CMFOpenAndFill

func (c *Core) CMFOpenAndFill(inHigh, inLow, inClose, inVolume []float64, optInTimePeriod int, outReal []float64) (*CMFStream, OutRange, error)

CMFOpenAndFill opens a stream as Core.CMFOpen does and also writes the outputs over the whole history, as Core.CMF writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.CMFLookback values and share no memory with an input or another output.

The errors are those of Core.CMFOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CMO

func (c *Core) CMO(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

CMO computes the Chande Momentum Oscillator over bars startIdx through endIdx.

Chande Momentum Oscillator: bounded momentum measure from Wilder-smoothed average up-moves and down-moves. Identical to RSI except the numerator uses (gain-loss) instead of gain. Bounded in [-100,+100]; positive = net upward momentum, negative = net downward.

Formula and more info at https://ta-lib.org/functions/cmo.

Inputs, each at least endIdx+1 long:

  • inReal: Source price/value series.

Parameters:

  • optInTimePeriod: Bars over which gains/losses are smoothed. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: CMO oscillator value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CMOLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdCMO (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CMO(0, len(series)-1, series, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [-100.0000, ..., -30.0460]

func (*Core) CMODisplayShift

func (c *Core) CMODisplayShift(optInTimePeriod, outputIdx int) (int, error)

CMODisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CMO. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CMO followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CMOLookback rejects or an index that names no output.

func (*Core) CMOLookback

func (c *Core) CMOLookback(optInTimePeriod int) (int, error)

CMOLookback returns how many leading bars Core.CMO consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdCMO (see Core.SetUnstablePeriod).

It takes the parameters of Core.CMO and returns BadParam for one out of range.

func (*Core) CMOOpen

func (c *Core) CMOOpen(inReal []float64, optInTimePeriod int) (*CMOStream, float64, error)

CMOOpen opens a live CMOStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CMO writes there.

inReal is the history; the parameters are those of Core.CMO.

The error is InsufficientHistory for a history of at most Core.CMOLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) CMOOpenAndFill

func (c *Core) CMOOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*CMOStream, OutRange, error)

CMOOpenAndFill opens a stream as Core.CMOOpen does and also writes the outputs over the whole history, as Core.CMO writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.CMOLookback values and share no memory with an input or another output.

The errors are those of Core.CMOOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CMOU

func (c *Core) CMOU(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

CMOU computes the Chande Momentum Oscillator (Unsmoothed) over bars startIdx through endIdx.

Chande Momentum Oscillator: Tushar Chande's original momentum oscillator, computed from plain moving-window sums of the up-moves and down-moves over the period.

Formula and more info at https://ta-lib.org/functions/cmou.

Inputs, each at least endIdx+1 long:

  • inReal: Source price/value series.

Parameters:

  • optInTimePeriod: Number of trailing price changes summed. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: CMOU oscillator value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CMOULookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CMOU(0, len(series)-1, series, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [-100.0000, ..., -48.3721]

func (*Core) CMOUDisplayShift

func (c *Core) CMOUDisplayShift(optInTimePeriod, outputIdx int) (int, error)

CMOUDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CMOU. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CMOU followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CMOULookback rejects or an index that names no output.

func (*Core) CMOULookback

func (c *Core) CMOULookback(optInTimePeriod int) (int, error)

CMOULookback returns how many leading bars Core.CMOU consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CMOU and returns BadParam for one out of range.

func (*Core) CMOUOpen

func (c *Core) CMOUOpen(inReal []float64, optInTimePeriod int) (*CMOUStream, float64, error)

CMOUOpen opens a live CMOUStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CMOU writes there.

inReal is the history; the parameters are those of Core.CMOU.

The error is InsufficientHistory for a history of at most Core.CMOULookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) CMOUOpenAndFill

func (c *Core) CMOUOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*CMOUStream, OutRange, error)

CMOUOpenAndFill opens a stream as Core.CMOUOpen does and also writes the outputs over the whole history, as Core.CMOU writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.CMOULookback values and share no memory with an input or another output.

The errors are those of Core.CMOUOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) COPPOCK

func (c *Core) COPPOCK(startIdx, endIdx int, inReal []float64, optInWMAPeriod, optInROC1Period, optInROC2Period int, outReal []float64) (OutRange, error)

COPPOCK computes the Coppock Curve over bars startIdx through endIdx.

Coppock Curve: Edwin S. "Sedge" Coppock's long-term momentum oscillator (Barron's, originally published as the "Trendex Model"), computed as a weighted moving average of the sum of two rates of change.

Formula and more info at https://ta-lib.org/functions/coppock.

Inputs, each at least endIdx+1 long:

  • inReal: Source price/value series (canonically a monthly close)

Parameters:

  • optInWMAPeriod: Smoothing period for the ROC sum. Default 10; range 1 to 100000; IntegerDefault selects the default.
  • optInROC1Period: Short rate-of-change period. Default 11; range 1 to 100000; IntegerDefault selects the default.
  • optInROC2Period: Long rate-of-change period. Default 14; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Coppock Curve value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.COPPOCKLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.COPPOCK(0, len(series)-1, series, 10, 11, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
229 values from bar 23: [-15.8856, ..., -9.0582]

func (*Core) COPPOCKDisplayShift

func (c *Core) COPPOCKDisplayShift(optInWMAPeriod, optInROC1Period, optInROC2Period, outputIdx int) (int, error)

COPPOCKDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.COPPOCK. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.COPPOCK followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.COPPOCKLookback rejects or an index that names no output.

func (*Core) COPPOCKLookback

func (c *Core) COPPOCKLookback(optInWMAPeriod, optInROC1Period, optInROC2Period int) (int, error)

COPPOCKLookback returns how many leading bars Core.COPPOCK consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.COPPOCK and returns BadParam for one out of range.

func (*Core) COPPOCKOpen

func (c *Core) COPPOCKOpen(inReal []float64, optInWMAPeriod, optInROC1Period, optInROC2Period int) (*COPPOCKStream, float64, error)

COPPOCKOpen opens a live COPPOCKStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.COPPOCK writes there.

inReal is the history; the parameters are those of Core.COPPOCK.

The error is InsufficientHistory for a history of at most Core.COPPOCKLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) COPPOCKOpenAndFill

func (c *Core) COPPOCKOpenAndFill(inReal []float64, optInWMAPeriod, optInROC1Period, optInROC2Period int, outReal []float64) (*COPPOCKStream, OutRange, error)

COPPOCKOpenAndFill opens a stream as Core.COPPOCKOpen does and also writes the outputs over the whole history, as Core.COPPOCK writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.COPPOCKLookback values and share no memory with an input or another output.

The errors are those of Core.COPPOCKOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CORREL

func (c *Core) CORREL(startIdx, endIdx int, inReal0, inReal1 []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

CORREL computes the Pearson's Correlation Coefficient (r) over bars startIdx through endIdx.

Pearson's correlation coefficient (r) between two input series over a rolling window of optInTimePeriod bars. Measures how linearly the two series move together. r near +1: strong positive co-movement; near -1: strong inverse; near 0: no linear relationship.

Formula and more info at https://ta-lib.org/functions/correl.

Inputs, each at least endIdx+1 long:

  • inReal0: First data series (X)
  • inReal1: Second data series (Y)

Parameters:

  • optInTimePeriod: Rolling window length. Default 30; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Correlation coefficient r in [-1, 1].

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CORRELLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series0 := make([]float64, 252) // your data, oldest first
	for i := range series0 {
		series0[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	series1 := make([]float64, 252) // your data, oldest first
	for i := range series1 {
		series1[i] = 90 + float64(((i+7)%40-20)*((i+7)%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CORREL(0, len(series0)-1, series0, series1, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [0.2399, ..., 0.1179]

func (*Core) CORRELDisplayShift

func (c *Core) CORRELDisplayShift(optInTimePeriod, outputIdx int) (int, error)

CORRELDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CORREL. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CORREL followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CORRELLookback rejects or an index that names no output.

func (*Core) CORRELLookback

func (c *Core) CORRELLookback(optInTimePeriod int) (int, error)

CORRELLookback returns how many leading bars Core.CORREL consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CORREL and returns BadParam for one out of range.

func (*Core) CORRELOpen

func (c *Core) CORRELOpen(inReal0, inReal1 []float64, optInTimePeriod int) (*CORRELStream, float64, error)

CORRELOpen opens a live CORRELStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CORREL writes there.

inReal0 and inReal1 are the histories, of one length; the parameters are those of Core.CORREL.

The error is InsufficientHistory for a history of at most Core.CORRELLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CORRELOpenAndFill

func (c *Core) CORRELOpenAndFill(inReal0, inReal1 []float64, optInTimePeriod int, outReal []float64) (*CORRELStream, OutRange, error)

CORRELOpenAndFill opens a stream as Core.CORRELOpen does and also writes the outputs over the whole history, as Core.CORREL writes them for bars 0 through len(inReal0)-1, returning that range.

Each output must hold len(inReal0) minus Core.CORRELLookback values and share no memory with an input or another output.

The errors are those of Core.CORRELOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) COS

func (c *Core) COS(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

COS computes the Vector Trigonometric Cos over bars startIdx through endIdx.

Element-wise cosine of the input series.

Formula and more info at https://ta-lib.org/functions/cos.

Inputs, each at least endIdx+1 long:

  • inReal: Input values, treated as angles in radians.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Cosine of each input value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.COSLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = -6.3 + 12.6*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.COS(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [0.9999, ..., 0.9999]

func (*Core) COSDisplayShift

func (c *Core) COSDisplayShift(outputIdx int) (int, error)

COSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.COS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.COS, from 0, and returns BadParam for an index that names no output.

func (*Core) COSH

func (c *Core) COSH(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

COSH computes the Vector Trigonometric Cosh over bars startIdx through endIdx.

Element-wise hyperbolic cosine of the input series.

Formula and more info at https://ta-lib.org/functions/cosh.

Inputs, each at least endIdx+1 long:

  • inReal: Input values to transform.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Hyperbolic cosine of each input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.COSHLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = -5 + 10*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.COSH(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [74.2099, ..., 74.2099]

func (*Core) COSHDisplayShift

func (c *Core) COSHDisplayShift(outputIdx int) (int, error)

COSHDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.COSH. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.COSH, from 0, and returns BadParam for an index that names no output.

func (*Core) COSHLookback

func (c *Core) COSHLookback() (int, error)

COSHLookback returns how many leading bars Core.COSH consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) COSHOpen

func (c *Core) COSHOpen(inReal []float64) (*COSHStream, float64, error)

COSHOpen opens a live COSHStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.COSH writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.COSHLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) COSHOpenAndFill

func (c *Core) COSHOpenAndFill(inReal, outReal []float64) (*COSHStream, OutRange, error)

COSHOpenAndFill opens a stream as Core.COSHOpen does and also writes the outputs over the whole history, as Core.COSH writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.COSHLookback values and share no memory with an input or another output.

The errors are those of Core.COSHOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) COSLookback

func (c *Core) COSLookback() (int, error)

COSLookback returns how many leading bars Core.COS consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) COSOpen

func (c *Core) COSOpen(inReal []float64) (*COSStream, float64, error)

COSOpen opens a live COSStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.COS writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.COSLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) COSOpenAndFill

func (c *Core) COSOpenAndFill(inReal, outReal []float64) (*COSStream, OutRange, error)

COSOpenAndFill opens a stream as Core.COSOpen does and also writes the outputs over the whole history, as Core.COS writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.COSLookback values and share no memory with an input or another output.

The errors are those of Core.COSOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CPR

func (c *Core) CPR(startIdx, endIdx int, inHigh, inLow, inClose, outRealUpperBand, outRealMiddleBand, outRealLowerBand []float64) (OutRange, error)

CPR computes the Central Pivot Range over bars startIdx through endIdx.

Central Pivot Range: a central pivot and two lines straddling it, computed from the previous bar's high, low and close and held for the current bar. The distance between the outer lines is the reading: an unusually narrow range tends to precede a trending bar, an unusually wide one a rangebound bar.

Formula and more info at https://ta-lib.org/functions/cpr.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outRealUpperBand: The higher of the two outer lines.
  • outRealMiddleBand: The central pivot.
  • outRealLowerBand: The lower of the two outer lines.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CPRLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	upperBand := make([]float64, 252)
	middleBand := make([]float64, 252)
	lowerBand := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CPR(0, len(high)-1, high, low, close, upperBand, middleBand, lowerBand)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("upperBand = [%.4f, ..., %.4f]\n", upperBand[0], upperBand[r.NBElement-1])
	fmt.Printf("middleBand = [%.4f, ..., %.4f]\n", middleBand[0], middleBand[r.NBElement-1])
	fmt.Printf("lowerBand = [%.4f, ..., %.4f]\n", lowerBand[0], lowerBand[r.NBElement-1])
}
Output:
251 values from bar 1:
upperBand = [111.0667, ..., 95.1333]
middleBand = [110.5333, ..., 95.0667]
lowerBand = [110.0000, ..., 95.0000]

func (*Core) CPRDisplayShift

func (c *Core) CPRDisplayShift(outputIdx int) (int, error)

CPRDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CPR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CPR, from 0, and returns BadParam for an index that names no output.

func (*Core) CPRLookback

func (c *Core) CPRLookback() (int, error)

CPRLookback returns how many leading bars Core.CPR consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CPROpen

func (c *Core) CPROpen(inHigh, inLow, inClose []float64) (*CPRStream, float64, float64, float64, error)

CPROpen opens a live CPRStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outRealUpperBand, outRealMiddleBand and outRealLowerBand), the values Core.CPR writes there.

inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.CPRLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) CPROpenAndFill

func (c *Core) CPROpenAndFill(inHigh, inLow, inClose, outRealUpperBand, outRealMiddleBand, outRealLowerBand []float64) (*CPRStream, OutRange, error)

CPROpenAndFill opens a stream as Core.CPROpen does and also writes the outputs over the whole history, as Core.CPR writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.CPRLookback values and share no memory with an input or another output.

The errors are those of Core.CPROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CRSI

func (c *Core) CRSI(startIdx, endIdx int, inReal []float64, optInTimePeriod, optInStreakPeriod, optInRankPeriod int, outReal []float64) (OutRange, error)

CRSI computes the Connors Relative Strength Index over bars startIdx through endIdx.

Connors RSI: a 0 to 100 oscillator, the plain average of three short-term momentum readings on that same scale.

Formula and more info at https://ta-lib.org/functions/crsi.

Inputs, each at least endIdx+1 long:

  • inReal: Close price series.

Parameters:

  • optInTimePeriod: Period of the RSI of the closes. Default 3; range 2 to 100000; IntegerDefault selects the default.
  • optInStreakPeriod: Period of the RSI of the up/down streak. Default 2; range 2 to 100000; IntegerDefault selects the default.
  • optInRankPeriod: Number of earlier one-bar returns each return is ranked against. Default 100; range 2 to 10000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: The averaged reading, 0 to 100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CRSILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CRSI(0, len(series)-1, series, 3, 2, 100, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
151 values from bar 101: [54.9139, ..., 10.6055]

func (*Core) CRSIDisplayShift

func (c *Core) CRSIDisplayShift(optInTimePeriod, optInStreakPeriod, optInRankPeriod, outputIdx int) (int, error)

CRSIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CRSI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CRSI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CRSILookback rejects or an index that names no output.

func (*Core) CRSILookback

func (c *Core) CRSILookback(optInTimePeriod, optInStreakPeriod, optInRankPeriod int) (int, error)

CRSILookback returns how many leading bars Core.CRSI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CRSI and returns BadParam for one out of range.

func (*Core) CRSIOpen

func (c *Core) CRSIOpen(inReal []float64, optInTimePeriod, optInStreakPeriod, optInRankPeriod int) (*CRSIStream, float64, error)

CRSIOpen opens a live CRSIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CRSI writes there.

inReal is the history; the parameters are those of Core.CRSI.

The error is InsufficientHistory for a history of at most Core.CRSILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) CRSIOpenAndFill

func (c *Core) CRSIOpenAndFill(inReal []float64, optInTimePeriod, optInStreakPeriod, optInRankPeriod int, outReal []float64) (*CRSIStream, OutRange, error)

CRSIOpenAndFill opens a stream as Core.CRSIOpen does and also writes the outputs over the whole history, as Core.CRSI writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.CRSILookback values and share no memory with an input or another output.

The errors are those of Core.CRSIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CTI

func (c *Core) CTI(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

CTI computes the Correlation Trend Indicator over bars startIdx through endIdx.

John F. Ehlers' Correlation Trend Indicator: the Pearson correlation of the last optInTimePeriod closes against a straight line of positive slope. Bounded in -1..+1 by construction — +1 is a perfectly linear uptrend, -1 a perfectly linear downtrend, 0 no linear trend. Trend strength and direction in one bounded number, with no smoothing, no recursion and no filter coefficients.

Formula and more info at https://ta-lib.org/functions/cti.

Inputs, each at least endIdx+1 long:

  • inReal: The series to measure the trend of.

Parameters:

  • optInTimePeriod: Number of trailing values correlated against the ramp. Default 20; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Correlation against the ramp, in -1..+1.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CTILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CTI(0, len(series)-1, series, 20, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
233 values from bar 19: [-0.9713, ..., -0.3788]

func (*Core) CTIDisplayShift

func (c *Core) CTIDisplayShift(optInTimePeriod, outputIdx int) (int, error)

CTIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CTI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CTI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CTILookback rejects or an index that names no output.

func (*Core) CTILookback

func (c *Core) CTILookback(optInTimePeriod int) (int, error)

CTILookback returns how many leading bars Core.CTI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CTI and returns BadParam for one out of range.

func (*Core) CTIOpen

func (c *Core) CTIOpen(inReal []float64, optInTimePeriod int) (*CTIStream, float64, error)

CTIOpen opens a live CTIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CTI writes there.

inReal is the history; the parameters are those of Core.CTI.

The error is InsufficientHistory for a history of at most Core.CTILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) CTIOpenAndFill

func (c *Core) CTIOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*CTIStream, OutRange, error)

CTIOpenAndFill opens a stream as Core.CTIOpen does and also writes the outputs over the whole history, as Core.CTI writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.CTILookback values and share no memory with an input or another output.

The errors are those of Core.CTIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CUMSUM

func (c *Core) CUMSUM(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

CUMSUM computes the Cumulative Sum over bars startIdx through endIdx.

Cumulative Sum: the running total of a series from the anchor bar forward. A math primitive rather than an indicator — it is the one operation between the shipped corpus and three named classical breadth indicators: the A/D Line is CUMSUM(SUB(advances, declines)), the A/D Volume Line is CUMSUM(SUB(advancingVolume, decliningVolume)), and the McClellan Summation Index is CUMSUM of the McClellan Oscillator.

Formula and more info at https://ta-lib.org/functions/cumsum.

Inputs, each at least endIdx+1 long:

  • inReal: Source series (canonically a per-bar net figure, e.g. advances − declines)

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Running total since the anchor bar.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CUMSUMLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CUMSUM(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [110.0000, ..., 24415.3000]

func (*Core) CUMSUMDisplayShift

func (c *Core) CUMSUMDisplayShift(outputIdx int) (int, error)

CUMSUMDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CUMSUM. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.CUMSUM, from 0, and returns BadParam for an index that names no output.

func (*Core) CUMSUMLookback

func (c *Core) CUMSUMLookback() (int, error)

CUMSUMLookback returns how many leading bars Core.CUMSUM consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) CUMSUMOpen

func (c *Core) CUMSUMOpen(inReal []float64) (*CUMSUMStream, float64, error)

CUMSUMOpen opens a live CUMSUMStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CUMSUM writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.CUMSUMLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) CUMSUMOpenAndFill

func (c *Core) CUMSUMOpenAndFill(inReal, outReal []float64) (*CUMSUMStream, OutRange, error)

CUMSUMOpenAndFill opens a stream as Core.CUMSUMOpen does and also writes the outputs over the whole history, as Core.CUMSUM writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.CUMSUMLookback values and share no memory with an input or another output.

The errors are those of Core.CUMSUMOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CVI

func (c *Core) CVI(startIdx, endIdx int, inHigh, inLow []float64, optInTimePeriod, optInROCPeriod int, outReal []float64) (OutRange, error)

CVI computes the Chaikin's Volatility over bars startIdx through endIdx.

Chaikin's Volatility: Marc Chaikin's reading of how fast a market's daily trading range is widening or narrowing. The high-low spread is smoothed by an exponential moving average, and the indicator reports the percent that average has changed over a lookback of its own.

Formula and more info at https://ta-lib.org/functions/cvi.

Inputs, each at least endIdx+1 long:

  • inHigh: High price.
  • inLow: Low price.

Parameters:

  • optInTimePeriod: Number of bars in the exponential average of the high-low spread. Default 10; range 2 to 100000; IntegerDefault selects the default.
  • optInROCPeriod: How many bars back the percent change reaches. Default 10; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Percent change of the smoothed high-low spread.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.CVILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.CVI(0, len(high)-1, high, low, 10, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
233 values from bar 19: [0.7415, ..., 13.7824]

func (*Core) CVIDisplayShift

func (c *Core) CVIDisplayShift(optInTimePeriod, optInROCPeriod, outputIdx int) (int, error)

CVIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.CVI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.CVI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.CVILookback rejects or an index that names no output.

func (*Core) CVILookback

func (c *Core) CVILookback(optInTimePeriod, optInROCPeriod int) (int, error)

CVILookback returns how many leading bars Core.CVI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.CVI and returns BadParam for one out of range.

func (*Core) CVIOpen

func (c *Core) CVIOpen(inHigh, inLow []float64, optInTimePeriod, optInROCPeriod int) (*CVIStream, float64, error)

CVIOpen opens a live CVIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.CVI writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.CVI.

The error is InsufficientHistory for a history of at most Core.CVILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) CVIOpenAndFill

func (c *Core) CVIOpenAndFill(inHigh, inLow []float64, optInTimePeriod, optInROCPeriod int, outReal []float64) (*CVIStream, OutRange, error)

CVIOpenAndFill opens a stream as Core.CVIOpen does and also writes the outputs over the whole history, as Core.CVI writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.CVILookback values and share no memory with an input or another output.

The errors are those of Core.CVIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) CandleSetting

func (c *Core) CandleSetting(settingType CandleSettingType) (CandleSetting, error)

CandleSetting returns the candlestick setting stored for one attribute.

func (*Core) DEMA

func (c *Core) DEMA(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

DEMA computes the Double Exponential Moving Average over bars startIdx through endIdx.

Double Exponential Moving Average: an EMA combined with an EMA-of-EMA to reduce lag versus a plain EMA. Overlap Studies overlay on price.

Formula and more info at https://ta-lib.org/functions/dema.

Inputs, each at least endIdx+1 long:

  • inReal: Source series (typically price)

Parameters:

  • optInTimePeriod: Smoothing period for both EMA passes. Default 30; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: DEMA line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.DEMALookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.DEMA(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
194 values from bar 58: [94.5185, ..., 100.0249]

func (*Core) DEMADisplayShift

func (c *Core) DEMADisplayShift(optInTimePeriod, outputIdx int) (int, error)

DEMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.DEMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.DEMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.DEMALookback rejects or an index that names no output.

func (*Core) DEMALookback

func (c *Core) DEMALookback(optInTimePeriod int) (int, error)

DEMALookback returns how many leading bars Core.DEMA consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.DEMA and returns BadParam for one out of range.

func (*Core) DEMAOpen

func (c *Core) DEMAOpen(inReal []float64, optInTimePeriod int) (*DEMAStream, float64, error)

DEMAOpen opens a live DEMAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.DEMA writes there.

inReal is the history; the parameters are those of Core.DEMA.

The error is InsufficientHistory for a history of at most Core.DEMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) DEMAOpenAndFill

func (c *Core) DEMAOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*DEMAStream, OutRange, error)

DEMAOpenAndFill opens a stream as Core.DEMAOpen does and also writes the outputs over the whole history, as Core.DEMA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.DEMALookback values and share no memory with an input or another output.

The errors are those of Core.DEMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) DIV

func (c *Core) DIV(startIdx, endIdx int, inReal0, inReal1, outReal []float64) (OutRange, error)

DIV computes the Vector Arithmetic Div over bars startIdx through endIdx.

Element-wise division of two input series.

Formula and more info at https://ta-lib.org/functions/div.

Inputs, each at least endIdx+1 long:

  • inReal0: Dividend (numerator) series.
  • inReal1: Divisor (denominator) series.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Per-element quotient inReal0/inReal1.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.DIVLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series0 := make([]float64, 252) // your data, oldest first
	for i := range series0 {
		series0[i] = float64(10*(i%40-20)*(i%40-20)-2000) / 201
	}
	series1 := make([]float64, 252) // your data, oldest first
	for i := range series1 {
		series1[i] = 1 + 5*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.DIV(0, len(series0)-1, series0, series1, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [9.9502, ..., -0.9867]

func (*Core) DIVDisplayShift

func (c *Core) DIVDisplayShift(outputIdx int) (int, error)

DIVDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.DIV. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.DIV, from 0, and returns BadParam for an index that names no output.

func (*Core) DIVLookback

func (c *Core) DIVLookback() (int, error)

DIVLookback returns how many leading bars Core.DIV consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) DIVOpen

func (c *Core) DIVOpen(inReal0, inReal1 []float64) (*DIVStream, float64, error)

DIVOpen opens a live DIVStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.DIV writes there.

inReal0 and inReal1 are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.DIVLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) DIVOpenAndFill

func (c *Core) DIVOpenAndFill(inReal0, inReal1, outReal []float64) (*DIVStream, OutRange, error)

DIVOpenAndFill opens a stream as Core.DIVOpen does and also writes the outputs over the whole history, as Core.DIV writes them for bars 0 through len(inReal0)-1, returning that range.

Each output must hold len(inReal0) minus Core.DIVLookback values and share no memory with an input or another output.

The errors are those of Core.DIVOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) DONCHIAN

func (c *Core) DONCHIAN(startIdx, endIdx int, inHigh, inLow []float64, optInTimePeriod int, outRealUpperBand, outRealMiddleBand, outRealLowerBand []float64) (OutRange, error)

DONCHIAN computes the Donchian Channels over bars startIdx through endIdx.

Donchian Channels: three overlap lines built from rolling price extrema. The upper band is the highest high and the lower band the lowest low over the period; the middle line is their midpoint. Richard Donchian's original four-week rule — generally credited as the first published systematic trend-following system — buys a break above the high of the preceding weeks and sells a break below their low.

Formula and more info at https://ta-lib.org/functions/donchian.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInTimePeriod: Number of bars in the extrema window. Default 20; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outRealUpperBand: Highest high of the window.
  • outRealMiddleBand: Midpoint of the upper and lower bands.
  • outRealLowerBand: Lowest low of the window.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.DONCHIANLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	upperBand := make([]float64, 252)
	middleBand := make([]float64, 252)
	lowerBand := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.DONCHIAN(0, len(high)-1, high, low, 20, upperBand, middleBand, lowerBand)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("upperBand = [%.4f, ..., %.4f]\n", upperBand[0], upperBand[r.NBElement-1])
	fmt.Printf("middleBand = [%.4f, ..., %.4f]\n", middleBand[0], middleBand[r.NBElement-1])
	fmt.Printf("lowerBand = [%.4f, ..., %.4f]\n", lowerBand[0], lowerBand[r.NBElement-1])
}
Output:
233 values from bar 19:
upperBand = [113.8000, ..., 112.0000]
middleBand = [100.9250, ..., 101.9250]
lowerBand = [88.0500, ..., 91.8500]

func (*Core) DONCHIANDisplayShift

func (c *Core) DONCHIANDisplayShift(optInTimePeriod, outputIdx int) (int, error)

DONCHIANDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.DONCHIAN. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.DONCHIAN followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.DONCHIANLookback rejects or an index that names no output.

func (*Core) DONCHIANLookback

func (c *Core) DONCHIANLookback(optInTimePeriod int) (int, error)

DONCHIANLookback returns how many leading bars Core.DONCHIAN consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.DONCHIAN and returns BadParam for one out of range.

func (*Core) DONCHIANOpen

func (c *Core) DONCHIANOpen(inHigh, inLow []float64, optInTimePeriod int) (*DONCHIANStream, float64, float64, float64, error)

DONCHIANOpen opens a live DONCHIANStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outRealUpperBand, outRealMiddleBand and outRealLowerBand), the values Core.DONCHIAN writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.DONCHIAN.

The error is InsufficientHistory for a history of at most Core.DONCHIANLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) DONCHIANOpenAndFill

func (c *Core) DONCHIANOpenAndFill(inHigh, inLow []float64, optInTimePeriod int, outRealUpperBand, outRealMiddleBand, outRealLowerBand []float64) (*DONCHIANStream, OutRange, error)

DONCHIANOpenAndFill opens a stream as Core.DONCHIANOpen does and also writes the outputs over the whole history, as Core.DONCHIAN writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.DONCHIANLookback values and share no memory with an input or another output.

The errors are those of Core.DONCHIANOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) DOSC

func (c *Core) DOSC(startIdx, endIdx int, inReal []float64, optInTimePeriod, optInFirstPeriod, optInSecondPeriod, optInSignalPeriod int, outReal []float64) (OutRange, error)

DOSC computes the Derivative Oscillator over bars startIdx through endIdx.

Derivative Oscillator: Wilder's RSI, smoothed by two exponential averages in series, with a simple average of that smoothed line subtracted from it. Constance Brown's reading is that the RSI's own swings are too noisy to time with, so she smooths it twice and then plots the distance from its own average as a histogram — MACD's histogram construction, applied to a smoothed RSI rather than to price. The result is in RSI points, centred on zero: crossings of the zero line mark the turn, and the height measures how far the smoothed RSI has run from its mean.

Formula and more info at https://ta-lib.org/functions/dosc.

Inputs, each at least endIdx+1 long:

  • inReal: Input series, usually the close.

Parameters:

  • optInTimePeriod: Period of the RSI. Default 14; range 2 to 100000; IntegerDefault selects the default.
  • optInFirstPeriod: Period of the first smoothing, applied to the RSI. Default 5; range 2 to 100000; IntegerDefault selects the default.
  • optInSecondPeriod: Period of the second smoothing, applied to the first. Default 3; range 2 to 100000; IntegerDefault selects the default.
  • optInSignalPeriod: Period of the simple average subtracted from the smoothed line. Default 9; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Derivative Oscillator, in RSI points, centred on zero.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.DOSCLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.DOSC(0, len(series)-1, series, 14, 5, 3, 9, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
224 values from bar 28: [9.8390, ..., -15.2676]

func (*Core) DOSCDisplayShift

func (c *Core) DOSCDisplayShift(optInTimePeriod, optInFirstPeriod, optInSecondPeriod, optInSignalPeriod, outputIdx int) (int, error)

DOSCDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.DOSC. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.DOSC followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.DOSCLookback rejects or an index that names no output.

func (*Core) DOSCLookback

func (c *Core) DOSCLookback(optInTimePeriod, optInFirstPeriod, optInSecondPeriod, optInSignalPeriod int) (int, error)

DOSCLookback returns how many leading bars Core.DOSC consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.DOSC and returns BadParam for one out of range.

func (*Core) DOSCOpen

func (c *Core) DOSCOpen(inReal []float64, optInTimePeriod, optInFirstPeriod, optInSecondPeriod, optInSignalPeriod int) (*DOSCStream, float64, error)

DOSCOpen opens a live DOSCStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.DOSC writes there.

inReal is the history; the parameters are those of Core.DOSC.

The error is InsufficientHistory for a history of at most Core.DOSCLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) DOSCOpenAndFill

func (c *Core) DOSCOpenAndFill(inReal []float64, optInTimePeriod, optInFirstPeriod, optInSecondPeriod, optInSignalPeriod int, outReal []float64) (*DOSCStream, OutRange, error)

DOSCOpenAndFill opens a stream as Core.DOSCOpen does and also writes the outputs over the whole history, as Core.DOSC writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.DOSCLookback values and share no memory with an input or another output.

The errors are those of Core.DOSCOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) DPO

func (c *Core) DPO(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

DPO computes the Detrended Price Oscillator over bars startIdx through endIdx.

Detrended Price Oscillator: the price a half-cycle back, less the moving average that spans the cycle. Removing the average removes the trend, leaving the shorter oscillation that the trend was hiding.

Formula and more info at https://ta-lib.org/functions/dpo.

Inputs, each at least endIdx+1 long:

  • inReal: Source price/value series, canonically the close.

Parameters:

  • optInTimePeriod: Number of bars spanned by the moving average being removed; the displacement is derived from it. Default 20; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Detrended Price Oscillator value, in the units of the input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.DPOLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.DPO(0, len(series)-1, series, 20, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
233 values from bar 19: [0.0250, ..., 8.4250]

func (*Core) DPODisplayShift

func (c *Core) DPODisplayShift(optInTimePeriod, outputIdx int) (int, error)

DPODisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.DPO. The values are never shifted.

It takes the parameters of Core.DPO followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.DPOLookback rejects or an index that names no output.

func (*Core) DPOLookback

func (c *Core) DPOLookback(optInTimePeriod int) (int, error)

DPOLookback returns how many leading bars Core.DPO consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.DPO and returns BadParam for one out of range.

func (*Core) DPOOpen

func (c *Core) DPOOpen(inReal []float64, optInTimePeriod int) (*DPOStream, float64, error)

DPOOpen opens a live DPOStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.DPO writes there.

inReal is the history; the parameters are those of Core.DPO.

The error is InsufficientHistory for a history of at most Core.DPOLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) DPOOpenAndFill

func (c *Core) DPOOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*DPOStream, OutRange, error)

DPOOpenAndFill opens a stream as Core.DPOOpen does and also writes the outputs over the whole history, as Core.DPO writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.DPOLookback values and share no memory with an input or another output.

The errors are those of Core.DPOOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) DX

func (c *Core) DX(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

DX computes the Directional Movement Index over bars startIdx through endIdx.

Wilder's Directional Movement Index: the normalized spread between +DI and -DI. Measures the strength of directional (trending) movement, irrespective of direction. Higher DX = stronger trend (either direction); low DX = ranging market.

Formula and more info at https://ta-lib.org/functions/dx.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Smoothing period for the DM and TR sums. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: DX directional movement index value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.DXLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdDX (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.DX(0, len(high)-1, high, low, close, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [100.0000, ..., 32.2569]

func (*Core) DXDisplayShift

func (c *Core) DXDisplayShift(optInTimePeriod, outputIdx int) (int, error)

DXDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.DX. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.DX followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.DXLookback rejects or an index that names no output.

func (*Core) DXLookback

func (c *Core) DXLookback(optInTimePeriod int) (int, error)

DXLookback returns how many leading bars Core.DX consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdDX (see Core.SetUnstablePeriod).

It takes the parameters of Core.DX and returns BadParam for one out of range.

func (*Core) DXOpen

func (c *Core) DXOpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*DXStream, float64, error)

DXOpen opens a live DXStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.DX writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.DX.

The error is InsufficientHistory for a history of at most Core.DXLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) DXOpenAndFill

func (c *Core) DXOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (*DXStream, OutRange, error)

DXOpenAndFill opens a stream as Core.DXOpen does and also writes the outputs over the whole history, as Core.DX writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.DXLookback values and share no memory with an input or another output.

The errors are those of Core.DXOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) EFI

func (c *Core) EFI(startIdx, endIdx int, inClose, inVolume []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

EFI computes the Elder's Force Index over bars startIdx through endIdx.

Alexander Elder's Force Index (Trading for a Living, 1993): volume-weighted momentum. Each bar's close-to-close move is weighted by that bar's volume, and the result is smoothed with an exponential moving average. The sign is the direction of the move; the size combines how far price travelled with how much volume stood behind it.

Formula and more info at https://ta-lib.org/functions/efi.

Inputs, each at least endIdx+1 long:

  • inClose: Close price of each bar.
  • inVolume: Volume of each bar.

Parameters:

  • optInTimePeriod: EMA period applied to the force series. Default 13; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Smoothed force.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.EFILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.EFI(0, len(close)-1, close, volume, 13, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [-18526.9615, ..., -18180.3499]

func (*Core) EFIDisplayShift

func (c *Core) EFIDisplayShift(optInTimePeriod, outputIdx int) (int, error)

EFIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.EFI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.EFI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.EFILookback rejects or an index that names no output.

func (*Core) EFILookback

func (c *Core) EFILookback(optInTimePeriod int) (int, error)

EFILookback returns how many leading bars Core.EFI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.EFI and returns BadParam for one out of range.

func (*Core) EFIOpen

func (c *Core) EFIOpen(inClose, inVolume []float64, optInTimePeriod int) (*EFIStream, float64, error)

EFIOpen opens a live EFIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.EFI writes there.

inClose and inVolume are the histories, of one length; the parameters are those of Core.EFI.

The error is InsufficientHistory for a history of at most Core.EFILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) EFIOpenAndFill

func (c *Core) EFIOpenAndFill(inClose, inVolume []float64, optInTimePeriod int, outReal []float64) (*EFIStream, OutRange, error)

EFIOpenAndFill opens a stream as Core.EFIOpen does and also writes the outputs over the whole history, as Core.EFI writes them for bars 0 through len(inClose)-1, returning that range.

Each output must hold len(inClose) minus Core.EFILookback values and share no memory with an input or another output.

The errors are those of Core.EFIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) EMA

func (c *Core) EMA(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

EMA computes the Exponential Moving Average over bars startIdx through endIdx.

Exponential moving average that weights recent prices more heavily via a recursive smoothing factor. A core building block seeding or composing many other indicators. Reacts faster than SMA; price above/below EMA suggests up/down trend.

Formula and more info at https://ta-lib.org/functions/ema.

Inputs, each at least endIdx+1 long:

  • inReal: price/data series to smooth.

Parameters:

  • optInTimePeriod: Number of bars in the average; sets smoothing k = 2/(period+1) Default 30; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: the exponential moving average.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.EMALookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdEMA (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.EMA(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [95.2583, ..., 98.9224]

func (*Core) EMADisplayShift

func (c *Core) EMADisplayShift(optInTimePeriod, outputIdx int) (int, error)

EMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.EMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.EMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.EMALookback rejects or an index that names no output.

func (*Core) EMALookback

func (c *Core) EMALookback(optInTimePeriod int) (int, error)

EMALookback returns how many leading bars Core.EMA consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdEMA (see Core.SetUnstablePeriod).

It takes the parameters of Core.EMA and returns BadParam for one out of range.

func (*Core) EMAOpen

func (c *Core) EMAOpen(inReal []float64, optInTimePeriod int) (*EMAStream, float64, error)

EMAOpen opens a live EMAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.EMA writes there.

inReal is the history; the parameters are those of Core.EMA.

The error is InsufficientHistory for a history of at most Core.EMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) EMAOpenAndFill

func (c *Core) EMAOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*EMAStream, OutRange, error)

EMAOpenAndFill opens a stream as Core.EMAOpen does and also writes the outputs over the whole history, as Core.EMA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.EMALookback values and share no memory with an input or another output.

The errors are those of Core.EMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) EMAVariation

func (c *Core) EMAVariation() EMAVariation

EMAVariation returns how the EMA family is seeded.

func (*Core) EMV

func (c *Core) EMV(startIdx, endIdx int, inHigh, inLow, inVolume []float64, optInTimePeriod int, optInVolumeDivisor float64, outReal []float64) (OutRange, error)

EMV computes the Arms Ease of Movement over bars startIdx through endIdx.

Ease of Movement: the bar-to-bar move of the high-low midpoint divided by a box ratio of volume to range, averaged over a trailing window. It is the numeric form of Richard W. Arms, Jr.'s Equivolume box.

Formula and more info at https://ta-lib.org/functions/emv.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inVolume: Volume of each bar.

Parameters:

  • optInTimePeriod: Number of one-bar values in the simple moving average. Default 14; range 1 to 100000; IntegerDefault selects the default.
  • optInVolumeDivisor: Volume is divided by this before it forms the box ratio. Default 10000; minimum 1; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Ease of Movement, averaged over the window.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.EMVLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.EMV(0, len(high)-1, high, low, volume, 14, 10000, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [-5.9627, ..., -1.3469]

func (*Core) EMVDisplayShift

func (c *Core) EMVDisplayShift(optInTimePeriod int, optInVolumeDivisor float64, outputIdx int) (int, error)

EMVDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.EMV. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.EMV followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.EMVLookback rejects or an index that names no output.

func (*Core) EMVLookback

func (c *Core) EMVLookback(optInTimePeriod int, optInVolumeDivisor float64) (int, error)

EMVLookback returns how many leading bars Core.EMV consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.EMV and returns BadParam for one out of range.

func (*Core) EMVOpen

func (c *Core) EMVOpen(inHigh, inLow, inVolume []float64, optInTimePeriod int, optInVolumeDivisor float64) (*EMVStream, float64, error)

EMVOpen opens a live EMVStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.EMV writes there.

inHigh, inLow and inVolume are the histories, of one length; the parameters are those of Core.EMV.

The error is InsufficientHistory for a history of at most Core.EMVLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) EMVOpenAndFill

func (c *Core) EMVOpenAndFill(inHigh, inLow, inVolume []float64, optInTimePeriod int, optInVolumeDivisor float64, outReal []float64) (*EMVStream, OutRange, error)

EMVOpenAndFill opens a stream as Core.EMVOpen does and also writes the outputs over the whole history, as Core.EMV writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.EMVLookback values and share no memory with an input or another output.

The errors are those of Core.EMVOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ER

func (c *Core) ER(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

ER computes the Kaufman Efficiency Ratio over bars startIdx through endIdx.

Kaufman Efficiency Ratio (also searched as "KER"): Perry Kaufman's noise measure from Smarter Trading (1995) — the net directional movement over the period divided by the total path travelled to get there. 1.0 is a perfectly efficient (straight-line) move; values near 0 are churn.

Formula and more info at https://ta-lib.org/functions/er.

Inputs, each at least endIdx+1 long:

  • inReal: Source price/value series (canonically close)

Parameters:

  • optInTimePeriod: Number of one-bar changes in the path sum (KAMA's optInTimePeriod is the same window, under its own default) Default 10; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Efficiency ratio.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ERLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ER(0, len(series)-1, series, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [1.0000, ..., 1.0000]

func (*Core) ERDisplayShift

func (c *Core) ERDisplayShift(optInTimePeriod, outputIdx int) (int, error)

ERDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ER. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ER followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ERLookback rejects or an index that names no output.

func (*Core) ERI

func (c *Core) ERI(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outBullPower, outBearPower []float64) (OutRange, error)

ERI computes the Elder Ray Index (Bull Power / Bear Power) over bars startIdx through endIdx.

Elder Ray Index: Alexander Elder's Bull Power / Bear Power pair from Trading for a Living (1993) — how far the bar's high and low sit from an EMA of the close. Bulls strong enough to push the high above the average read as positive Bull Power; bears dragging the low below it read as negative Bear Power.

Formula and more info at https://ta-lib.org/functions/eri.

Inputs, each at least endIdx+1 long:

  • inHigh: High price series.
  • inLow: Low price series.
  • inClose: Close price series.

Parameters:

  • optInTimePeriod: Number of bars in the EMA of close. Default 13; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outBullPower: High minus the EMA of close.
  • outBearPower: Low minus the EMA of close.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ERILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	bullPower := make([]float64, 252)
	bearPower := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ERI(0, len(high)-1, high, low, close, 13, bullPower, bearPower)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("bullPower = [%.4f, ..., %.4f]\n", bullPower[0], bullPower[r.NBElement-1])
	fmt.Printf("bearPower = [%.4f, ..., %.4f]\n", bearPower[0], bearPower[r.NBElement-1])
}
Output:
240 values from bar 12:
bullPower = [-3.2846, ..., -2.4983]
bearPower = [-10.8846, ..., -6.8983]

func (*Core) ERIDisplayShift

func (c *Core) ERIDisplayShift(optInTimePeriod, outputIdx int) (int, error)

ERIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ERI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ERI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ERILookback rejects or an index that names no output.

func (*Core) ERILookback

func (c *Core) ERILookback(optInTimePeriod int) (int, error)

ERILookback returns how many leading bars Core.ERI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ERI and returns BadParam for one out of range.

func (*Core) ERIOpen

func (c *Core) ERIOpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*ERIStream, float64, float64, error)

ERIOpen opens a live ERIStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outBullPower and outBearPower), the values Core.ERI writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.ERI.

The error is InsufficientHistory for a history of at most Core.ERILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ERIOpenAndFill

func (c *Core) ERIOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outBullPower, outBearPower []float64) (*ERIStream, OutRange, error)

ERIOpenAndFill opens a stream as Core.ERIOpen does and also writes the outputs over the whole history, as Core.ERI writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.ERILookback values and share no memory with an input or another output.

The errors are those of Core.ERIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ERLookback

func (c *Core) ERLookback(optInTimePeriod int) (int, error)

ERLookback returns how many leading bars Core.ER consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ER and returns BadParam for one out of range.

func (*Core) EROpen

func (c *Core) EROpen(inReal []float64, optInTimePeriod int) (*ERStream, float64, error)

EROpen opens a live ERStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ER writes there.

inReal is the history; the parameters are those of Core.ER.

The error is InsufficientHistory for a history of at most Core.ERLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) EROpenAndFill

func (c *Core) EROpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*ERStream, OutRange, error)

EROpenAndFill opens a stream as Core.EROpen does and also writes the outputs over the whole history, as Core.ER writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.ERLookback values and share no memory with an input or another output.

The errors are those of Core.EROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) EXP

func (c *Core) EXP(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

EXP computes the Vector Arithmetic Exp over bars startIdx through endIdx.

Element-wise base-e exponential of the input series.

Formula and more info at https://ta-lib.org/functions/exp.

Inputs, each at least endIdx+1 long:

  • inReal: Input values.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: e raised to each input value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.EXPLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = -5 + 10*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.EXP(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [0.0067, ..., 148.4132]

func (*Core) EXPDisplayShift

func (c *Core) EXPDisplayShift(outputIdx int) (int, error)

EXPDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.EXP. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.EXP, from 0, and returns BadParam for an index that names no output.

func (*Core) EXPLookback

func (c *Core) EXPLookback() (int, error)

EXPLookback returns how many leading bars Core.EXP consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) EXPOpen

func (c *Core) EXPOpen(inReal []float64) (*EXPStream, float64, error)

EXPOpen opens a live EXPStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.EXP writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.EXPLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) EXPOpenAndFill

func (c *Core) EXPOpenAndFill(inReal, outReal []float64) (*EXPStream, OutRange, error)

EXPOpenAndFill opens a stream as Core.EXPOpen does and also writes the outputs over the whole history, as Core.EXP writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.EXPLookback values and share no memory with an input or another output.

The errors are those of Core.EXPOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) FISHER

func (c *Core) FISHER(startIdx, endIdx int, inHigh, inLow []float64, optInTimePeriod int, outFisher, outTrigger []float64) (OutRange, error)

FISHER computes the Fisher Transform over bars startIdx through endIdx.

Ehlers' Fisher Transform: an oscillator that reshapes the midpoint's position in its rolling channel into a near-normal distribution. Extreme values become rare and turning points sharp, where a plain channel position spends much of its time pinned near the edges.

Formula and more info at https://ta-lib.org/functions/fisher.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInTimePeriod: Number of bars in the channel the midpoint is located in. Default 10; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outFisher: Fisher Transform value.
  • outTrigger: Fisher value of the previous bar.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.FISHERLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdFISHER (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	fisher := make([]float64, 252)
	trigger := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.FISHER(0, len(high)-1, high, low, 10, fisher, trigger)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("fisher = [%.4f, ..., %.4f]\n", fisher[0], fisher[r.NBElement-1])
	fmt.Printf("trigger = [%.4f, ..., %.4f]\n", trigger[0], trigger[r.NBElement-1])
}
Output:
243 values from bar 9:
fisher = [-0.3428, ..., -2.9406]
trigger = [0.0000, ..., -2.5030]

func (*Core) FISHERDisplayShift

func (c *Core) FISHERDisplayShift(optInTimePeriod, outputIdx int) (int, error)

FISHERDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.FISHER. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.FISHER followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.FISHERLookback rejects or an index that names no output.

func (*Core) FISHERLookback

func (c *Core) FISHERLookback(optInTimePeriod int) (int, error)

FISHERLookback returns how many leading bars Core.FISHER consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdFISHER (see Core.SetUnstablePeriod).

It takes the parameters of Core.FISHER and returns BadParam for one out of range.

func (*Core) FISHEROpen

func (c *Core) FISHEROpen(inHigh, inLow []float64, optInTimePeriod int) (*FISHERStream, float64, float64, error)

FISHEROpen opens a live FISHERStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outFisher and outTrigger), the values Core.FISHER writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.FISHER.

The error is InsufficientHistory for a history of at most Core.FISHERLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) FISHEROpenAndFill

func (c *Core) FISHEROpenAndFill(inHigh, inLow []float64, optInTimePeriod int, outFisher, outTrigger []float64) (*FISHERStream, OutRange, error)

FISHEROpenAndFill opens a stream as Core.FISHEROpen does and also writes the outputs over the whole history, as Core.FISHER writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.FISHERLookback values and share no memory with an input or another output.

The errors are those of Core.FISHEROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) FLOOR

func (c *Core) FLOOR(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

FLOOR computes the Vector Floor over bars startIdx through endIdx.

Element-wise floor (round down to the nearest integer) of the input series.

Formula and more info at https://ta-lib.org/functions/floor.

Inputs, each at least endIdx+1 long:

  • inReal: Input values.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Each input rounded down to nearest integer.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.FLOORLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = -3 + 6*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.FLOOR(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [-3.0000, ..., 3.0000]

func (*Core) FLOORDisplayShift

func (c *Core) FLOORDisplayShift(outputIdx int) (int, error)

FLOORDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.FLOOR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.FLOOR, from 0, and returns BadParam for an index that names no output.

func (*Core) FLOORLookback

func (c *Core) FLOORLookback() (int, error)

FLOORLookback returns how many leading bars Core.FLOOR consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) FLOOROpen

func (c *Core) FLOOROpen(inReal []float64) (*FLOORStream, float64, error)

FLOOROpen opens a live FLOORStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.FLOOR writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.FLOORLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) FLOOROpenAndFill

func (c *Core) FLOOROpenAndFill(inReal, outReal []float64) (*FLOORStream, OutRange, error)

FLOOROpenAndFill opens a stream as Core.FLOOROpen does and also writes the outputs over the whole history, as Core.FLOOR writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.FLOORLookback values and share no memory with an input or another output.

The errors are those of Core.FLOOROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) FOSC

func (c *Core) FOSC(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

FOSC computes the Forecast Oscillator over bars startIdx through endIdx.

Forecast Oscillator: the percentage by which the close deviates from the Time Series Forecast that was made one bar earlier for the current bar.

Formula and more info at https://ta-lib.org/functions/fosc.

Inputs, each at least endIdx+1 long:

  • inReal: Source price/value series.

Parameters:

  • optInTimePeriod: Number of bars in the regression window. Default 5; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Percentage deviation of the close from the previous bar's forecast.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.FOSCLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.FOSC(0, len(series)-1, series, 5, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
247 values from bar 5: [0.3457, ..., 0.3721]

func (*Core) FOSCDisplayShift

func (c *Core) FOSCDisplayShift(optInTimePeriod, outputIdx int) (int, error)

FOSCDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.FOSC. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.FOSC followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.FOSCLookback rejects or an index that names no output.

func (*Core) FOSCLookback

func (c *Core) FOSCLookback(optInTimePeriod int) (int, error)

FOSCLookback returns how many leading bars Core.FOSC consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.FOSC and returns BadParam for one out of range.

func (*Core) FOSCOpen

func (c *Core) FOSCOpen(inReal []float64, optInTimePeriod int) (*FOSCStream, float64, error)

FOSCOpen opens a live FOSCStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.FOSC writes there.

inReal is the history; the parameters are those of Core.FOSC.

The error is InsufficientHistory for a history of at most Core.FOSCLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) FOSCOpenAndFill

func (c *Core) FOSCOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*FOSCStream, OutRange, error)

FOSCOpenAndFill opens a stream as Core.FOSCOpen does and also writes the outputs over the whole history, as Core.FOSC writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.FOSCLookback values and share no memory with an input or another output.

The errors are those of Core.FOSCOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) FRACTAL

func (c *Core) FRACTAL(startIdx, endIdx int, inHigh, inLow []float64, optInLeftBars, optInRightBars int, outSwingHigh, outSwingLow []int32) (OutRange, error)

FRACTAL computes the Williams Fractal over bars startIdx through endIdx.

Williams Fractal: a causal swing-pivot detector. A bar is a swing high when its high strictly exceeds the highs of the optInLeftBars bars before it and the optInRightBars bars after it; a swing low is the mirror on the lows. Bill Williams' original is the symmetric five-candle case; independent left and right arms generalise it.

Formula and more info at https://ta-lib.org/functions/fractal.

Inputs, each at least endIdx+1 long:

  • inHigh: High price series.
  • inLow: Low price series.

Parameters:

  • optInLeftBars: Bars before the pivot that it must strictly dominate. Default 2; range 1 to 100000; IntegerDefault selects the default.
  • optInRightBars: Bars after the pivot that it must strictly dominate, and the delay before the verdict is reported. Default 2; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outSwingHigh: 100 when the bar optInRightBars back is a strict swing high, 0 otherwise.
  • outSwingLow: 100 when the bar optInRightBars back is a strict swing low, 0 otherwise.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.FRACTALLookback: a range that ends before it returns NBElement 0.

Outputs may not share memory with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	swingHigh := make([]int32, 252)
	swingLow := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.FRACTAL(0, len(high)-1, high, low, 2, 2, swingHigh, swingLow)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("swingHigh = [%d, ..., %d]\n", swingHigh[0], swingHigh[r.NBElement-1])
	fmt.Printf("swingLow = [%d, ..., %d]\n", swingLow[0], swingLow[r.NBElement-1])
}
Output:
248 values from bar 4:
swingHigh = [0, ..., 0]
swingLow = [0, ..., 0]

func (*Core) FRACTALDisplayShift

func (c *Core) FRACTALDisplayShift(optInLeftBars, optInRightBars, outputIdx int) (int, error)

FRACTALDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.FRACTAL. The values are never shifted.

It takes the parameters of Core.FRACTAL followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.FRACTALLookback rejects or an index that names no output.

func (*Core) FRACTALLookback

func (c *Core) FRACTALLookback(optInLeftBars, optInRightBars int) (int, error)

FRACTALLookback returns how many leading bars Core.FRACTAL consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.FRACTAL and returns BadParam for one out of range.

func (*Core) FRACTALOpen

func (c *Core) FRACTALOpen(inHigh, inLow []float64, optInLeftBars, optInRightBars int) (*FRACTALStream, int32, int32, error)

FRACTALOpen opens a live FRACTALStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outSwingHigh and outSwingLow), the values Core.FRACTAL writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.FRACTAL.

The error is InsufficientHistory for a history of at most Core.FRACTALLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) FRACTALOpenAndFill

func (c *Core) FRACTALOpenAndFill(inHigh, inLow []float64, optInLeftBars, optInRightBars int, outSwingHigh, outSwingLow []int32) (*FRACTALStream, OutRange, error)

FRACTALOpenAndFill opens a stream as Core.FRACTALOpen does and also writes the outputs over the whole history, as Core.FRACTAL writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.FRACTALLookback values and share no memory with an input or another output.

The errors are those of Core.FRACTALOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) FRAMA

func (c *Core) FRAMA(startIdx, endIdx int, inHigh, inLow []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

FRAMA computes the Fractal Adaptive Moving Average over bars startIdx through endIdx.

Fractal Adaptive Moving Average (John Ehlers): an EMA whose smoothing factor adapts each bar to the fractal dimension of the window, estimated from the high-low ranges of the window and of its two halves. A straight run gives dimension 1 and the output follows the price; dense congestion gives dimension 2 and very slow smoothing.

Formula and more info at https://ta-lib.org/functions/frama.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInTimePeriod: Number of bars in the window, split into two equal halves. Default 16; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Adaptive moving average line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.FRAMALookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdFRAMA (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.FRAMA(0, len(high)-1, high, low, 16, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
236 values from bar 16: [91.0746, ..., 101.4548]

func (*Core) FRAMADisplayShift

func (c *Core) FRAMADisplayShift(optInTimePeriod, outputIdx int) (int, error)

FRAMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.FRAMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.FRAMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.FRAMALookback rejects or an index that names no output.

func (*Core) FRAMALookback

func (c *Core) FRAMALookback(optInTimePeriod int) (int, error)

FRAMALookback returns how many leading bars Core.FRAMA consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdFRAMA (see Core.SetUnstablePeriod).

It takes the parameters of Core.FRAMA and returns BadParam for one out of range.

func (*Core) FRAMAOpen

func (c *Core) FRAMAOpen(inHigh, inLow []float64, optInTimePeriod int) (*FRAMAStream, float64, error)

FRAMAOpen opens a live FRAMAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.FRAMA writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.FRAMA.

The error is InsufficientHistory for a history of at most Core.FRAMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) FRAMAOpenAndFill

func (c *Core) FRAMAOpenAndFill(inHigh, inLow []float64, optInTimePeriod int, outReal []float64) (*FRAMAStream, OutRange, error)

FRAMAOpenAndFill opens a stream as Core.FRAMAOpen does and also writes the outputs over the whole history, as Core.FRAMA writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.FRAMALookback values and share no memory with an input or another output.

The errors are those of Core.FRAMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) GATOR

func (c *Core) GATOR(startIdx, endIdx int, inHigh, inLow []float64, optInJawPeriod, optInJawShift, optInTeethPeriod, optInTeethShift, optInLipsPeriod, optInLipsShift int, outUpper, outLower []float64) (OutRange, error)

GATOR computes the Gator Oscillator over bars startIdx through endIdx.

Bill Williams' Gator Oscillator: how far apart the three Alligator lines are, as two histograms. The upper bars are the gap between Jaw and Teeth, the lower bars the gap between Teeth and Lips drawn below zero. Both growing is the alligator eating, a trend under way; both shrinking toward zero is it falling asleep, the lines converging in a range. One side growing while the other shrinks is it waking or sated, the turn from one state into the other.

Formula and more info at https://ta-lib.org/functions/gator.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInJawPeriod: Number of bars in the jaw's smoothed moving average. Default 13; range 1 to 100000; IntegerDefault selects the default.
  • optInJawShift: Bars ahead of the computing bar at which a chart draws the jaw. Default 8; range 0 to 100000; IntegerDefault selects the default.
  • optInTeethPeriod: Number of bars in the teeth's smoothed moving average. Default 8; range 1 to 100000; IntegerDefault selects the default.
  • optInTeethShift: Bars ahead of the computing bar at which a chart draws the teeth. Default 5; range 0 to 100000; IntegerDefault selects the default.
  • optInLipsPeriod: Number of bars in the lips' smoothed moving average. Default 5; range 1 to 100000; IntegerDefault selects the default.
  • optInLipsShift: Bars ahead of the computing bar at which a chart draws the lips. Default 3; range 0 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outUpper: Gap between the Jaw and the Teeth, zero or above.
  • outLower: Gap between the Teeth and the Lips, zero or below.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.GATORLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	upper := make([]float64, 252)
	lower := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.GATOR(0, len(high)-1, high, low, 13, 8, 8, 5, 5, 3, upper, lower)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("upper = [%.4f, ..., %.4f]\n", upper[0], upper[r.NBElement-1])
	fmt.Printf("lower = [%.4f, ..., %.4f]\n", lower[0], lower[r.NBElement-1])
}
Output:
237 values from bar 15:
upper = [6.6250, ..., 1.1017]
lower = [-3.2250, ..., -2.4656]

func (*Core) GATORDisplayShift

func (c *Core) GATORDisplayShift(optInJawPeriod, optInJawShift, optInTeethPeriod, optInTeethShift, optInLipsPeriod, optInLipsShift, outputIdx int) (int, error)

GATORDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.GATOR. The values are never shifted.

It takes the parameters of Core.GATOR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.GATORLookback rejects or an index that names no output.

func (*Core) GATORLookback

func (c *Core) GATORLookback(optInJawPeriod, optInJawShift, optInTeethPeriod, optInTeethShift, optInLipsPeriod, optInLipsShift int) (int, error)

GATORLookback returns how many leading bars Core.GATOR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.GATOR and returns BadParam for one out of range.

func (*Core) GATOROpen

func (c *Core) GATOROpen(inHigh, inLow []float64, optInJawPeriod, optInJawShift, optInTeethPeriod, optInTeethShift, optInLipsPeriod, optInLipsShift int) (*GATORStream, float64, float64, error)

GATOROpen opens a live GATORStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outUpper and outLower), the values Core.GATOR writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.GATOR.

The error is InsufficientHistory for a history of at most Core.GATORLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) GATOROpenAndFill

func (c *Core) GATOROpenAndFill(inHigh, inLow []float64, optInJawPeriod, optInJawShift, optInTeethPeriod, optInTeethShift, optInLipsPeriod, optInLipsShift int, outUpper, outLower []float64) (*GATORStream, OutRange, error)

GATOROpenAndFill opens a stream as Core.GATOROpen does and also writes the outputs over the whole history, as Core.GATOR writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.GATORLookback values and share no memory with an input or another output.

The errors are those of Core.GATOROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) HA

func (c *Core) HA(startIdx, endIdx int, inOpen, inHigh, inLow, inClose, outHAOpen, outHAHigh, outHALow, outHAClose []float64) (OutRange, error)

HA computes the Heikin-Ashi Candles over bars startIdx through endIdx.

Heikin-Ashi candles: an OHLC-to-OHLC transform that replaces each bar with a smoothed synthetic candle. The synthetic close is the bar's four-price average, the synthetic open is the midpoint of the previous synthetic candle's own open and close, and the synthetic high and low extend the raw extremes far enough to contain that pair.

Formula and more info at https://ta-lib.org/functions/ha.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outHAOpen: Heikin-Ashi open.
  • outHAHigh: Heikin-Ashi high.
  • outHALow: Heikin-Ashi low.
  • outHAClose: Heikin-Ashi close.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.HALookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdHA (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	haOpen := make([]float64, 252)
	haHigh := make([]float64, 252)
	haLow := make([]float64, 252)
	haClose := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.HA(0, len(open)-1, open, high, low, close, haOpen, haHigh, haLow, haClose)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("haOpen = [%.4f, ..., %.4f]\n", haOpen[0], haOpen[r.NBElement-1])
	fmt.Printf("haHigh = [%.4f, ..., %.4f]\n", haHigh[0], haHigh[r.NBElement-1])
	fmt.Printf("haLow = [%.4f, ..., %.4f]\n", haLow[0], haLow[r.NBElement-1])
	fmt.Printf("haClose = [%.4f, ..., %.4f]\n", haClose[0], haClose[r.NBElement-1])
}
Output:
252 values from bar 0:
haOpen = [109.8250, ..., 96.3273]
haHigh = [113.8000, ..., 96.3273]
haLow = [106.2000, ..., 91.8500]
haClose = [109.9125, ..., 94.6875]

func (*Core) HADisplayShift

func (c *Core) HADisplayShift(outputIdx int) (int, error)

HADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.HA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.HA, from 0, and returns BadParam for an index that names no output.

func (*Core) HALookback

func (c *Core) HALookback() (int, error)

HALookback returns how many leading bars Core.HA consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdHA (see Core.SetUnstablePeriod).

func (*Core) HAOpen

func (c *Core) HAOpen(inOpen, inHigh, inLow, inClose []float64) (*HAStream, float64, float64, float64, float64, error)

HAOpen opens a live HAStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outHAOpen, outHAHigh, outHALow and outHAClose), the values Core.HA writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.HALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) HAOpenAndFill

func (c *Core) HAOpenAndFill(inOpen, inHigh, inLow, inClose, outHAOpen, outHAHigh, outHALow, outHAClose []float64) (*HAStream, OutRange, error)

HAOpenAndFill opens a stream as Core.HAOpen does and also writes the outputs over the whole history, as Core.HA writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.HALookback values and share no memory with an input or another output.

The errors are those of Core.HAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) HMA

func (c *Core) HMA(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

HMA computes the Hull Moving Average over bars startIdx through endIdx.

Hull Moving Average, published by Alan Hull in 2005: a moving average built to track price with far less lag than an Core.SMA, Core.WMA or Core.EMA of the same length while staying smooth. It first removes lag by doubling a half-period Core.WMA and subtracting the full-period one — extrapolating the average toward current price — then smooths that de-lagged series with a final WMA over the square root of the period.

Formula and more info at https://ta-lib.org/functions/hma.

Inputs, each at least endIdx+1 long:

  • inReal: Source price series, close by convention.

Parameters:

  • optInTimePeriod: Number of bars in the full-period WMA; the half and square-root periods derive from it. Default 20; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Hull moving average of the input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.HMALookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.HMA(0, len(series)-1, series, 20, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
230 values from bar 22: [88.4667, ..., 96.2755]

func (*Core) HMADisplayShift

func (c *Core) HMADisplayShift(optInTimePeriod, outputIdx int) (int, error)

HMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.HMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.HMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.HMALookback rejects or an index that names no output.

func (*Core) HMALookback

func (c *Core) HMALookback(optInTimePeriod int) (int, error)

HMALookback returns how many leading bars Core.HMA consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.HMA and returns BadParam for one out of range.

func (*Core) HMAOpen

func (c *Core) HMAOpen(inReal []float64, optInTimePeriod int) (*HMAStream, float64, error)

HMAOpen opens a live HMAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.HMA writes there.

inReal is the history; the parameters are those of Core.HMA.

The error is InsufficientHistory for a history of at most Core.HMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) HMAOpenAndFill

func (c *Core) HMAOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*HMAStream, OutRange, error)

HMAOpenAndFill opens a stream as Core.HMAOpen does and also writes the outputs over the whole history, as Core.HMA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.HMALookback values and share no memory with an input or another output.

The errors are those of Core.HMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) HT_DCPERIOD

func (c *Core) HT_DCPERIOD(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

HT_DCPERIOD computes the Hilbert Transform - Dominant Cycle Period over bars startIdx through endIdx.

Hilbert Transform estimate of the dominant cycle period (in bars) of the price series. Outputs the smoothed instantaneous cycle period. Output is the estimated dominant cycle length in bars (clamped to 6-50).

Formula and more info at https://ta-lib.org/functions/ht_dcperiod.

Inputs, each at least endIdx+1 long:

  • inReal: Source price/value series.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Smoothed dominant cycle period in bars.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.HT_DCPERIODLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdHT_DCPERIOD (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) HT_DCPERIODDisplayShift

func (c *Core) HT_DCPERIODDisplayShift(outputIdx int) (int, error)

HT_DCPERIODDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.HT_DCPERIOD. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.HT_DCPERIOD, from 0, and returns BadParam for an index that names no output.

func (*Core) HT_DCPERIODLookback

func (c *Core) HT_DCPERIODLookback() (int, error)

HT_DCPERIODLookback returns how many leading bars Core.HT_DCPERIOD consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdHT_DCPERIOD (see Core.SetUnstablePeriod).

func (*Core) HT_DCPERIODOpen

func (c *Core) HT_DCPERIODOpen(inReal []float64) (*HT_DCPERIODStream, float64, error)

HT_DCPERIODOpen opens a live HT_DCPERIODStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.HT_DCPERIOD writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.HT_DCPERIODLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) HT_DCPERIODOpenAndFill

func (c *Core) HT_DCPERIODOpenAndFill(inReal, outReal []float64) (*HT_DCPERIODStream, OutRange, error)

HT_DCPERIODOpenAndFill opens a stream as Core.HT_DCPERIODOpen does and also writes the outputs over the whole history, as Core.HT_DCPERIOD writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.HT_DCPERIODLookback values and share no memory with an input or another output.

The errors are those of Core.HT_DCPERIODOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) HT_DCPHASE

func (c *Core) HT_DCPHASE(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

HT_DCPHASE computes the Hilbert Transform - Dominant Cycle Phase over bars startIdx through endIdx.

Hilbert Transform Dominant Cycle Phase: the instantaneous phase (in degrees) of the dominant market cycle, derived from a homodyne discriminator on a Hilbert-transformed, smoothed price. One real output per bar. Output is degrees, in the range −45 to 315 (a full 360° span).

Formula and more info at https://ta-lib.org/functions/ht_dcphase.

Inputs, each at least endIdx+1 long:

  • inReal: Price series to analyze.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Dominant cycle phase in degrees.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.HT_DCPHASELookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdHT_DCPHASE (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) HT_DCPHASEDisplayShift

func (c *Core) HT_DCPHASEDisplayShift(outputIdx int) (int, error)

HT_DCPHASEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.HT_DCPHASE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.HT_DCPHASE, from 0, and returns BadParam for an index that names no output.

func (*Core) HT_DCPHASELookback

func (c *Core) HT_DCPHASELookback() (int, error)

HT_DCPHASELookback returns how many leading bars Core.HT_DCPHASE consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdHT_DCPHASE (see Core.SetUnstablePeriod).

func (*Core) HT_DCPHASEOpen

func (c *Core) HT_DCPHASEOpen(inReal []float64) (*HT_DCPHASEStream, float64, error)

HT_DCPHASEOpen opens a live HT_DCPHASEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.HT_DCPHASE writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.HT_DCPHASELookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) HT_DCPHASEOpenAndFill

func (c *Core) HT_DCPHASEOpenAndFill(inReal, outReal []float64) (*HT_DCPHASEStream, OutRange, error)

HT_DCPHASEOpenAndFill opens a stream as Core.HT_DCPHASEOpen does and also writes the outputs over the whole history, as Core.HT_DCPHASE writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.HT_DCPHASELookback values and share no memory with an input or another output.

The errors are those of Core.HT_DCPHASEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) HT_PHASOR

func (c *Core) HT_PHASOR(startIdx, endIdx int, inReal, outInPhase, outQuadrature []float64) (OutRange, error)

HT_PHASOR computes the Hilbert Transform - Phasor Components over bars startIdx through endIdx.

Hilbert Transform indicator that decomposes the price series into its in-phase (I) and quadrature (Q) phasor components. Shares the same detrend/Hilbert machinery as the other HT_* cycle functions.

Formula and more info at https://ta-lib.org/functions/ht_phasor.

Inputs, each at least endIdx+1 long:

  • inReal: Source price series.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInPhase: In-phase component (detrender delayed 3 bars)
  • outQuadrature: Quadrature component (Q1 of the Hilbert Transform)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.HT_PHASORLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdHT_PHASOR (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) HT_PHASORDisplayShift

func (c *Core) HT_PHASORDisplayShift(outputIdx int) (int, error)

HT_PHASORDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.HT_PHASOR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.HT_PHASOR, from 0, and returns BadParam for an index that names no output.

func (*Core) HT_PHASORLookback

func (c *Core) HT_PHASORLookback() (int, error)

HT_PHASORLookback returns how many leading bars Core.HT_PHASOR consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdHT_PHASOR (see Core.SetUnstablePeriod).

func (*Core) HT_PHASOROpen

func (c *Core) HT_PHASOROpen(inReal []float64) (*HT_PHASORStream, float64, float64, error)

HT_PHASOROpen opens a live HT_PHASORStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outInPhase and outQuadrature), the values Core.HT_PHASOR writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.HT_PHASORLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) HT_PHASOROpenAndFill

func (c *Core) HT_PHASOROpenAndFill(inReal, outInPhase, outQuadrature []float64) (*HT_PHASORStream, OutRange, error)

HT_PHASOROpenAndFill opens a stream as Core.HT_PHASOROpen does and also writes the outputs over the whole history, as Core.HT_PHASOR writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.HT_PHASORLookback values and share no memory with an input or another output.

The errors are those of Core.HT_PHASOROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) HT_SINE

func (c *Core) HT_SINE(startIdx, endIdx int, inReal, outSine, outLeadSine []float64) (OutRange, error)

HT_SINE computes the Hilbert Transform - SineWave over bars startIdx through endIdx.

Hilbert Transform SineWave: derives the dominant-cycle phase from price and emits its sine plus a 45-degree-lead sine. The two curves cross near cycle turning points. outSine and outLeadSine crossing marks cycle turning points.

Formula and more info at https://ta-lib.org/functions/ht_sine.

Inputs, each at least endIdx+1 long:

  • inReal: Source price series.

Outputs, each at least as long as the values written (the input length always suffices):

  • outSine: Sine of the dominant-cycle phase.
  • outLeadSine: Sine of the phase advanced 45 degrees (lead)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.HT_SINELookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdHT_SINE (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) HT_SINEDisplayShift

func (c *Core) HT_SINEDisplayShift(outputIdx int) (int, error)

HT_SINEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.HT_SINE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.HT_SINE, from 0, and returns BadParam for an index that names no output.

func (*Core) HT_SINELookback

func (c *Core) HT_SINELookback() (int, error)

HT_SINELookback returns how many leading bars Core.HT_SINE consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdHT_SINE (see Core.SetUnstablePeriod).

func (*Core) HT_SINEOpen

func (c *Core) HT_SINEOpen(inReal []float64) (*HT_SINEStream, float64, float64, error)

HT_SINEOpen opens a live HT_SINEStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outSine and outLeadSine), the values Core.HT_SINE writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.HT_SINELookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) HT_SINEOpenAndFill

func (c *Core) HT_SINEOpenAndFill(inReal, outSine, outLeadSine []float64) (*HT_SINEStream, OutRange, error)

HT_SINEOpenAndFill opens a stream as Core.HT_SINEOpen does and also writes the outputs over the whole history, as Core.HT_SINE writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.HT_SINELookback values and share no memory with an input or another output.

The errors are those of Core.HT_SINEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) HT_TRENDLINE

func (c *Core) HT_TRENDLINE(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

HT_TRENDLINE computes the Hilbert Transform - Instantaneous Trendline over bars startIdx through endIdx.

Ehlers' Hilbert Transform Instantaneous Trendline: a smoothed, low-lag overlay whose averaging window adapts to the dominant cycle period measured via Hilbert-transform quadrature (I/Q) analysis of price.

Formula and more info at https://ta-lib.org/functions/ht_trendline.

Inputs, each at least endIdx+1 long:

  • inReal: Source price series.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Instantaneous trendline value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.HT_TRENDLINELookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdHT_TRENDLINE (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) HT_TRENDLINEDisplayShift

func (c *Core) HT_TRENDLINEDisplayShift(outputIdx int) (int, error)

HT_TRENDLINEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.HT_TRENDLINE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.HT_TRENDLINE, from 0, and returns BadParam for an index that names no output.

func (*Core) HT_TRENDLINELookback

func (c *Core) HT_TRENDLINELookback() (int, error)

HT_TRENDLINELookback returns how many leading bars Core.HT_TRENDLINE consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdHT_TRENDLINE (see Core.SetUnstablePeriod).

func (*Core) HT_TRENDLINEOpen

func (c *Core) HT_TRENDLINEOpen(inReal []float64) (*HT_TRENDLINEStream, float64, error)

HT_TRENDLINEOpen opens a live HT_TRENDLINEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.HT_TRENDLINE writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.HT_TRENDLINELookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) HT_TRENDLINEOpenAndFill

func (c *Core) HT_TRENDLINEOpenAndFill(inReal, outReal []float64) (*HT_TRENDLINEStream, OutRange, error)

HT_TRENDLINEOpenAndFill opens a stream as Core.HT_TRENDLINEOpen does and also writes the outputs over the whole history, as Core.HT_TRENDLINE writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.HT_TRENDLINELookback values and share no memory with an input or another output.

The errors are those of Core.HT_TRENDLINEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) HT_TRENDMODE

func (c *Core) HT_TRENDMODE(startIdx, endIdx int, inReal []float64, outInteger []int32) (OutRange, error)

HT_TRENDMODE computes the Hilbert Transform - Trend vs Cycle Mode over bars startIdx through endIdx.

Hilbert Transform classifier that labels each bar 1 (trending — favor trend-following) or 0 (cycling — favor mean-reversion). Built from the same MAMA dominant-cycle/phase DSP plus a SineWave/trendline test used across the other HT_* functions.

Formula and more info at https://ta-lib.org/functions/ht_trendmode.

Inputs, each at least endIdx+1 long:

  • inReal: Source price series.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: 1 = trend mode, 0 = cycle mode.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.HT_TRENDMODELookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdHT_TRENDMODE (see Core.SetUnstablePeriod).

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short or an output empty or too short.

func (*Core) HT_TRENDMODEDisplayShift

func (c *Core) HT_TRENDMODEDisplayShift(outputIdx int) (int, error)

HT_TRENDMODEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.HT_TRENDMODE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.HT_TRENDMODE, from 0, and returns BadParam for an index that names no output.

func (*Core) HT_TRENDMODELookback

func (c *Core) HT_TRENDMODELookback() (int, error)

HT_TRENDMODELookback returns how many leading bars Core.HT_TRENDMODE consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdHT_TRENDMODE (see Core.SetUnstablePeriod).

func (*Core) HT_TRENDMODEOpen

func (c *Core) HT_TRENDMODEOpen(inReal []float64) (*HT_TRENDMODEStream, int32, error)

HT_TRENDMODEOpen opens a live HT_TRENDMODEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.HT_TRENDMODE writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.HT_TRENDMODELookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) HT_TRENDMODEOpenAndFill

func (c *Core) HT_TRENDMODEOpenAndFill(inReal []float64, outInteger []int32) (*HT_TRENDMODEStream, OutRange, error)

HT_TRENDMODEOpenAndFill opens a stream as Core.HT_TRENDMODEOpen does and also writes the outputs over the whole history, as Core.HT_TRENDMODE writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.HT_TRENDMODELookback values and share no memory with an input or another output.

The errors are those of Core.HT_TRENDMODEOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) IBS

func (c *Core) IBS(startIdx, endIdx int, inHigh, inLow, inClose, outReal []float64) (OutRange, error)

IBS computes the Internal Bar Strength over bars startIdx through endIdx.

Internal Bar Strength: where the close sits inside its own bar's range. It is 0 when the bar closes at its low, 1 at its high and 0.5 at the midpoint, and it reads one bar only, with no window and no state.

Formula and more info at https://ta-lib.org/functions/ibs.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Position of the close within the bar's range, 0 to 1 on a bar with range.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.IBSLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.IBS(0, len(high)-1, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [0.7105, ..., 0.8636]

func (*Core) IBSDisplayShift

func (c *Core) IBSDisplayShift(outputIdx int) (int, error)

IBSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.IBS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.IBS, from 0, and returns BadParam for an index that names no output.

func (*Core) IBSLookback

func (c *Core) IBSLookback() (int, error)

IBSLookback returns how many leading bars Core.IBS consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) IBSOpen

func (c *Core) IBSOpen(inHigh, inLow, inClose []float64) (*IBSStream, float64, error)

IBSOpen opens a live IBSStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.IBS writes there.

inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.IBSLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) IBSOpenAndFill

func (c *Core) IBSOpenAndFill(inHigh, inLow, inClose, outReal []float64) (*IBSStream, OutRange, error)

IBSOpenAndFill opens a stream as Core.IBSOpen does and also writes the outputs over the whole history, as Core.IBS writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.IBSLookback values and share no memory with an input or another output.

The errors are those of Core.IBSOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ICHIMOKU

func (c *Core) ICHIMOKU(startIdx, endIdx int, inHigh, inLow []float64, optInTenkanPeriod, optInKijunPeriod, optInSenkouBPeriod int, outTenkanSen, outKijunSen, outSenkouSpanA, outSenkouSpanB []float64) (OutRange, error)

ICHIMOKU computes the Ichimoku Kinko Hyo over bars startIdx through endIdx.

Ichimoku Kinko Hyo, "one glance equilibrium chart": four lines built from highs and lows alone. Goichi Hosoda's reading is that a market's balance is visible without any smoothing — each line is the midpoint of a window, the mean of its highest high and its lowest low, so it marks the level at which that stretch of trading was evenly divided. The conversion line turns fastest, the base line is the reference, and the two leading spans are drawn ahead of price, where the band between them is read as support or resistance before it is reached.

Formula and more info at https://ta-lib.org/functions/ichimoku.

Inputs, each at least endIdx+1 long:

  • inHigh: High price series.
  • inLow: Low price series.

Parameters:

  • optInTenkanPeriod: Period of the conversion line. Default 9; range 2 to 100000; IntegerDefault selects the default.
  • optInKijunPeriod: Period of the base line, and the forward shift of the two spans. Default 26; range 2 to 100000; IntegerDefault selects the default.
  • optInSenkouBPeriod: Period of the second leading span. Default 52; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outTenkanSen: Conversion line.
  • outKijunSen: Base line.
  • outSenkouSpanA: First leading span, drawn ahead by the base period.
  • outSenkouSpanB: Second leading span, drawn ahead by the base period.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ICHIMOKULookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	tenkanSen := make([]float64, 252)
	kijunSen := make([]float64, 252)
	senkouSpanA := make([]float64, 252)
	senkouSpanB := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ICHIMOKU(0, len(high)-1, high, low, 9, 26, 52,
		tenkanSen, kijunSen, senkouSpanA, senkouSpanB)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("tenkanSen = [%.4f, ..., %.4f]\n", tenkanSen[0], tenkanSen[r.NBElement-1])
	fmt.Printf("kijunSen = [%.4f, ..., %.4f]\n", kijunSen[0], kijunSen[r.NBElement-1])
	fmt.Printf("senkouSpanA = [%.4f, ..., %.4f]\n", senkouSpanA[0], senkouSpanA[r.NBElement-1])
	fmt.Printf("senkouSpanB = [%.4f, ..., %.4f]\n", senkouSpanB[0], senkouSpanB[r.NBElement-1])
}
Output:
201 values from bar 51:
tenkanSen = [98.4500, ..., 99.3750]
kijunSen = [100.6250, ..., 100.8750]
senkouSpanA = [99.5375, ..., 100.1250]
senkouSpanB = [100.6250, ..., 99.1250]

func (*Core) ICHIMOKUDisplayShift

func (c *Core) ICHIMOKUDisplayShift(optInTenkanPeriod, optInKijunPeriod, optInSenkouBPeriod, outputIdx int) (int, error)

ICHIMOKUDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ICHIMOKU. The values are never shifted.

It takes the parameters of Core.ICHIMOKU followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ICHIMOKULookback rejects or an index that names no output.

func (*Core) ICHIMOKULookback

func (c *Core) ICHIMOKULookback(optInTenkanPeriod, optInKijunPeriod, optInSenkouBPeriod int) (int, error)

ICHIMOKULookback returns how many leading bars Core.ICHIMOKU consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ICHIMOKU and returns BadParam for one out of range.

func (*Core) ICHIMOKUOpen

func (c *Core) ICHIMOKUOpen(inHigh, inLow []float64, optInTenkanPeriod, optInKijunPeriod, optInSenkouBPeriod int) (*ICHIMOKUStream, float64, float64, float64, float64, error)

ICHIMOKUOpen opens a live ICHIMOKUStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outTenkanSen, outKijunSen, outSenkouSpanA and outSenkouSpanB), the values Core.ICHIMOKU writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.ICHIMOKU.

The error is InsufficientHistory for a history of at most Core.ICHIMOKULookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ICHIMOKUOpenAndFill

func (c *Core) ICHIMOKUOpenAndFill(inHigh, inLow []float64, optInTenkanPeriod, optInKijunPeriod, optInSenkouBPeriod int, outTenkanSen, outKijunSen, outSenkouSpanA, outSenkouSpanB []float64) (*ICHIMOKUStream, OutRange, error)

ICHIMOKUOpenAndFill opens a stream as Core.ICHIMOKUOpen does and also writes the outputs over the whole history, as Core.ICHIMOKU writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.ICHIMOKULookback values and share no memory with an input or another output.

The errors are those of Core.ICHIMOKUOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) IMI

func (c *Core) IMI(startIdx, endIdx int, inOpen, inClose []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

IMI computes the Intraday Momentum Index over bars startIdx through endIdx.

Intraday Momentum Index: an RSI-like 0-100 oscillator built from the open-to-close body of each bar. Over a rolling window it ratios cumulative up-body moves against total up+down body moves.

Formula and more info at https://ta-lib.org/functions/imi.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Rolling window length for the up/down body sums. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: IMI oscillator value, 0-100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.IMILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.IMI(0, len(open)-1, open, close, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [15.1568, ..., 12.2449]

func (*Core) IMIDisplayShift

func (c *Core) IMIDisplayShift(optInTimePeriod, outputIdx int) (int, error)

IMIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.IMI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.IMI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.IMILookback rejects or an index that names no output.

func (*Core) IMILookback

func (c *Core) IMILookback(optInTimePeriod int) (int, error)

IMILookback returns how many leading bars Core.IMI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.IMI and returns BadParam for one out of range.

func (*Core) IMIOpen

func (c *Core) IMIOpen(inOpen, inClose []float64, optInTimePeriod int) (*IMIStream, float64, error)

IMIOpen opens a live IMIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.IMI writes there.

inOpen and inClose are the histories, of one length; the parameters are those of Core.IMI.

The error is InsufficientHistory for a history of at most Core.IMILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) IMIOpenAndFill

func (c *Core) IMIOpenAndFill(inOpen, inClose []float64, optInTimePeriod int, outReal []float64) (*IMIStream, OutRange, error)

IMIOpenAndFill opens a stream as Core.IMIOpen does and also writes the outputs over the whole history, as Core.IMI writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.IMILookback values and share no memory with an input or another output.

The errors are those of Core.IMIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) KAMA

func (c *Core) KAMA(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

KAMA computes the Kaufman Adaptive Moving Average over bars startIdx through endIdx.

Kaufman Adaptive Moving Average: an EMA whose smoothing factor adapts each bar to an efficiency ratio (directional move vs. total volatility). Reacts fast in trends and smooths in ranging markets. Flat KAMA = non-trending/ranging market. KAMA tracking price closely = efficient trend.

Formula and more info at https://ta-lib.org/functions/kama.

Inputs, each at least endIdx+1 long:

  • inReal: Source price series.

Parameters:

  • optInTimePeriod: Lookback window for the efficiency ratio. Default 30; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Adaptive moving average line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.KAMALookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdKAMA (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.KAMA(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
222 values from bar 30: [94.2222, ..., 101.7081]

func (*Core) KAMADisplayShift

func (c *Core) KAMADisplayShift(optInTimePeriod, outputIdx int) (int, error)

KAMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.KAMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.KAMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.KAMALookback rejects or an index that names no output.

func (*Core) KAMALookback

func (c *Core) KAMALookback(optInTimePeriod int) (int, error)

KAMALookback returns how many leading bars Core.KAMA consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdKAMA (see Core.SetUnstablePeriod).

It takes the parameters of Core.KAMA and returns BadParam for one out of range.

func (*Core) KAMAOpen

func (c *Core) KAMAOpen(inReal []float64, optInTimePeriod int) (*KAMAStream, float64, error)

KAMAOpen opens a live KAMAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.KAMA writes there.

inReal is the history; the parameters are those of Core.KAMA.

The error is InsufficientHistory for a history of at most Core.KAMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) KAMAOpenAndFill

func (c *Core) KAMAOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*KAMAStream, OutRange, error)

KAMAOpenAndFill opens a stream as Core.KAMAOpen does and also writes the outputs over the whole history, as Core.KAMA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.KAMALookback values and share no memory with an input or another output.

The errors are those of Core.KAMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) KC

func (c *Core) KC(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod, optInATRPeriod int, optInNbDev float64, outRealUpperBand, outRealMiddleBand, outRealLowerBand []float64) (OutRange, error)

KC computes the Keltner Channels over bars startIdx through endIdx.

Keltner Channels: three overlap lines around price. The centre line is an exponential moving average of the typical price; the outer bands sit a multiple of the Average True Range above and below it. The band width tracks volatility, so the channel widens in fast markets and narrows in quiet ones.

Formula and more info at https://ta-lib.org/functions/kc.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Smoothing period of the typical price moving average. Default 20; range 2 to 100000; IntegerDefault selects the default.
  • optInATRPeriod: Smoothing period of the Average True Range. Default 10; range 1 to 100000; IntegerDefault selects the default.
  • optInNbDev: Multiplier applied to the Average True Range. Default 2; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outRealUpperBand: Centre line plus the scaled Average True Range.
  • outRealMiddleBand: Exponential moving average of the typical price.
  • outRealLowerBand: Centre line minus the scaled Average True Range.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.KCLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	upperBand := make([]float64, 252)
	middleBand := make([]float64, 252)
	lowerBand := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.KC(0, len(high)-1, high, low, close, 20, 10, 2, upperBand, middleBand, lowerBand)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("upperBand = [%.4f, ..., %.4f]\n", upperBand[0], upperBand[r.NBElement-1])
	fmt.Printf("middleBand = [%.4f, ..., %.4f]\n", middleBand[0], middleBand[r.NBElement-1])
	fmt.Printf("lowerBand = [%.4f, ..., %.4f]\n", lowerBand[0], lowerBand[r.NBElement-1])
}
Output:
233 values from bar 19:
upperBand = [108.4850, ..., 110.5738]
middleBand = [97.1250, ..., 99.1498]
lowerBand = [85.7650, ..., 87.7259]

func (*Core) KCDisplayShift

func (c *Core) KCDisplayShift(optInTimePeriod, optInATRPeriod int, optInNbDev float64, outputIdx int) (int, error)

KCDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.KC. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.KC followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.KCLookback rejects or an index that names no output.

func (*Core) KCLookback

func (c *Core) KCLookback(optInTimePeriod, optInATRPeriod int, optInNbDev float64) (int, error)

KCLookback returns how many leading bars Core.KC consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.KC and returns BadParam for one out of range.

func (*Core) KCOpen

func (c *Core) KCOpen(inHigh, inLow, inClose []float64, optInTimePeriod, optInATRPeriod int, optInNbDev float64) (*KCStream, float64, float64, float64, error)

KCOpen opens a live KCStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outRealUpperBand, outRealMiddleBand and outRealLowerBand), the values Core.KC writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.KC.

The error is InsufficientHistory for a history of at most Core.KCLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) KCOpenAndFill

func (c *Core) KCOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod, optInATRPeriod int, optInNbDev float64, outRealUpperBand, outRealMiddleBand, outRealLowerBand []float64) (*KCStream, OutRange, error)

KCOpenAndFill opens a stream as Core.KCOpen does and also writes the outputs over the whole history, as Core.KC writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.KCLookback values and share no memory with an input or another output.

The errors are those of Core.KCOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) KDJ

func (c *Core) KDJ(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInFastK_Period, optInSlowK_Period int, optInSlowK_MAType MAType, optInSlowD_Period int, optInSlowD_MAType MAType, outK, outD, outJ []float64) (OutRange, error)

KDJ computes the KDJ Stochastic over bars startIdx through endIdx.

The stochastic oscillator as it is drawn on Chinese-market platforms: the Slow-%K and Slow-%D lines plus a third line J that amplifies the gap between them. K and D are read like any stochastic — above 80 overbought, below 20 oversold, a K/D crossing signalling a momentum shift — while J is a divergence gauge whose excursions outside the 0-100 band mark the strongest moves. Both smoothing stages default to Wilder's moving average, which is the smoother the original formula language specifies; selecting a simple moving average for both reproduces the classic Slow Stochastic with a J line attached.

Formula and more info at https://ta-lib.org/functions/kdj.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInFastK_Period: Lookback window for the raw stochastic high-low range. Default 9; range 1 to 100000; IntegerDefault selects the default.
  • optInSlowK_Period: Smoothing period turning the raw stochastic into K. Default 3; range 1 to 10000; IntegerDefault selects the default.
  • optInSlowK_MAType: MA type used to smooth into K. Default MATypeRMA; MATypeDEFAULT selects the default.
  • optInSlowD_Period: Smoothing period for the D signal line. Default 3; range 1 to 10000; IntegerDefault selects the default.
  • optInSlowD_MAType: MA type used for the D line. Default MATypeRMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outK: Raw stochastic smoothed by SlowK_Period MA.
  • outD: Signal line: K smoothed by SlowD_Period MA.
  • outJ: Divergence line, three parts K less two parts D.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.KDJLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	k := make([]float64, 252)
	d := make([]float64, 252)
	j := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.KDJ(0, len(high)-1, high, low, close, 9, 3, talib.MATypeRMA, 3, talib.MATypeRMA,
		k, d, j)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("k = [%.4f, ..., %.4f]\n", k[0], k[r.NBElement-1])
	fmt.Printf("d = [%.4f, ..., %.4f]\n", d[0], d[r.NBElement-1])
	fmt.Printf("j = [%.4f, ..., %.4f]\n", j[0], j[r.NBElement-1])
}
Output:
240 values from bar 12:
k = [17.5397, ..., 20.1562]
d = [18.8246, ..., 23.8961]
j = [14.9697, ..., 12.6766]

func (*Core) KDJDisplayShift

func (c *Core) KDJDisplayShift(optInFastK_Period, optInSlowK_Period int, optInSlowK_MAType MAType, optInSlowD_Period int, optInSlowD_MAType MAType, outputIdx int) (int, error)

KDJDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.KDJ. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.KDJ followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.KDJLookback rejects or an index that names no output.

func (*Core) KDJLookback

func (c *Core) KDJLookback(optInFastK_Period, optInSlowK_Period int, optInSlowK_MAType MAType, optInSlowD_Period int, optInSlowD_MAType MAType) (int, error)

KDJLookback returns how many leading bars Core.KDJ consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.KDJ and returns BadParam for one out of range.

func (*Core) KDJOpen

func (c *Core) KDJOpen(inHigh, inLow, inClose []float64, optInFastK_Period, optInSlowK_Period int, optInSlowK_MAType MAType, optInSlowD_Period int, optInSlowD_MAType MAType) (*KDJStream, float64, float64, float64, error)

KDJOpen opens a live KDJStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outK, outD and outJ), the values Core.KDJ writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.KDJ.

The error is InsufficientHistory for a history of at most Core.KDJLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) KDJOpenAndFill

func (c *Core) KDJOpenAndFill(inHigh, inLow, inClose []float64, optInFastK_Period, optInSlowK_Period int, optInSlowK_MAType MAType, optInSlowD_Period int, optInSlowD_MAType MAType, outK, outD, outJ []float64) (*KDJStream, OutRange, error)

KDJOpenAndFill opens a stream as Core.KDJOpen does and also writes the outputs over the whole history, as Core.KDJ writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.KDJLookback values and share no memory with an input or another output.

The errors are those of Core.KDJOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) KST

func (c *Core) KST(startIdx, endIdx int, inReal []float64, optInROC1Period, optInROC2Period, optInROC3Period, optInROC4Period, optInSMA1Period, optInSMA2Period, optInSMA3Period, optInSMA4Period, optInSignalPeriod int, outKST, outKSTSignal []float64) (OutRange, error)

KST computes the Know Sure Thing (Pring) over bars startIdx through endIdx.

Know Sure Thing: Martin J. Pring's momentum oscillator, a weighted sum of four smoothed rates of change with a moving-average signal line.

Formula and more info at https://ta-lib.org/functions/kst.

Inputs, each at least endIdx+1 long:

  • inReal: Source price series (canonically the close)

Parameters:

  • optInROC1Period: Rate-of-change period of leg 1 (weight 1) Default 10; range 1 to 100000; IntegerDefault selects the default.
  • optInROC2Period: Rate-of-change period of leg 2 (weight 2) Default 15; range 1 to 100000; IntegerDefault selects the default.
  • optInROC3Period: Rate-of-change period of leg 3 (weight 3) Default 20; range 1 to 100000; IntegerDefault selects the default.
  • optInROC4Period: Rate-of-change period of leg 4 (weight 4) Default 30; range 1 to 100000; IntegerDefault selects the default.
  • optInSMA1Period: Simple-moving-average period smoothing leg 1. Default 10; range 1 to 100000; IntegerDefault selects the default.
  • optInSMA2Period: Simple-moving-average period smoothing leg 2. Default 10; range 1 to 100000; IntegerDefault selects the default.
  • optInSMA3Period: Simple-moving-average period smoothing leg 3. Default 10; range 1 to 100000; IntegerDefault selects the default.
  • optInSMA4Period: Simple-moving-average period smoothing leg 4. Default 15; range 1 to 100000; IntegerDefault selects the default.
  • optInSignalPeriod: Simple-moving-average period of the signal line. Default 9; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outKST: Know Sure Thing line.
  • outKSTSignal: Simple moving average of the line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.KSTLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	kst := make([]float64, 252)
	kstSignal := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.KST(0, len(series)-1, series, 10, 15, 20, 30, 10, 10, 10, 15, 9, kst, kstSignal)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("kst = [%.4f, ..., %.4f]\n", kst[0], kst[r.NBElement-1])
	fmt.Printf("kstSignal = [%.4f, ..., %.4f]\n", kstSignal[0], kstSignal[r.NBElement-1])
}
Output:
200 values from bar 52:
kst = [50.9384, ..., 65.5115]
kstSignal = [92.4793, ..., 97.9562]

func (*Core) KSTDisplayShift

func (c *Core) KSTDisplayShift(optInROC1Period, optInROC2Period, optInROC3Period, optInROC4Period, optInSMA1Period, optInSMA2Period, optInSMA3Period, optInSMA4Period, optInSignalPeriod, outputIdx int) (int, error)

KSTDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.KST. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.KST followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.KSTLookback rejects or an index that names no output.

func (*Core) KSTEXT

func (c *Core) KSTEXT(startIdx, endIdx int, inReal []float64, optInROC1Period, optInROC2Period, optInROC3Period, optInROC4Period, optInMA1Period, optInMA2Period, optInMA3Period, optInMA4Period, optInSignalPeriod int, optInROCMAType, optInSignalMAType MAType, outKST, outKSTSignal []float64) (OutRange, error)

KSTEXT computes the Know Sure Thing with controllable MA type over bars startIdx through endIdx.

Know Sure Thing with selectable moving averages: Pring's weighted sum of four smoothed rates of change, with a signal line. One MA type smooths the four legs and another the signal line.

Formula and more info at https://ta-lib.org/functions/kstext.

Inputs, each at least endIdx+1 long:

  • inReal: Source price series (canonically the close)

Parameters:

  • optInROC1Period: Rate-of-change period of leg 1 (weight 1) Default 10; range 1 to 100000; IntegerDefault selects the default.
  • optInROC2Period: Rate-of-change period of leg 2 (weight 2) Default 15; range 1 to 100000; IntegerDefault selects the default.
  • optInROC3Period: Rate-of-change period of leg 3 (weight 3) Default 20; range 1 to 100000; IntegerDefault selects the default.
  • optInROC4Period: Rate-of-change period of leg 4 (weight 4) Default 30; range 1 to 100000; IntegerDefault selects the default.
  • optInMA1Period: Period of the MA smoothing leg 1. Default 10; range 1 to 10000; IntegerDefault selects the default.
  • optInMA2Period: Period of the MA smoothing leg 2. Default 10; range 1 to 10000; IntegerDefault selects the default.
  • optInMA3Period: Period of the MA smoothing leg 3. Default 10; range 1 to 10000; IntegerDefault selects the default.
  • optInMA4Period: Period of the MA smoothing leg 4. Default 15; range 1 to 10000; IntegerDefault selects the default.
  • optInSignalPeriod: Period of the signal-line MA. Default 9; range 1 to 10000; IntegerDefault selects the default.
  • optInROCMAType: MA type smoothing the four legs. Default MATypeSMA; MATypeDEFAULT selects the default.
  • optInSignalMAType: MA type for the signal line. Default MATypeSMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outKST: Know Sure Thing line.
  • outKSTSignal: Signal line: MA of the line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.KSTEXTLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	kst := make([]float64, 252)
	kstSignal := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.KSTEXT(0, len(series)-1, series, 10, 15, 20, 30, 10, 10, 10, 15, 9, talib.MATypeSMA, talib.MATypeSMA,
		kst, kstSignal)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("kst = [%.4f, ..., %.4f]\n", kst[0], kst[r.NBElement-1])
	fmt.Printf("kstSignal = [%.4f, ..., %.4f]\n", kstSignal[0], kstSignal[r.NBElement-1])
}
Output:
200 values from bar 52:
kst = [50.9384, ..., 65.5115]
kstSignal = [92.4793, ..., 97.9562]

func (*Core) KSTEXTDisplayShift

func (c *Core) KSTEXTDisplayShift(optInROC1Period, optInROC2Period, optInROC3Period, optInROC4Period, optInMA1Period, optInMA2Period, optInMA3Period, optInMA4Period, optInSignalPeriod int, optInROCMAType, optInSignalMAType MAType, outputIdx int) (int, error)

KSTEXTDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.KSTEXT. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.KSTEXT followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.KSTEXTLookback rejects or an index that names no output.

func (*Core) KSTEXTLookback

func (c *Core) KSTEXTLookback(optInROC1Period, optInROC2Period, optInROC3Period, optInROC4Period, optInMA1Period, optInMA2Period, optInMA3Period, optInMA4Period, optInSignalPeriod int, optInROCMAType, optInSignalMAType MAType) (int, error)

KSTEXTLookback returns how many leading bars Core.KSTEXT consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.KSTEXT and returns BadParam for one out of range.

func (*Core) KSTEXTOpen

func (c *Core) KSTEXTOpen(inReal []float64, optInROC1Period, optInROC2Period, optInROC3Period, optInROC4Period, optInMA1Period, optInMA2Period, optInMA3Period, optInMA4Period, optInSignalPeriod int, optInROCMAType, optInSignalMAType MAType) (*KSTEXTStream, float64, float64, error)

KSTEXTOpen opens a live KSTEXTStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outKST and outKSTSignal), the values Core.KSTEXT writes there.

inReal is the history; the parameters are those of Core.KSTEXT.

The error is InsufficientHistory for a history of at most Core.KSTEXTLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) KSTEXTOpenAndFill

func (c *Core) KSTEXTOpenAndFill(inReal []float64, optInROC1Period, optInROC2Period, optInROC3Period, optInROC4Period, optInMA1Period, optInMA2Period, optInMA3Period, optInMA4Period, optInSignalPeriod int, optInROCMAType, optInSignalMAType MAType, outKST, outKSTSignal []float64) (*KSTEXTStream, OutRange, error)

KSTEXTOpenAndFill opens a stream as Core.KSTEXTOpen does and also writes the outputs over the whole history, as Core.KSTEXT writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.KSTEXTLookback values and share no memory with an input or another output.

The errors are those of Core.KSTEXTOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) KSTLookback

func (c *Core) KSTLookback(optInROC1Period, optInROC2Period, optInROC3Period, optInROC4Period, optInSMA1Period, optInSMA2Period, optInSMA3Period, optInSMA4Period, optInSignalPeriod int) (int, error)

KSTLookback returns how many leading bars Core.KST consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.KST and returns BadParam for one out of range.

func (*Core) KSTOpen

func (c *Core) KSTOpen(inReal []float64, optInROC1Period, optInROC2Period, optInROC3Period, optInROC4Period, optInSMA1Period, optInSMA2Period, optInSMA3Period, optInSMA4Period, optInSignalPeriod int) (*KSTStream, float64, float64, error)

KSTOpen opens a live KSTStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outKST and outKSTSignal), the values Core.KST writes there.

inReal is the history; the parameters are those of Core.KST.

The error is InsufficientHistory for a history of at most Core.KSTLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) KSTOpenAndFill

func (c *Core) KSTOpenAndFill(inReal []float64, optInROC1Period, optInROC2Period, optInROC3Period, optInROC4Period, optInSMA1Period, optInSMA2Period, optInSMA3Period, optInSMA4Period, optInSignalPeriod int, outKST, outKSTSignal []float64) (*KSTStream, OutRange, error)

KSTOpenAndFill opens a stream as Core.KSTOpen does and also writes the outputs over the whole history, as Core.KST writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.KSTLookback values and share no memory with an input or another output.

The errors are those of Core.KSTOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) KURTOSIS

func (c *Core) KURTOSIS(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

KURTOSIS computes the Rolling Excess Kurtosis over bars startIdx through endIdx.

An estimate, from the trailing window, of the excess kurtosis of the distribution its values come from: the fourth standardised moment minus 3, so a normal distribution reads 0. A tail-weight measure: above 0 the distribution has heavier tails than a normal one with the same variance, below 0 lighter ones. The companion to the shipped Core.VAR and Core.STDDEV in the same group.

Formula and more info at https://ta-lib.org/functions/kurtosis.

Inputs, each at least endIdx+1 long:

  • inReal: The series to measure.

Parameters:

  • optInTimePeriod: Number of trailing values in the window. Default 30; range 4 to 10000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Excess kurtosis of the trailing window, or NaN where the window has no spread.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.KURTOSISLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.KURTOSIS(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [0.3612, ..., -1.0060]

func (*Core) KURTOSISDisplayShift

func (c *Core) KURTOSISDisplayShift(optInTimePeriod, outputIdx int) (int, error)

KURTOSISDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.KURTOSIS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.KURTOSIS followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.KURTOSISLookback rejects or an index that names no output.

func (*Core) KURTOSISLookback

func (c *Core) KURTOSISLookback(optInTimePeriod int) (int, error)

KURTOSISLookback returns how many leading bars Core.KURTOSIS consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.KURTOSIS and returns BadParam for one out of range.

func (*Core) KURTOSISOpen

func (c *Core) KURTOSISOpen(inReal []float64, optInTimePeriod int) (*KURTOSISStream, float64, error)

KURTOSISOpen opens a live KURTOSISStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.KURTOSIS writes there.

inReal is the history; the parameters are those of Core.KURTOSIS.

The error is InsufficientHistory for a history of at most Core.KURTOSISLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) KURTOSISOpenAndFill

func (c *Core) KURTOSISOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*KURTOSISStream, OutRange, error)

KURTOSISOpenAndFill opens a stream as Core.KURTOSISOpen does and also writes the outputs over the whole history, as Core.KURTOSIS writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.KURTOSISLookback values and share no memory with an input or another output.

The errors are those of Core.KURTOSISOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) KVO

func (c *Core) KVO(startIdx, endIdx int, inHigh, inLow, inClose, inVolume []float64, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int, outKVO, outKVOSignal []float64) (OutRange, error)

KVO computes the Klinger Volume Oscillator over bars startIdx through endIdx.

Klinger Volume Oscillator: each bar's volume is signed by the direction of its high-low-close sum and weighted by where the bar's own range sits inside the cumulative range of the current trend run, then the resulting volume force is smoothed twice and differenced. Klinger's reading is that volume alone says how much trading happened but not what it accomplished, so he scales it by the share of the trend's accumulated range that this bar actually covered. The oscillator crosses zero as the balance of that force changes hands, and crosses its own trigger line earlier.

Formula and more info at https://ta-lib.org/functions/kvo.

Inputs, each at least endIdx+1 long:

  • inHigh: High price series.
  • inLow: Low price series.
  • inClose: Close price series.
  • inVolume: Volume series.

Parameters:

  • optInFastPeriod: Period of the faster smoothing of the volume force. Default 34; range 2 to 100000; IntegerDefault selects the default.
  • optInSlowPeriod: Period of the slower smoothing of the volume force. Default 55; range 2 to 100000; IntegerDefault selects the default.
  • optInSignalPeriod: Smoothing period of the trigger line. Default 13; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outKVO: Klinger Volume Oscillator.
  • outKVOSignal: Trigger line, an exponential average of the oscillator.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.KVOLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	kvo := make([]float64, 252)
	kvoSignal := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.KVO(0, len(high)-1, high, low, close, volume, 34, 55, 13, kvo, kvoSignal)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("kvo = [%.4f, ..., %.4f]\n", kvo[0], kvo[r.NBElement-1])
	fmt.Printf("kvoSignal = [%.4f, ..., %.4f]\n", kvoSignal[0], kvoSignal[r.NBElement-1])
}
Output:
197 values from bar 55:
kvo = [-144706.8571, ..., -208711.7325]
kvoSignal = [-28935.8007, ..., 73774.1296]

func (*Core) KVODisplayShift

func (c *Core) KVODisplayShift(optInFastPeriod, optInSlowPeriod, optInSignalPeriod, outputIdx int) (int, error)

KVODisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.KVO. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.KVO followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.KVOLookback rejects or an index that names no output.

func (*Core) KVOLookback

func (c *Core) KVOLookback(optInFastPeriod, optInSlowPeriod, optInSignalPeriod int) (int, error)

KVOLookback returns how many leading bars Core.KVO consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.KVO and returns BadParam for one out of range.

func (*Core) KVOOpen

func (c *Core) KVOOpen(inHigh, inLow, inClose, inVolume []float64, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int) (*KVOStream, float64, float64, error)

KVOOpen opens a live KVOStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outKVO and outKVOSignal), the values Core.KVO writes there.

inHigh, inLow, inClose and inVolume are the histories, of one length; the parameters are those of Core.KVO.

The error is InsufficientHistory for a history of at most Core.KVOLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) KVOOpenAndFill

func (c *Core) KVOOpenAndFill(inHigh, inLow, inClose, inVolume []float64, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int, outKVO, outKVOSignal []float64) (*KVOStream, OutRange, error)

KVOOpenAndFill opens a stream as Core.KVOOpen does and also writes the outputs over the whole history, as Core.KVO writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.KVOLookback values and share no memory with an input or another output.

The errors are those of Core.KVOOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) LINEARREG

func (c *Core) LINEARREG(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

LINEARREG computes the Linear Regression over bars startIdx through endIdx.

Least-squares straight-line fit over the last optInTimePeriod bars, reported as the fitted line value at the window endpoint (b + m*(period-1)).

Formula and more info at https://ta-lib.org/functions/linearreg.

Inputs, each at least endIdx+1 long:

  • inReal: Series to fit.

Parameters:

  • optInTimePeriod: Number of bars in each regression window. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Regression line value at the window endpoint.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.LINEARREGLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.LINEARREG(0, len(series)-1, series, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [91.1500, ..., 94.0071]

func (*Core) LINEARREGDisplayShift

func (c *Core) LINEARREGDisplayShift(optInTimePeriod, outputIdx int) (int, error)

LINEARREGDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.LINEARREG. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.LINEARREG followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.LINEARREGLookback rejects or an index that names no output.

func (*Core) LINEARREGLookback

func (c *Core) LINEARREGLookback(optInTimePeriod int) (int, error)

LINEARREGLookback returns how many leading bars Core.LINEARREG consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.LINEARREG and returns BadParam for one out of range.

func (*Core) LINEARREGOpen

func (c *Core) LINEARREGOpen(inReal []float64, optInTimePeriod int) (*LINEARREGStream, float64, error)

LINEARREGOpen opens a live LINEARREGStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.LINEARREG writes there.

inReal is the history; the parameters are those of Core.LINEARREG.

The error is InsufficientHistory for a history of at most Core.LINEARREGLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) LINEARREGOpenAndFill

func (c *Core) LINEARREGOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*LINEARREGStream, OutRange, error)

LINEARREGOpenAndFill opens a stream as Core.LINEARREGOpen does and also writes the outputs over the whole history, as Core.LINEARREG writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.LINEARREGLookback values and share no memory with an input or another output.

The errors are those of Core.LINEARREGOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) LINEARREG_ANGLE

func (c *Core) LINEARREG_ANGLE(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

LINEARREG_ANGLE computes the Linear Regression Angle over bars startIdx through endIdx.

The angle, in degrees, of the least-squares best-fit line over the last N points. It is the LINEARREG_SLOPE value passed through atan and converted to degrees. Positive angle = rising fit line, negative = falling; magnitude reflects steepness.

Formula and more info at https://ta-lib.org/functions/linearreg_angle.

Inputs, each at least endIdx+1 long:

  • inReal: Input series to regress.

Parameters:

  • optInTimePeriod: Number of points in the regression window. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Regression line slope expressed as an angle in degrees.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.LINEARREG_ANGLELookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) LINEARREG_ANGLEDisplayShift

func (c *Core) LINEARREG_ANGLEDisplayShift(optInTimePeriod, outputIdx int) (int, error)

LINEARREG_ANGLEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.LINEARREG_ANGLE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.LINEARREG_ANGLE followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.LINEARREG_ANGLELookback rejects or an index that names no output.

func (*Core) LINEARREG_ANGLELookback

func (c *Core) LINEARREG_ANGLELookback(optInTimePeriod int) (int, error)

LINEARREG_ANGLELookback returns how many leading bars Core.LINEARREG_ANGLE consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.LINEARREG_ANGLE and returns BadParam for one out of range.

func (*Core) LINEARREG_ANGLEOpen

func (c *Core) LINEARREG_ANGLEOpen(inReal []float64, optInTimePeriod int) (*LINEARREG_ANGLEStream, float64, error)

LINEARREG_ANGLEOpen opens a live LINEARREG_ANGLEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.LINEARREG_ANGLE writes there.

inReal is the history; the parameters are those of Core.LINEARREG_ANGLE.

The error is InsufficientHistory for a history of at most Core.LINEARREG_ANGLELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) LINEARREG_ANGLEOpenAndFill

func (c *Core) LINEARREG_ANGLEOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*LINEARREG_ANGLEStream, OutRange, error)

LINEARREG_ANGLEOpenAndFill opens a stream as Core.LINEARREG_ANGLEOpen does and also writes the outputs over the whole history, as Core.LINEARREG_ANGLE writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.LINEARREG_ANGLELookback values and share no memory with an input or another output.

The errors are those of Core.LINEARREG_ANGLEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) LINEARREG_INTERCEPT

func (c *Core) LINEARREG_INTERCEPT(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

LINEARREG_INTERCEPT computes the Linear Regression Intercept over bars startIdx through endIdx.

Returns the y-intercept (b) of the least-squares regression line fitted over the last optInTimePeriod values. Part of the linear-regression family (LINEARREG, SLOPE, ANGLE, TSF).

Formula and more info at https://ta-lib.org/functions/linearreg_intercept.

Inputs, each at least endIdx+1 long:

  • inReal: Input series to regress.

Parameters:

  • optInTimePeriod: Window length of the regression. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Intercept b of the fitted line at each bar.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.LINEARREG_INTERCEPTLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) LINEARREG_INTERCEPTDisplayShift

func (c *Core) LINEARREG_INTERCEPTDisplayShift(optInTimePeriod, outputIdx int) (int, error)

LINEARREG_INTERCEPTDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.LINEARREG_INTERCEPT. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.LINEARREG_INTERCEPT followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.LINEARREG_INTERCEPTLookback rejects or an index that names no output.

func (*Core) LINEARREG_INTERCEPTLookback

func (c *Core) LINEARREG_INTERCEPTLookback(optInTimePeriod int) (int, error)

LINEARREG_INTERCEPTLookback returns how many leading bars Core.LINEARREG_INTERCEPT consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.LINEARREG_INTERCEPT and returns BadParam for one out of range.

func (*Core) LINEARREG_INTERCEPTOpen

func (c *Core) LINEARREG_INTERCEPTOpen(inReal []float64, optInTimePeriod int) (*LINEARREG_INTERCEPTStream, float64, error)

LINEARREG_INTERCEPTOpen opens a live LINEARREG_INTERCEPTStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.LINEARREG_INTERCEPT writes there.

inReal is the history; the parameters are those of Core.LINEARREG_INTERCEPT.

The error is InsufficientHistory for a history of at most Core.LINEARREG_INTERCEPTLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) LINEARREG_INTERCEPTOpenAndFill

func (c *Core) LINEARREG_INTERCEPTOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*LINEARREG_INTERCEPTStream, OutRange, error)

LINEARREG_INTERCEPTOpenAndFill opens a stream as Core.LINEARREG_INTERCEPTOpen does and also writes the outputs over the whole history, as Core.LINEARREG_INTERCEPT writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.LINEARREG_INTERCEPTLookback values and share no memory with an input or another output.

The errors are those of Core.LINEARREG_INTERCEPTOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) LINEARREG_SLOPE

func (c *Core) LINEARREG_SLOPE(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

LINEARREG_SLOPE computes the Linear Regression Slope over bars startIdx through endIdx.

Slope 'm' of the least-squares best-fit line (y = b + m*x) over the last optInTimePeriod bars. Reports the per-bar rate of change of the fitted trend line. Positive slope = rising trend, negative = falling; magnitude is price change per bar.

Formula and more info at https://ta-lib.org/functions/linearreg_slope.

Inputs, each at least endIdx+1 long:

  • inReal: Data series to fit.

Parameters:

  • optInTimePeriod: Number of bars in the regression window. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Slope m of the fitted line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.LINEARREG_SLOPELookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) LINEARREG_SLOPEDisplayShift

func (c *Core) LINEARREG_SLOPEDisplayShift(optInTimePeriod, outputIdx int) (int, error)

LINEARREG_SLOPEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.LINEARREG_SLOPE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.LINEARREG_SLOPE followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.LINEARREG_SLOPELookback rejects or an index that names no output.

func (*Core) LINEARREG_SLOPELookback

func (c *Core) LINEARREG_SLOPELookback(optInTimePeriod int) (int, error)

LINEARREG_SLOPELookback returns how many leading bars Core.LINEARREG_SLOPE consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.LINEARREG_SLOPE and returns BadParam for one out of range.

func (*Core) LINEARREG_SLOPEOpen

func (c *Core) LINEARREG_SLOPEOpen(inReal []float64, optInTimePeriod int) (*LINEARREG_SLOPEStream, float64, error)

LINEARREG_SLOPEOpen opens a live LINEARREG_SLOPEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.LINEARREG_SLOPE writes there.

inReal is the history; the parameters are those of Core.LINEARREG_SLOPE.

The error is InsufficientHistory for a history of at most Core.LINEARREG_SLOPELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) LINEARREG_SLOPEOpenAndFill

func (c *Core) LINEARREG_SLOPEOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*LINEARREG_SLOPEStream, OutRange, error)

LINEARREG_SLOPEOpenAndFill opens a stream as Core.LINEARREG_SLOPEOpen does and also writes the outputs over the whole history, as Core.LINEARREG_SLOPE writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.LINEARREG_SLOPELookback values and share no memory with an input or another output.

The errors are those of Core.LINEARREG_SLOPEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) LN

func (c *Core) LN(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

LN computes the Vector Log Natural over bars startIdx through endIdx.

Element-wise natural logarithm of the input series.

Formula and more info at https://ta-lib.org/functions/ln.

Inputs, each at least endIdx+1 long:

  • inReal: Input value series.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Natural log of each input value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.LNLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 0.1 + 9.9*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.LN(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [-2.3026, ..., 2.3026]

func (*Core) LNDisplayShift

func (c *Core) LNDisplayShift(outputIdx int) (int, error)

LNDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.LN. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.LN, from 0, and returns BadParam for an index that names no output.

func (*Core) LNLookback

func (c *Core) LNLookback() (int, error)

LNLookback returns how many leading bars Core.LN consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) LNOpen

func (c *Core) LNOpen(inReal []float64) (*LNStream, float64, error)

LNOpen opens a live LNStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.LN writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.LNLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) LNOpenAndFill

func (c *Core) LNOpenAndFill(inReal, outReal []float64) (*LNStream, OutRange, error)

LNOpenAndFill opens a stream as Core.LNOpen does and also writes the outputs over the whole history, as Core.LN writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.LNLookback values and share no memory with an input or another output.

The errors are those of Core.LNOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) LOG10

func (c *Core) LOG10(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

LOG10 computes the Vector Log10 over bars startIdx through endIdx.

Element-wise base-10 logarithm of the input series.

Formula and more info at https://ta-lib.org/functions/log10.

Inputs, each at least endIdx+1 long:

  • inReal: Input values.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Base-10 logarithm of each input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.LOG10Lookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 0.1 + 9.9*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.LOG10(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [-1.0000, ..., 1.0000]

func (*Core) LOG10DisplayShift

func (c *Core) LOG10DisplayShift(outputIdx int) (int, error)

LOG10DisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.LOG10. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.LOG10, from 0, and returns BadParam for an index that names no output.

func (*Core) LOG10Lookback

func (c *Core) LOG10Lookback() (int, error)

LOG10Lookback returns how many leading bars Core.LOG10 consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) LOG10Open

func (c *Core) LOG10Open(inReal []float64) (*LOG10Stream, float64, error)

LOG10Open opens a live LOG10Stream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.LOG10 writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.LOG10Lookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) LOG10OpenAndFill

func (c *Core) LOG10OpenAndFill(inReal, outReal []float64) (*LOG10Stream, OutRange, error)

LOG10OpenAndFill opens a stream as Core.LOG10Open does and also writes the outputs over the whole history, as Core.LOG10 writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.LOG10Lookback values and share no memory with an input or another output.

The errors are those of Core.LOG10Open, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MA

func (c *Core) MA(startIdx, endIdx int, inReal []float64, optInTimePeriod int, optInMAType MAType, outReal []float64) (OutRange, error)

MA computes the Moving average over bars startIdx through endIdx.

Generic moving-average dispatcher that forwards the job to the MA implementation selected by optInMAType. Single uniform interface over all TA-Lib moving averages.

Formula and more info at https://ta-lib.org/functions/ma.

Inputs, each at least endIdx+1 long:

  • inReal: Series to average.

Parameters:

  • optInTimePeriod: Averaging window length. Default 30; range 1 to 10000; IntegerDefault selects the default.
  • optInMAType: Which moving-average algorithm to dispatch to. Default MATypeSMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Selected moving average of the input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MALookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MA(0, len(series)-1, series, 30, talib.MATypeSMA, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [95.2583, ..., 98.5583]

func (*Core) MACD

func (c *Core) MACD(startIdx, endIdx int, inReal []float64, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int, outMACD, outMACDSignal, outMACDHist []float64) (OutRange, error)

MACD computes the Moving Average Convergence/Divergence over bars startIdx through endIdx.

Moving Average Convergence/Divergence: the difference between a fast and a slow EMA of the input, plus an EMA-smoothed signal line and their histogram. MACD crossing its signal line and histogram sign changes flag momentum shifts.

Formula and more info at https://ta-lib.org/functions/macd.

Inputs, each at least endIdx+1 long:

  • inReal: Input series (typically close)

Parameters:

  • optInFastPeriod: Period of the fast EMA. Default 12; range 2 to 100000; IntegerDefault selects the default.
  • optInSlowPeriod: Period of the slow EMA. Default 26; range 2 to 100000; IntegerDefault selects the default.
  • optInSignalPeriod: Smoothing period of the signal line. Default 9; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outMACD: Fast EMA minus slow EMA.
  • outMACDSignal: EMA of the MACD line.
  • outMACDHist: MACD minus signal line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MACDLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	macd := make([]float64, 252)
	macdSignal := make([]float64, 252)
	macdHist := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MACD(0, len(series)-1, series, 12, 26, 9, macd, macdSignal, macdHist)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("macd = [%.4f, ..., %.4f]\n", macd[0], macd[r.NBElement-1])
	fmt.Printf("macdSignal = [%.4f, ..., %.4f]\n", macdSignal[0], macdSignal[r.NBElement-1])
	fmt.Printf("macdHist = [%.4f, ..., %.4f]\n", macdHist[0], macdHist[r.NBElement-1])
}
Output:
219 values from bar 33:
macd = [-1.1241, ..., -0.2779]
macdSignal = [-3.1026, ..., 1.1676]
macdHist = [1.9785, ..., -1.4455]

func (*Core) MACDDisplayShift

func (c *Core) MACDDisplayShift(optInFastPeriod, optInSlowPeriod, optInSignalPeriod, outputIdx int) (int, error)

MACDDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MACD. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MACD followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MACDLookback rejects or an index that names no output.

func (*Core) MACDEXT

func (c *Core) MACDEXT(startIdx, endIdx int, inReal []float64, optInFastPeriod int, optInFastMAType MAType, optInSlowPeriod int, optInSlowMAType MAType, optInSignalPeriod int, optInSignalMAType MAType, outMACD, outMACDSignal, outMACDHist []float64) (OutRange, error)

MACDEXT computes the MACD with controllable MA type over bars startIdx through endIdx.

MACD variant where the fast, slow, and signal moving averages each use a user-selectable MA type. Outputs the MACD line, its signal line, and their difference (histogram). Hist sign change (MACD crossing its signal line) flags momentum shifts.

Formula and more info at https://ta-lib.org/functions/macdext.

Inputs, each at least endIdx+1 long:

  • inReal: Source series.

Parameters:

  • optInFastPeriod: Period of the fast MA. Default 12; range 2 to 10000; IntegerDefault selects the default.
  • optInFastMAType: MA type for the fast MA. Default MATypeSMA; MATypeDEFAULT selects the default.
  • optInSlowPeriod: Period of the slow MA. Default 26; range 2 to 10000; IntegerDefault selects the default.
  • optInSlowMAType: MA type for the slow MA. Default MATypeSMA; MATypeDEFAULT selects the default.
  • optInSignalPeriod: Period of the signal-line MA. Default 9; range 1 to 10000; IntegerDefault selects the default.
  • optInSignalMAType: MA type for the signal line. Default MATypeSMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outMACD: MACD line: fast MA minus slow MA.
  • outMACDSignal: Signal line: MA of the MACD line.
  • outMACDHist: Histogram: MACD minus signal.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MACDEXTLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	macd := make([]float64, 252)
	macdSignal := make([]float64, 252)
	macdHist := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MACDEXT(0, len(series)-1, series, 12, talib.MATypeSMA, 26, talib.MATypeSMA, 9, talib.MATypeSMA,
		macd, macdSignal, macdHist)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("macd = [%.4f, ..., %.4f]\n", macd[0], macd[r.NBElement-1])
	fmt.Printf("macdSignal = [%.4f, ..., %.4f]\n", macdSignal[0], macdSignal[r.NBElement-1])
	fmt.Printf("macdHist = [%.4f, ..., %.4f]\n", macdHist[0], macdHist[r.NBElement-1])
}
Output:
219 values from bar 33:
macd = [0.5833, ..., 1.3372]
macdSignal = [-2.2167, ..., 4.7594]
macdHist = [2.8000, ..., -3.4222]

func (*Core) MACDEXTDisplayShift

func (c *Core) MACDEXTDisplayShift(optInFastPeriod int, optInFastMAType MAType, optInSlowPeriod int, optInSlowMAType MAType, optInSignalPeriod int, optInSignalMAType MAType, outputIdx int) (int, error)

MACDEXTDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MACDEXT. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MACDEXT followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MACDEXTLookback rejects or an index that names no output.

func (*Core) MACDEXTLookback

func (c *Core) MACDEXTLookback(optInFastPeriod int, optInFastMAType MAType, optInSlowPeriod int, optInSlowMAType MAType, optInSignalPeriod int, optInSignalMAType MAType) (int, error)

MACDEXTLookback returns how many leading bars Core.MACDEXT consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MACDEXT and returns BadParam for one out of range.

func (*Core) MACDEXTOpen

func (c *Core) MACDEXTOpen(inReal []float64, optInFastPeriod int, optInFastMAType MAType, optInSlowPeriod int, optInSlowMAType MAType, optInSignalPeriod int, optInSignalMAType MAType) (*MACDEXTStream, float64, float64, float64, error)

MACDEXTOpen opens a live MACDEXTStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outMACD, outMACDSignal and outMACDHist), the values Core.MACDEXT writes there.

inReal is the history; the parameters are those of Core.MACDEXT.

The error is InsufficientHistory for a history of at most Core.MACDEXTLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MACDEXTOpenAndFill

func (c *Core) MACDEXTOpenAndFill(inReal []float64, optInFastPeriod int, optInFastMAType MAType, optInSlowPeriod int, optInSlowMAType MAType, optInSignalPeriod int, optInSignalMAType MAType, outMACD, outMACDSignal, outMACDHist []float64) (*MACDEXTStream, OutRange, error)

MACDEXTOpenAndFill opens a stream as Core.MACDEXTOpen does and also writes the outputs over the whole history, as Core.MACDEXT writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MACDEXTLookback values and share no memory with an input or another output.

The errors are those of Core.MACDEXTOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MACDFIX

func (c *Core) MACDFIX(startIdx, endIdx int, inReal []float64, optInSignalPeriod int, outMACD, outMACDSignal, outMACDHist []float64) (OutRange, error)

MACDFIX computes the Moving Average Convergence/Divergence Fix 12/26 over bars startIdx through endIdx.

MACD with the fast/slow EMAs fixed to the classic 12/26 periods (with the classic fixed smoothing factors 0.15 and 0.075), exposing only the signal period. Signal-line crossovers and histogram sign flag momentum shifts.

Formula and more info at https://ta-lib.org/functions/macdfix.

Inputs, each at least endIdx+1 long:

  • inReal: Source series (typically close)

Parameters:

  • optInSignalPeriod: Smoothing period for the signal line. Default 9; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outMACD: Fixed EMA12 minus EMA26.
  • outMACDSignal: EMA of the MACD line.
  • outMACDHist: MACD minus signal.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MACDFIXLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	macd := make([]float64, 252)
	macdSignal := make([]float64, 252)
	macdHist := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MACDFIX(0, len(series)-1, series, 9, macd, macdSignal, macdHist)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("macd = [%.4f, ..., %.4f]\n", macd[0], macd[r.NBElement-1])
	fmt.Printf("macdSignal = [%.4f, ..., %.4f]\n", macdSignal[0], macdSignal[r.NBElement-1])
	fmt.Printf("macdHist = [%.4f, ..., %.4f]\n", macdHist[0], macdHist[r.NBElement-1])
}
Output:
219 values from bar 33:
macd = [-1.1885, ..., -0.2372]
macdSignal = [-3.1260, ..., 1.1277]
macdHist = [1.9375, ..., -1.3649]

func (*Core) MACDFIXDisplayShift

func (c *Core) MACDFIXDisplayShift(optInSignalPeriod, outputIdx int) (int, error)

MACDFIXDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MACDFIX. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MACDFIX followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MACDFIXLookback rejects or an index that names no output.

func (*Core) MACDFIXLookback

func (c *Core) MACDFIXLookback(optInSignalPeriod int) (int, error)

MACDFIXLookback returns how many leading bars Core.MACDFIX consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MACDFIX and returns BadParam for one out of range.

func (*Core) MACDFIXOpen

func (c *Core) MACDFIXOpen(inReal []float64, optInSignalPeriod int) (*MACDFIXStream, float64, float64, float64, error)

MACDFIXOpen opens a live MACDFIXStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outMACD, outMACDSignal and outMACDHist), the values Core.MACDFIX writes there.

inReal is the history; the parameters are those of Core.MACDFIX.

The error is InsufficientHistory for a history of at most Core.MACDFIXLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MACDFIXOpenAndFill

func (c *Core) MACDFIXOpenAndFill(inReal []float64, optInSignalPeriod int, outMACD, outMACDSignal, outMACDHist []float64) (*MACDFIXStream, OutRange, error)

MACDFIXOpenAndFill opens a stream as Core.MACDFIXOpen does and also writes the outputs over the whole history, as Core.MACDFIX writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MACDFIXLookback values and share no memory with an input or another output.

The errors are those of Core.MACDFIXOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MACDLookback

func (c *Core) MACDLookback(optInFastPeriod, optInSlowPeriod, optInSignalPeriod int) (int, error)

MACDLookback returns how many leading bars Core.MACD consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MACD and returns BadParam for one out of range.

func (*Core) MACDOpen

func (c *Core) MACDOpen(inReal []float64, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int) (*MACDStream, float64, float64, float64, error)

MACDOpen opens a live MACDStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outMACD, outMACDSignal and outMACDHist), the values Core.MACD writes there.

inReal is the history; the parameters are those of Core.MACD.

The error is InsufficientHistory for a history of at most Core.MACDLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MACDOpenAndFill

func (c *Core) MACDOpenAndFill(inReal []float64, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int, outMACD, outMACDSignal, outMACDHist []float64) (*MACDStream, OutRange, error)

MACDOpenAndFill opens a stream as Core.MACDOpen does and also writes the outputs over the whole history, as Core.MACD writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MACDLookback values and share no memory with an input or another output.

The errors are those of Core.MACDOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MACDV

func (c *Core) MACDV(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int, outMACDV, outMACDVSignal, outMACDVHist []float64) (OutRange, error)

MACDV computes the MACD-V, Volatility Normalised Momentum over bars startIdx through endIdx.

MACD-V, Alex Spiroglou's volatility-normalised MACD: the spread of a fast and a slow EMA of the close over the Average True Range, times 100. Like MACD it comes with an EMA-smoothed signal line and their histogram. Dividing by the ATR expresses momentum in units of the instrument's own volatility, so one reading means the same thing across instruments, timeframes and volatility regimes, where the raw MACD spread does not. Spiroglou reads the line in ranges: beyond 150 or -150 is an overextended move, between -50 and 50 a ranging market, and the bands in between a trend.

Formula and more info at https://ta-lib.org/functions/macdv.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInFastPeriod: Period of the fast EMA. Default 12; range 2 to 100000; IntegerDefault selects the default.
  • optInSlowPeriod: Period of the slow EMA and of the Average True Range. Default 26; range 2 to 100000; IntegerDefault selects the default.
  • optInSignalPeriod: Smoothing period of the signal line. Default 9; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outMACDV: Fast EMA minus slow EMA, divided by the Average True Range, times 100.
  • outMACDVSignal: EMA of the MACD-V line.
  • outMACDVHist: MACD-V minus signal line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MACDVLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	macdv := make([]float64, 252)
	macdvSignal := make([]float64, 252)
	macdvHist := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MACDV(0, len(high)-1, high, low, close, 12, 26, 9, macdv, macdvSignal, macdvHist)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("macdv = [%.4f, ..., %.4f]\n", macdv[0], macdv[r.NBElement-1])
	fmt.Printf("macdvSignal = [%.4f, ..., %.4f]\n", macdvSignal[0], macdvSignal[r.NBElement-1])
	fmt.Printf("macdvHist = [%.4f, ..., %.4f]\n", macdvHist[0], macdvHist[r.NBElement-1])
}
Output:
218 values from bar 34:
macdv = [-8.7665, ..., -3.6994]
macdvSignal = [-42.4459, ..., 20.4051]
macdvHist = [33.6794, ..., -24.1045]

func (*Core) MACDVDisplayShift

func (c *Core) MACDVDisplayShift(optInFastPeriod, optInSlowPeriod, optInSignalPeriod, outputIdx int) (int, error)

MACDVDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MACDV. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MACDV followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MACDVLookback rejects or an index that names no output.

func (*Core) MACDVLookback

func (c *Core) MACDVLookback(optInFastPeriod, optInSlowPeriod, optInSignalPeriod int) (int, error)

MACDVLookback returns how many leading bars Core.MACDV consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MACDV and returns BadParam for one out of range.

func (*Core) MACDVOpen

func (c *Core) MACDVOpen(inHigh, inLow, inClose []float64, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int) (*MACDVStream, float64, float64, float64, error)

MACDVOpen opens a live MACDVStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outMACDV, outMACDVSignal and outMACDVHist), the values Core.MACDV writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.MACDV.

The error is InsufficientHistory for a history of at most Core.MACDVLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) MACDVOpenAndFill

func (c *Core) MACDVOpenAndFill(inHigh, inLow, inClose []float64, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int, outMACDV, outMACDVSignal, outMACDVHist []float64) (*MACDVStream, OutRange, error)

MACDVOpenAndFill opens a stream as Core.MACDVOpen does and also writes the outputs over the whole history, as Core.MACDV writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.MACDVLookback values and share no memory with an input or another output.

The errors are those of Core.MACDVOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MADisplayShift

func (c *Core) MADisplayShift(optInTimePeriod int, optInMAType MAType, outputIdx int) (int, error)

MADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MALookback rejects or an index that names no output.

func (*Core) MAENV

func (c *Core) MAENV(startIdx, endIdx int, inReal []float64, optInTimePeriod int, optInPercentUp, optInPercentDn float64, optInMAType MAType, outRealUpperBand, outRealMiddleBand, outRealLowerBand []float64) (OutRange, error)

MAENV computes the Moving Average Envelope over bars startIdx through endIdx.

Moving Average Envelope: a moving average with one band a fixed percentage above it and one a fixed percentage below. The bands keep a constant proportional distance from the average, so price reaching a band reads as stretched relative to its recent mean, and a move beyond one as unusual strength or weakness.

Formula and more info at https://ta-lib.org/functions/maenv.

Inputs, each at least endIdx+1 long:

  • inReal: Input data series.

Parameters:

  • optInTimePeriod: Periods of the moving average. Default 20; range 1 to 10000; IntegerDefault selects the default.
  • optInPercentUp: Percent of the moving average added to form the upper band. Default 10; RealDefault selects the default.
  • optInPercentDn: Percent of the moving average subtracted to form the lower band. Default 10; RealDefault selects the default.
  • optInMAType: Moving-average type for the middle band. Default MATypeSMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outRealUpperBand: The moving average plus the upper percentage of it.
  • outRealMiddleBand: The moving average.
  • outRealLowerBand: The moving average minus the lower percentage of it.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MAENVLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	upperBand := make([]float64, 252)
	middleBand := make([]float64, 252)
	lowerBand := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MAENV(0, len(series)-1, series, 20, 10, 10, talib.MATypeSMA,
		upperBand, middleBand, lowerBand)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("upperBand = [%.4f, ..., %.4f]\n", upperBand[0], upperBand[r.NBElement-1])
	fmt.Printf("middleBand = [%.4f, ..., %.4f]\n", middleBand[0], middleBand[r.NBElement-1])
	fmt.Printf("lowerBand = [%.4f, ..., %.4f]\n", lowerBand[0], lowerBand[r.NBElement-1])
}
Output:
233 values from bar 19:
upperBand = [106.8925, ..., 111.7325]
middleBand = [97.1750, ..., 101.5750]
lowerBand = [87.4575, ..., 91.4175]

func (*Core) MAENVDisplayShift

func (c *Core) MAENVDisplayShift(optInTimePeriod int, optInPercentUp, optInPercentDn float64, optInMAType MAType, outputIdx int) (int, error)

MAENVDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MAENV. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MAENV followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MAENVLookback rejects or an index that names no output.

func (*Core) MAENVLookback

func (c *Core) MAENVLookback(optInTimePeriod int, optInPercentUp, optInPercentDn float64, optInMAType MAType) (int, error)

MAENVLookback returns how many leading bars Core.MAENV consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MAENV and returns BadParam for one out of range.

func (*Core) MAENVOpen

func (c *Core) MAENVOpen(inReal []float64, optInTimePeriod int, optInPercentUp, optInPercentDn float64, optInMAType MAType) (*MAENVStream, float64, float64, float64, error)

MAENVOpen opens a live MAENVStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outRealUpperBand, outRealMiddleBand and outRealLowerBand), the values Core.MAENV writes there.

inReal is the history; the parameters are those of Core.MAENV.

The error is InsufficientHistory for a history of at most Core.MAENVLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MAENVOpenAndFill

func (c *Core) MAENVOpenAndFill(inReal []float64, optInTimePeriod int, optInPercentUp, optInPercentDn float64, optInMAType MAType, outRealUpperBand, outRealMiddleBand, outRealLowerBand []float64) (*MAENVStream, OutRange, error)

MAENVOpenAndFill opens a stream as Core.MAENVOpen does and also writes the outputs over the whole history, as Core.MAENV writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MAENVLookback values and share no memory with an input or another output.

The errors are those of Core.MAENVOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MALookback

func (c *Core) MALookback(optInTimePeriod int, optInMAType MAType) (int, error)

MALookback returns how many leading bars Core.MA consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MA and returns BadParam for one out of range.

func (*Core) MAMA

func (c *Core) MAMA(startIdx, endIdx int, inReal []float64, optInFastLimit, optInSlowLimit float64, outMAMA, outFAMA []float64) (OutRange, error)

MAMA computes the MESA Adaptive Moving Average over bars startIdx through endIdx.

MESA Adaptive Moving Average: an adaptive EMA whose smoothing factor is driven by the dominant-cycle phase rate measured with a Hilbert transform. Emits two lines, MAMA and its slower follower FAMA. MAMA crossing above FAMA is bullish; crossing below is bearish.

Formula and more info at https://ta-lib.org/functions/mama.

Inputs, each at least endIdx+1 long:

  • inReal: Price series to smooth.

Parameters:

  • optInFastLimit: Upper bound on the adaptive smoothing factor. Default 0.5; range 0.01 to 0.99; RealDefault selects the default.
  • optInSlowLimit: Lower bound on the adaptive smoothing factor. Default 0.05; range 0.01 to 0.99; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outMAMA: Adaptive moving average (fast line)
  • outFAMA: Following adaptive moving average, using half the alpha (slow line)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MAMALookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdMAMA (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	mama := make([]float64, 252)
	fama := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MAMA(0, len(series)-1, series, 0.5, 0.05, mama, fama)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("mama = [%.4f, ..., %.4f]\n", mama[0], mama[r.NBElement-1])
	fmt.Printf("fama = [%.4f, ..., %.4f]\n", fama[0], fama[r.NBElement-1])
}
Output:
220 values from bar 32:
mama = [93.6315, ..., 101.1241]
fama = [86.3780, ..., 102.5800]

func (*Core) MAMADisplayShift

func (c *Core) MAMADisplayShift(optInFastLimit, optInSlowLimit float64, outputIdx int) (int, error)

MAMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MAMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MAMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MAMALookback rejects or an index that names no output.

func (*Core) MAMALookback

func (c *Core) MAMALookback(optInFastLimit, optInSlowLimit float64) (int, error)

MAMALookback returns how many leading bars Core.MAMA consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdMAMA (see Core.SetUnstablePeriod).

It takes the parameters of Core.MAMA and returns BadParam for one out of range.

func (*Core) MAMAOpen

func (c *Core) MAMAOpen(inReal []float64, optInFastLimit, optInSlowLimit float64) (*MAMAStream, float64, float64, error)

MAMAOpen opens a live MAMAStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outMAMA and outFAMA), the values Core.MAMA writes there.

inReal is the history; the parameters are those of Core.MAMA.

The error is InsufficientHistory for a history of at most Core.MAMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MAMAOpenAndFill

func (c *Core) MAMAOpenAndFill(inReal []float64, optInFastLimit, optInSlowLimit float64, outMAMA, outFAMA []float64) (*MAMAStream, OutRange, error)

MAMAOpenAndFill opens a stream as Core.MAMAOpen does and also writes the outputs over the whole history, as Core.MAMA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MAMALookback values and share no memory with an input or another output.

The errors are those of Core.MAMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MAOpen

func (c *Core) MAOpen(inReal []float64, optInTimePeriod int, optInMAType MAType) (*MAStream, float64, error)

MAOpen opens a live MAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MA writes there.

inReal is the history; the parameters are those of Core.MA.

The error is InsufficientHistory for a history of at most Core.MALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MAOpenAndFill

func (c *Core) MAOpenAndFill(inReal []float64, optInTimePeriod int, optInMAType MAType, outReal []float64) (*MAStream, OutRange, error)

MAOpenAndFill opens a stream as Core.MAOpen does and also writes the outputs over the whole history, as Core.MA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MALookback values and share no memory with an input or another output.

The errors are those of Core.MAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MARKETFI

func (c *Core) MARKETFI(startIdx, endIdx int, inHigh, inLow, inVolume, outReal []float64) (OutRange, error)

MARKETFI computes the Market Facilitation Index over bars startIdx through endIdx.

Bill Williams' Market Facilitation Index (Trading Chaos, 1995): the price range a bar travelled per unit of volume traded — how much movement the market "facilitated" per tick. A rising index on rising volume is read as a move the market is absorbing; a rising index on falling volume as one it is not.

Formula and more info at https://ta-lib.org/functions/marketfi.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inVolume: Volume of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Range travelled per unit of volume, per bar.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MARKETFILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MARKETFI(0, len(high)-1, high, low, volume, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [0.0006, ..., 0.0001]

func (*Core) MARKETFIDisplayShift

func (c *Core) MARKETFIDisplayShift(outputIdx int) (int, error)

MARKETFIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MARKETFI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.MARKETFI, from 0, and returns BadParam for an index that names no output.

func (*Core) MARKETFILookback

func (c *Core) MARKETFILookback() (int, error)

MARKETFILookback returns how many leading bars Core.MARKETFI consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) MARKETFIOpen

func (c *Core) MARKETFIOpen(inHigh, inLow, inVolume []float64) (*MARKETFIStream, float64, error)

MARKETFIOpen opens a live MARKETFIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MARKETFI writes there.

inHigh, inLow and inVolume are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.MARKETFILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) MARKETFIOpenAndFill

func (c *Core) MARKETFIOpenAndFill(inHigh, inLow, inVolume, outReal []float64) (*MARKETFIStream, OutRange, error)

MARKETFIOpenAndFill opens a stream as Core.MARKETFIOpen does and also writes the outputs over the whole history, as Core.MARKETFI writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.MARKETFILookback values and share no memory with an input or another output.

The errors are those of Core.MARKETFIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MASSI

func (c *Core) MASSI(startIdx, endIdx int, inHigh, inLow []float64, optInFastPeriod, optInSlowPeriod int, outReal []float64) (OutRange, error)

MASSI computes the Mass Index over bars startIdx through endIdx.

Mass Index: Donald Dorsey's non-directional measure of how the trading range itself is expanding or contracting. The high-low range is smoothed by an exponential moving average, that average is smoothed again by a second one of the same length, and the ratio of the first to the second is summed over a trailing window.

Formula and more info at https://ta-lib.org/functions/massi.

Inputs, each at least endIdx+1 long:

  • inHigh: High price.
  • inLow: Low price.

Parameters:

  • optInFastPeriod: Number of bars in each of the two exponential averages of the high-low range. Default 9; range 2 to 100000; IntegerDefault selects the default.
  • optInSlowPeriod: Number of bars the ratio is summed over. Default 25; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Summed ratio of the two smoothed high-low ranges.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MASSILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MASSI(0, len(high)-1, high, low, 9, 25, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
212 values from bar 40: [24.9490, ..., 25.0397]

func (*Core) MASSIDisplayShift

func (c *Core) MASSIDisplayShift(optInFastPeriod, optInSlowPeriod, outputIdx int) (int, error)

MASSIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MASSI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MASSI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MASSILookback rejects or an index that names no output.

func (*Core) MASSILookback

func (c *Core) MASSILookback(optInFastPeriod, optInSlowPeriod int) (int, error)

MASSILookback returns how many leading bars Core.MASSI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MASSI and returns BadParam for one out of range.

func (*Core) MASSIOpen

func (c *Core) MASSIOpen(inHigh, inLow []float64, optInFastPeriod, optInSlowPeriod int) (*MASSIStream, float64, error)

MASSIOpen opens a live MASSIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MASSI writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.MASSI.

The error is InsufficientHistory for a history of at most Core.MASSILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) MASSIOpenAndFill

func (c *Core) MASSIOpenAndFill(inHigh, inLow []float64, optInFastPeriod, optInSlowPeriod int, outReal []float64) (*MASSIStream, OutRange, error)

MASSIOpenAndFill opens a stream as Core.MASSIOpen does and also writes the outputs over the whole history, as Core.MASSI writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.MASSILookback values and share no memory with an input or another output.

The errors are those of Core.MASSIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MAVP

func (c *Core) MAVP(startIdx, endIdx int, inReal, inPeriods []float64, optInMinPeriod, optInMaxPeriod int, optInMAType MAType, outReal []float64) (OutRange, error)

MAVP computes the Moving average with variable period over bars startIdx through endIdx.

Moving average whose period varies per bar, driven by a companion period series. For each bar it computes an MA of the selected type over the (clamped) period given by inPeriods.

Formula and more info at https://ta-lib.org/functions/mavp.

Inputs, each at least endIdx+1 long:

  • inReal: series to be averaged.
  • inPeriods: per-bar desired MA period.

Parameters:

  • optInMinPeriod: Lower clamp for the per-bar period. Default 2; range 1 to 10000; IntegerDefault selects the default.
  • optInMaxPeriod: Upper clamp for the per-bar period. Default 30; range 1 to 10000; IntegerDefault selects the default.
  • optInMAType: Moving-average type applied. Default MATypeSMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: variable-period moving average.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MAVPLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	periods := make([]float64, 252) // one period per bar
	for i := range periods {
		periods[i] = float64(5 + i%10)
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MAVP(0, len(series)-1, series, periods, 2, 30, talib.MATypeSMA, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [91.1250, ..., 96.7583]

func (*Core) MAVPDisplayShift

func (c *Core) MAVPDisplayShift(optInMinPeriod, optInMaxPeriod int, optInMAType MAType, outputIdx int) (int, error)

MAVPDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MAVP. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MAVP followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MAVPLookback rejects or an index that names no output.

func (*Core) MAVPLookback

func (c *Core) MAVPLookback(optInMinPeriod, optInMaxPeriod int, optInMAType MAType) (int, error)

MAVPLookback returns how many leading bars Core.MAVP consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MAVP and returns BadParam for one out of range.

func (*Core) MAVPOpen

func (c *Core) MAVPOpen(inReal, inPeriods []float64, optInMinPeriod, optInMaxPeriod int, optInMAType MAType) (*MAVPStream, float64, error)

MAVPOpen opens a live MAVPStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MAVP writes there.

inReal and inPeriods are the histories, of one length; the parameters are those of Core.MAVP.

The error is InsufficientHistory for a history of at most Core.MAVPLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) MAVPOpenAndFill

func (c *Core) MAVPOpenAndFill(inReal, inPeriods []float64, optInMinPeriod, optInMaxPeriod int, optInMAType MAType, outReal []float64) (*MAVPStream, OutRange, error)

MAVPOpenAndFill opens a stream as Core.MAVPOpen does and also writes the outputs over the whole history, as Core.MAVP writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MAVPLookback values and share no memory with an input or another output.

The errors are those of Core.MAVPOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MAX

func (c *Core) MAX(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

MAX computes the Highest value over a specified period over bars startIdx through endIdx.

Highest input value over a rolling window of the last optInTimePeriod bars. A moving-window maximum.

Formula and more info at https://ta-lib.org/functions/max.

Inputs, each at least endIdx+1 long:

  • inReal: Series to take the rolling maximum of.

Parameters:

  • optInTimePeriod: Window length in bars. Default 30; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Highest value within each trailing window.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MAXLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MAX(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [110.0000, ..., 110.0000]

func (*Core) MAXDisplayShift

func (c *Core) MAXDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MAXDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MAX. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MAX followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MAXLookback rejects or an index that names no output.

func (*Core) MAXINDEX

func (c *Core) MAXINDEX(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outInteger []int32) (OutRange, error)

MAXINDEX computes the Index of highest value over a specified period over bars startIdx through endIdx.

Returns the index of the highest input value within a rolling window of optInTimePeriod bars. Same as MAX but outputs the location instead of the value.

Formula and more info at https://ta-lib.org/functions/maxindex.

Inputs, each at least endIdx+1 long:

  • inReal: Input series to scan.

Parameters:

  • optInTimePeriod: Window length over which the max is located. Default 30; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: Absolute index (into inReal) of the highest value in each window.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MAXINDEXLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.MAXINDEX(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [0, ..., 240]

func (*Core) MAXINDEXDisplayShift

func (c *Core) MAXINDEXDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MAXINDEXDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MAXINDEX. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MAXINDEX followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MAXINDEXLookback rejects or an index that names no output.

func (*Core) MAXINDEXLookback

func (c *Core) MAXINDEXLookback(optInTimePeriod int) (int, error)

MAXINDEXLookback returns how many leading bars Core.MAXINDEX consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MAXINDEX and returns BadParam for one out of range.

func (*Core) MAXINDEXOpen

func (c *Core) MAXINDEXOpen(inReal []float64, optInTimePeriod int) (*MAXINDEXStream, int32, error)

MAXINDEXOpen opens a live MAXINDEXStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MAXINDEX writes there.

inReal is the history; the parameters are those of Core.MAXINDEX.

The error is InsufficientHistory for a history of at most Core.MAXINDEXLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MAXINDEXOpenAndFill

func (c *Core) MAXINDEXOpenAndFill(inReal []float64, optInTimePeriod int, outInteger []int32) (*MAXINDEXStream, OutRange, error)

MAXINDEXOpenAndFill opens a stream as Core.MAXINDEXOpen does and also writes the outputs over the whole history, as Core.MAXINDEX writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MAXINDEXLookback values and share no memory with an input or another output.

The errors are those of Core.MAXINDEXOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) MAXLookback

func (c *Core) MAXLookback(optInTimePeriod int) (int, error)

MAXLookback returns how many leading bars Core.MAX consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MAX and returns BadParam for one out of range.

func (*Core) MAXOpen

func (c *Core) MAXOpen(inReal []float64, optInTimePeriod int) (*MAXStream, float64, error)

MAXOpen opens a live MAXStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MAX writes there.

inReal is the history; the parameters are those of Core.MAX.

The error is InsufficientHistory for a history of at most Core.MAXLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MAXOpenAndFill

func (c *Core) MAXOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*MAXStream, OutRange, error)

MAXOpenAndFill opens a stream as Core.MAXOpen does and also writes the outputs over the whole history, as Core.MAX writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MAXLookback values and share no memory with an input or another output.

The errors are those of Core.MAXOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MCGD

func (c *Core) MCGD(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

MCGD computes the McGinley Dynamic over bars startIdx through endIdx.

McGinley Dynamic (John R. McGinley, Jr.): a moving average whose speed adjusts to the market. Each bar closes a fraction 1 / (N * (x/MD)^4) of the gap to the price: less than RMA's 1/N while the price is above the line, more while it is below, so the line tracks falling prices faster than rising ones.

Formula and more info at https://ta-lib.org/functions/mcgd.

Inputs, each at least endIdx+1 long:

  • inReal: Data on which to compute the average.

Parameters:

  • optInTimePeriod: The N of the step's denominator. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: McGinley Dynamic line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MCGDLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdMCGD (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MCGD(0, len(series)-1, series, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [100.5076, ..., 97.7884]

func (*Core) MCGDDisplayShift

func (c *Core) MCGDDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MCGDDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MCGD. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MCGD followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MCGDLookback rejects or an index that names no output.

func (*Core) MCGDLookback

func (c *Core) MCGDLookback(optInTimePeriod int) (int, error)

MCGDLookback returns how many leading bars Core.MCGD consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdMCGD (see Core.SetUnstablePeriod).

It takes the parameters of Core.MCGD and returns BadParam for one out of range.

func (*Core) MCGDOpen

func (c *Core) MCGDOpen(inReal []float64, optInTimePeriod int) (*MCGDStream, float64, error)

MCGDOpen opens a live MCGDStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MCGD writes there.

inReal is the history; the parameters are those of Core.MCGD.

The error is InsufficientHistory for a history of at most Core.MCGDLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MCGDOpenAndFill

func (c *Core) MCGDOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*MCGDStream, OutRange, error)

MCGDOpenAndFill opens a stream as Core.MCGDOpen does and also writes the outputs over the whole history, as Core.MCGD writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MCGDLookback values and share no memory with an input or another output.

The errors are those of Core.MCGDOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MEDIAN

func (c *Core) MEDIAN(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

MEDIAN computes the Rolling Median over bars startIdx through endIdx.

The middle order statistic of the trailing window: the central value when optInTimePeriod is odd, the mean of the two central values when it is even. A robust measure of central tendency — unlike Core.SMA, a single spike moves it by at most one rank however large the spike is, which is what makes it useful as a filter rather than as a level.

Formula and more info at https://ta-lib.org/functions/median.

Inputs, each at least endIdx+1 long:

  • inReal: The series to take the median of.

Parameters:

  • optInTimePeriod: Number of trailing values in the window. Default 30; range 2 to 10000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Median of the trailing window.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MEDIANLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MEDIAN(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [92.8250, ..., 97.8250]

func (*Core) MEDIANDisplayShift

func (c *Core) MEDIANDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MEDIANDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MEDIAN. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MEDIAN followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MEDIANLookback rejects or an index that names no output.

func (*Core) MEDIANLookback

func (c *Core) MEDIANLookback(optInTimePeriod int) (int, error)

MEDIANLookback returns how many leading bars Core.MEDIAN consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MEDIAN and returns BadParam for one out of range.

func (*Core) MEDIANOpen

func (c *Core) MEDIANOpen(inReal []float64, optInTimePeriod int) (*MEDIANStream, float64, error)

MEDIANOpen opens a live MEDIANStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MEDIAN writes there.

inReal is the history; the parameters are those of Core.MEDIAN.

The error is InsufficientHistory for a history of at most Core.MEDIANLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MEDIANOpenAndFill

func (c *Core) MEDIANOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*MEDIANStream, OutRange, error)

MEDIANOpenAndFill opens a stream as Core.MEDIANOpen does and also writes the outputs over the whole history, as Core.MEDIAN writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MEDIANLookback values and share no memory with an input or another output.

The errors are those of Core.MEDIANOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MEDPRICE

func (c *Core) MEDPRICE(startIdx, endIdx int, inHigh, inLow, outReal []float64) (OutRange, error)

MEDPRICE computes the Median Price over bars startIdx through endIdx.

Median Price: the midpoint of each bar's high and low. A price-transform overlay.

Formula and more info at https://ta-lib.org/functions/medprice.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Midpoint of each bar's high and low.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MEDPRICELookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MEDPRICE(0, len(high)-1, high, low, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [110.0000, ..., 94.0500]

func (*Core) MEDPRICEDisplayShift

func (c *Core) MEDPRICEDisplayShift(outputIdx int) (int, error)

MEDPRICEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MEDPRICE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.MEDPRICE, from 0, and returns BadParam for an index that names no output.

func (*Core) MEDPRICELookback

func (c *Core) MEDPRICELookback() (int, error)

MEDPRICELookback returns how many leading bars Core.MEDPRICE consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) MEDPRICEOpen

func (c *Core) MEDPRICEOpen(inHigh, inLow []float64) (*MEDPRICEStream, float64, error)

MEDPRICEOpen opens a live MEDPRICEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MEDPRICE writes there.

inHigh and inLow are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.MEDPRICELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) MEDPRICEOpenAndFill

func (c *Core) MEDPRICEOpenAndFill(inHigh, inLow, outReal []float64) (*MEDPRICEStream, OutRange, error)

MEDPRICEOpenAndFill opens a stream as Core.MEDPRICEOpen does and also writes the outputs over the whole history, as Core.MEDPRICE writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.MEDPRICELookback values and share no memory with an input or another output.

The errors are those of Core.MEDPRICEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MFI

func (c *Core) MFI(startIdx, endIdx int, inHigh, inLow, inClose, inVolume []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

MFI computes the Money Flow Index over bars startIdx through endIdx.

Money Flow Index: a volume-weighted momentum oscillator (0-100) comparing positive vs negative money flow over a period. A volume-based analog of RSI. >80 overbought, <20 oversold.

Formula and more info at https://ta-lib.org/functions/mfi.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.
  • inVolume: Volume of each bar.

Parameters:

  • optInTimePeriod: Lookback window for summing money flow. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Money Flow Index.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MFILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MFI(0, len(high)-1, high, low, close, volume, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [0.0000, ..., 23.1186]

func (*Core) MFIDisplayShift

func (c *Core) MFIDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MFIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MFI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MFI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MFILookback rejects or an index that names no output.

func (*Core) MFILookback

func (c *Core) MFILookback(optInTimePeriod int) (int, error)

MFILookback returns how many leading bars Core.MFI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MFI and returns BadParam for one out of range.

func (*Core) MFIOpen

func (c *Core) MFIOpen(inHigh, inLow, inClose, inVolume []float64, optInTimePeriod int) (*MFIStream, float64, error)

MFIOpen opens a live MFIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MFI writes there.

inHigh, inLow, inClose and inVolume are the histories, of one length; the parameters are those of Core.MFI.

The error is InsufficientHistory for a history of at most Core.MFILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) MFIOpenAndFill

func (c *Core) MFIOpenAndFill(inHigh, inLow, inClose, inVolume []float64, optInTimePeriod int, outReal []float64) (*MFIStream, OutRange, error)

MFIOpenAndFill opens a stream as Core.MFIOpen does and also writes the outputs over the whole history, as Core.MFI writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.MFILookback values and share no memory with an input or another output.

The errors are those of Core.MFIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MIDPOINT

func (c *Core) MIDPOINT(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

MIDPOINT computes the MidPoint over period over bars startIdx through endIdx.

Midpoint over a period: the average of the highest and lowest input values within the lookback window. A single-series overlap smoother (use MIDPRICE for separate high/low price bars).

Formula and more info at https://ta-lib.org/functions/midpoint.

Inputs, each at least endIdx+1 long:

  • inReal: Series to compute the midpoint over.

Parameters:

  • optInTimePeriod: Lookback window length. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Midpoint of the period's high/low range.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MIDPOINTLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MIDPOINT(0, len(series)-1, series, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [101.2250, ..., 102.0250]

func (*Core) MIDPOINTDisplayShift

func (c *Core) MIDPOINTDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MIDPOINTDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MIDPOINT. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MIDPOINT followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MIDPOINTLookback rejects or an index that names no output.

func (*Core) MIDPOINTLookback

func (c *Core) MIDPOINTLookback(optInTimePeriod int) (int, error)

MIDPOINTLookback returns how many leading bars Core.MIDPOINT consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MIDPOINT and returns BadParam for one out of range.

func (*Core) MIDPOINTOpen

func (c *Core) MIDPOINTOpen(inReal []float64, optInTimePeriod int) (*MIDPOINTStream, float64, error)

MIDPOINTOpen opens a live MIDPOINTStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MIDPOINT writes there.

inReal is the history; the parameters are those of Core.MIDPOINT.

The error is InsufficientHistory for a history of at most Core.MIDPOINTLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MIDPOINTOpenAndFill

func (c *Core) MIDPOINTOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*MIDPOINTStream, OutRange, error)

MIDPOINTOpenAndFill opens a stream as Core.MIDPOINTOpen does and also writes the outputs over the whole history, as Core.MIDPOINT writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MIDPOINTLookback values and share no memory with an input or another output.

The errors are those of Core.MIDPOINTOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MIDPRICE

func (c *Core) MIDPRICE(startIdx, endIdx int, inHigh, inLow []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

MIDPRICE computes the Midpoint Price over period over bars startIdx through endIdx.

Midpoint of the price range over a rolling window: the average of the highest high and lowest low across the last optInTimePeriod bars. An overlap-study line plotted on price.

Formula and more info at https://ta-lib.org/functions/midprice.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInTimePeriod: Window length over which the high/low extremes are taken. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Midpoint of the period's high/low extremes.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MIDPRICELookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MIDPRICE(0, len(high)-1, high, low, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [101.2250, ..., 101.9250]

func (*Core) MIDPRICEDisplayShift

func (c *Core) MIDPRICEDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MIDPRICEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MIDPRICE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MIDPRICE followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MIDPRICELookback rejects or an index that names no output.

func (*Core) MIDPRICELookback

func (c *Core) MIDPRICELookback(optInTimePeriod int) (int, error)

MIDPRICELookback returns how many leading bars Core.MIDPRICE consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MIDPRICE and returns BadParam for one out of range.

func (*Core) MIDPRICEOpen

func (c *Core) MIDPRICEOpen(inHigh, inLow []float64, optInTimePeriod int) (*MIDPRICEStream, float64, error)

MIDPRICEOpen opens a live MIDPRICEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MIDPRICE writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.MIDPRICE.

The error is InsufficientHistory for a history of at most Core.MIDPRICELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) MIDPRICEOpenAndFill

func (c *Core) MIDPRICEOpenAndFill(inHigh, inLow []float64, optInTimePeriod int, outReal []float64) (*MIDPRICEStream, OutRange, error)

MIDPRICEOpenAndFill opens a stream as Core.MIDPRICEOpen does and also writes the outputs over the whole history, as Core.MIDPRICE writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.MIDPRICELookback values and share no memory with an input or another output.

The errors are those of Core.MIDPRICEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MIN

func (c *Core) MIN(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

MIN computes the Lowest value over a specified period over bars startIdx through endIdx.

Rolling minimum: the lowest input value over the trailing period.

Formula and more info at https://ta-lib.org/functions/min.

Inputs, each at least endIdx+1 long:

  • inReal: Source series to take the minimum of.

Parameters:

  • optInTimePeriod: Number of bars in the trailing window. Default 30; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Lowest input value over the trailing window.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MINLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MIN(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [90.0000, ..., 90.2000]

func (*Core) MINDisplayShift

func (c *Core) MINDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MINDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MIN. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MIN followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MINLookback rejects or an index that names no output.

func (*Core) MININDEX

func (c *Core) MININDEX(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outInteger []int32) (OutRange, error)

MININDEX computes the Index of lowest value over a specified period over bars startIdx through endIdx.

Returns the absolute index of the lowest value within a rolling window of the given period. Same scan as MIN but outputs the position of the minimum rather than its value.

Formula and more info at https://ta-lib.org/functions/minindex.

Inputs, each at least endIdx+1 long:

  • inReal: Series to scan for its minimum.

Parameters:

  • optInTimePeriod: Window length over which the minimum is located. Default 30; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outInteger: Absolute index in inReal of the lowest value in each window.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MININDEXLookback: a range that ends before it returns NBElement 0.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short or an output empty or too short.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.MININDEX(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%d, ..., %d]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [20, ..., 222]

func (*Core) MININDEXDisplayShift

func (c *Core) MININDEXDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MININDEXDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MININDEX. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MININDEX followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MININDEXLookback rejects or an index that names no output.

func (*Core) MININDEXLookback

func (c *Core) MININDEXLookback(optInTimePeriod int) (int, error)

MININDEXLookback returns how many leading bars Core.MININDEX consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MININDEX and returns BadParam for one out of range.

func (*Core) MININDEXOpen

func (c *Core) MININDEXOpen(inReal []float64, optInTimePeriod int) (*MININDEXStream, int32, error)

MININDEXOpen opens a live MININDEXStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MININDEX writes there.

inReal is the history; the parameters are those of Core.MININDEX.

The error is InsufficientHistory for a history of at most Core.MININDEXLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MININDEXOpenAndFill

func (c *Core) MININDEXOpenAndFill(inReal []float64, optInTimePeriod int, outInteger []int32) (*MININDEXStream, OutRange, error)

MININDEXOpenAndFill opens a stream as Core.MININDEXOpen does and also writes the outputs over the whole history, as Core.MININDEX writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MININDEXLookback values and share no memory with an input or another output.

The errors are those of Core.MININDEXOpen, and BadParam for an output that is empty, too short or sharing memory.

func (*Core) MINLookback

func (c *Core) MINLookback(optInTimePeriod int) (int, error)

MINLookback returns how many leading bars Core.MIN consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MIN and returns BadParam for one out of range.

func (*Core) MINMAX

func (c *Core) MINMAX(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outMin, outMax []float64) (OutRange, error)

MINMAX computes the Lowest and highest values over a specified period over bars startIdx through endIdx.

Returns both the lowest and highest values of the input over a rolling window of the last optInTimePeriod bars. An overlap-study companion to MIN and MAX that computes both extrema in one pass.

Formula and more info at https://ta-lib.org/functions/minmax.

Inputs, each at least endIdx+1 long:

  • inReal: Values scanned for the window min and max.

Parameters:

  • optInTimePeriod: Rolling window length. Default 30; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outMin: Lowest value in each rolling window.
  • outMax: Highest value in each rolling window.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MINMAXLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	min := make([]float64, 252)
	max := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MINMAX(0, len(series)-1, series, 30, min, max)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("min = [%.4f, ..., %.4f]\n", min[0], min[r.NBElement-1])
	fmt.Printf("max = [%.4f, ..., %.4f]\n", max[0], max[r.NBElement-1])
}
Output:
223 values from bar 29:
min = [90.0000, ..., 90.2000]
max = [110.0000, ..., 110.0000]

func (*Core) MINMAXDisplayShift

func (c *Core) MINMAXDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MINMAXDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MINMAX. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MINMAX followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MINMAXLookback rejects or an index that names no output.

func (*Core) MINMAXINDEX

func (c *Core) MINMAXINDEX(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outMinIdx, outMaxIdx []int32) (OutRange, error)

MINMAXINDEX computes the Indexes of lowest and highest values over a specified period over bars startIdx through endIdx.

Returns the absolute input indices of the lowest and highest values within each rolling window of optInTimePeriod bars. Index variant of MINMAX.

Formula and more info at https://ta-lib.org/functions/minmaxindex.

Inputs, each at least endIdx+1 long:

  • inReal: Input series scanned for extremes.

Parameters:

  • optInTimePeriod: Window length in bars. Default 30; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outMinIdx: Absolute index (into inReal) of the window minimum.
  • outMaxIdx: Absolute index (into inReal) of the window maximum.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MINMAXINDEXLookback: a range that ends before it returns NBElement 0.

Outputs may not share memory with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	minIdx := make([]int32, 252)
	maxIdx := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.MINMAXINDEX(0, len(series)-1, series, 30, minIdx, maxIdx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("minIdx = [%d, ..., %d]\n", minIdx[0], minIdx[r.NBElement-1])
	fmt.Printf("maxIdx = [%d, ..., %d]\n", maxIdx[0], maxIdx[r.NBElement-1])
}
Output:
223 values from bar 29:
minIdx = [20, ..., 222]
maxIdx = [0, ..., 240]

func (*Core) MINMAXINDEXDisplayShift

func (c *Core) MINMAXINDEXDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MINMAXINDEXDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MINMAXINDEX. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MINMAXINDEX followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MINMAXINDEXLookback rejects or an index that names no output.

func (*Core) MINMAXINDEXLookback

func (c *Core) MINMAXINDEXLookback(optInTimePeriod int) (int, error)

MINMAXINDEXLookback returns how many leading bars Core.MINMAXINDEX consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MINMAXINDEX and returns BadParam for one out of range.

func (*Core) MINMAXINDEXOpen

func (c *Core) MINMAXINDEXOpen(inReal []float64, optInTimePeriod int) (*MINMAXINDEXStream, int32, int32, error)

MINMAXINDEXOpen opens a live MINMAXINDEXStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outMinIdx and outMaxIdx), the values Core.MINMAXINDEX writes there.

inReal is the history; the parameters are those of Core.MINMAXINDEX.

The error is InsufficientHistory for a history of at most Core.MINMAXINDEXLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MINMAXINDEXOpenAndFill

func (c *Core) MINMAXINDEXOpenAndFill(inReal []float64, optInTimePeriod int, outMinIdx, outMaxIdx []int32) (*MINMAXINDEXStream, OutRange, error)

MINMAXINDEXOpenAndFill opens a stream as Core.MINMAXINDEXOpen does and also writes the outputs over the whole history, as Core.MINMAXINDEX writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MINMAXINDEXLookback values and share no memory with an input or another output.

The errors are those of Core.MINMAXINDEXOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MINMAXLookback

func (c *Core) MINMAXLookback(optInTimePeriod int) (int, error)

MINMAXLookback returns how many leading bars Core.MINMAX consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MINMAX and returns BadParam for one out of range.

func (*Core) MINMAXOpen

func (c *Core) MINMAXOpen(inReal []float64, optInTimePeriod int) (*MINMAXStream, float64, float64, error)

MINMAXOpen opens a live MINMAXStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outMin and outMax), the values Core.MINMAX writes there.

inReal is the history; the parameters are those of Core.MINMAX.

The error is InsufficientHistory for a history of at most Core.MINMAXLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MINMAXOpenAndFill

func (c *Core) MINMAXOpenAndFill(inReal []float64, optInTimePeriod int, outMin, outMax []float64) (*MINMAXStream, OutRange, error)

MINMAXOpenAndFill opens a stream as Core.MINMAXOpen does and also writes the outputs over the whole history, as Core.MINMAX writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MINMAXLookback values and share no memory with an input or another output.

The errors are those of Core.MINMAXOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MINOpen

func (c *Core) MINOpen(inReal []float64, optInTimePeriod int) (*MINStream, float64, error)

MINOpen opens a live MINStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MIN writes there.

inReal is the history; the parameters are those of Core.MIN.

The error is InsufficientHistory for a history of at most Core.MINLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MINOpenAndFill

func (c *Core) MINOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*MINStream, OutRange, error)

MINOpenAndFill opens a stream as Core.MINOpen does and also writes the outputs over the whole history, as Core.MIN writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MINLookback values and share no memory with an input or another output.

The errors are those of Core.MINOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MINUS_DI

func (c *Core) MINUS_DI(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

MINUS_DI computes the Minus Directional Indicator over bars startIdx through endIdx.

Wilder's Minus Directional Indicator: the Wilder-smoothed downward directional movement (-DM) normalized by smoothed True Range. Measures the strength of downward price movement. Higher -DI indicates a stronger downtrend; compared against +DI to gauge directional dominance.

Formula and more info at https://ta-lib.org/functions/minus_di.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Smoothing/lookback period for -DM and TR. Default 14; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: The Minus Directional Indicator (-DI) line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MINUS_DILookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdMINUS_DI (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MINUS_DIDisplayShift

func (c *Core) MINUS_DIDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MINUS_DIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MINUS_DI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MINUS_DI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MINUS_DILookback rejects or an index that names no output.

func (*Core) MINUS_DILookback

func (c *Core) MINUS_DILookback(optInTimePeriod int) (int, error)

MINUS_DILookback returns how many leading bars Core.MINUS_DI consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdMINUS_DI (see Core.SetUnstablePeriod).

It takes the parameters of Core.MINUS_DI and returns BadParam for one out of range.

func (*Core) MINUS_DIOpen

func (c *Core) MINUS_DIOpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*MINUS_DIStream, float64, error)

MINUS_DIOpen opens a live MINUS_DIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MINUS_DI writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.MINUS_DI.

The error is InsufficientHistory for a history of at most Core.MINUS_DILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) MINUS_DIOpenAndFill

func (c *Core) MINUS_DIOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (*MINUS_DIStream, OutRange, error)

MINUS_DIOpenAndFill opens a stream as Core.MINUS_DIOpen does and also writes the outputs over the whole history, as Core.MINUS_DI writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.MINUS_DILookback values and share no memory with an input or another output.

The errors are those of Core.MINUS_DIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MINUS_DM

func (c *Core) MINUS_DM(startIdx, endIdx int, inHigh, inLow []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

MINUS_DM computes the Minus Directional Movement over bars startIdx through endIdx.

Minus Directional Movement, the downward component of Wilder's directional movement system. Measures Wilder-smoothed downward price motion over the period. Higher -DM indicates stronger downward directional movement.

Formula and more info at https://ta-lib.org/functions/minus_dm.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInTimePeriod: Wilder smoothing period. Default 14; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Smoothed minus directional movement.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MINUS_DMLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdMINUS_DM (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MINUS_DMDisplayShift

func (c *Core) MINUS_DMDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MINUS_DMDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MINUS_DM. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MINUS_DM followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MINUS_DMLookback rejects or an index that names no output.

func (*Core) MINUS_DMLookback

func (c *Core) MINUS_DMLookback(optInTimePeriod int) (int, error)

MINUS_DMLookback returns how many leading bars Core.MINUS_DM consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdMINUS_DM (see Core.SetUnstablePeriod).

It takes the parameters of Core.MINUS_DM and returns BadParam for one out of range.

func (*Core) MINUS_DMOpen

func (c *Core) MINUS_DMOpen(inHigh, inLow []float64, optInTimePeriod int) (*MINUS_DMStream, float64, error)

MINUS_DMOpen opens a live MINUS_DMStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MINUS_DM writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.MINUS_DM.

The error is InsufficientHistory for a history of at most Core.MINUS_DMLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) MINUS_DMOpenAndFill

func (c *Core) MINUS_DMOpenAndFill(inHigh, inLow []float64, optInTimePeriod int, outReal []float64) (*MINUS_DMStream, OutRange, error)

MINUS_DMOpenAndFill opens a stream as Core.MINUS_DMOpen does and also writes the outputs over the whole history, as Core.MINUS_DM writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.MINUS_DMLookback values and share no memory with an input or another output.

The errors are those of Core.MINUS_DMOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MOM

func (c *Core) MOM(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

MOM computes the Momentum over bars startIdx through endIdx.

Momentum: current price minus the price optInTimePeriod bars ago. The absolute (unnormalized) rate of change. Positive = price rose over the period, negative = fell; centered at zero.

Formula and more info at https://ta-lib.org/functions/mom.

Inputs, each at least endIdx+1 long:

  • inReal: Input price series.

Parameters:

  • optInTimePeriod: Lookback distance in bars. Default 10; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Momentum (current minus value optInTimePeriod bars ago)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MOMLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MOM(0, len(series)-1, series, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [-15.0000, ..., -14.0000]

func (*Core) MOMDisplayShift

func (c *Core) MOMDisplayShift(optInTimePeriod, outputIdx int) (int, error)

MOMDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MOM. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.MOM followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.MOMLookback rejects or an index that names no output.

func (*Core) MOMLookback

func (c *Core) MOMLookback(optInTimePeriod int) (int, error)

MOMLookback returns how many leading bars Core.MOM consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.MOM and returns BadParam for one out of range.

func (*Core) MOMOpen

func (c *Core) MOMOpen(inReal []float64, optInTimePeriod int) (*MOMStream, float64, error)

MOMOpen opens a live MOMStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MOM writes there.

inReal is the history; the parameters are those of Core.MOM.

The error is InsufficientHistory for a history of at most Core.MOMLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) MOMOpenAndFill

func (c *Core) MOMOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*MOMStream, OutRange, error)

MOMOpenAndFill opens a stream as Core.MOMOpen does and also writes the outputs over the whole history, as Core.MOM writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.MOMLookback values and share no memory with an input or another output.

The errors are those of Core.MOMOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) MULT

func (c *Core) MULT(startIdx, endIdx int, inReal0, inReal1, outReal []float64) (OutRange, error)

MULT computes the Vector Arithmetic Mult over bars startIdx through endIdx.

Element-wise multiplication of two input series.

Formula and more info at https://ta-lib.org/functions/mult.

Inputs, each at least endIdx+1 long:

  • inReal0: First operand series.
  • inReal1: Second operand series.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Product of the two inputs at each index.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.MULTLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series0 := make([]float64, 252) // your data, oldest first
	for i := range series0 {
		series0[i] = float64(10*(i%40-20)*(i%40-20)-2000) / 201
	}
	series1 := make([]float64, 252) // your data, oldest first
	for i := range series1 {
		series1[i] = -5 + 10*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.MULT(0, len(series0)-1, series0, series1, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [-49.7512, ..., -29.6020]

func (*Core) MULTDisplayShift

func (c *Core) MULTDisplayShift(outputIdx int) (int, error)

MULTDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.MULT. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.MULT, from 0, and returns BadParam for an index that names no output.

func (*Core) MULTLookback

func (c *Core) MULTLookback() (int, error)

MULTLookback returns how many leading bars Core.MULT consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) MULTOpen

func (c *Core) MULTOpen(inReal0, inReal1 []float64) (*MULTStream, float64, error)

MULTOpen opens a live MULTStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.MULT writes there.

inReal0 and inReal1 are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.MULTLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) MULTOpenAndFill

func (c *Core) MULTOpenAndFill(inReal0, inReal1, outReal []float64) (*MULTStream, OutRange, error)

MULTOpenAndFill opens a stream as Core.MULTOpen does and also writes the outputs over the whole history, as Core.MULT writes them for bars 0 through len(inReal0)-1, returning that range.

Each output must hold len(inReal0) minus Core.MULTLookback values and share no memory with an input or another output.

The errors are those of Core.MULTOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) NATR

func (c *Core) NATR(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

NATR computes the Normalized Average True Range over bars startIdx through endIdx.

Average True Range expressed as a percentage of the current close, making volatility comparable across price levels and securities. Same computation as ATR, then normalized by close. Higher values mean greater relative volatility; unit is percent of price.

Formula and more info at https://ta-lib.org/functions/natr.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Smoothing period for the true range average. Default 14; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: ATR as a percentage of the close.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.NATRLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdNATR (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.NATR(0, len(high)-1, high, low, close, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [6.1078, ..., 5.9415]

func (*Core) NATRDisplayShift

func (c *Core) NATRDisplayShift(optInTimePeriod, outputIdx int) (int, error)

NATRDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.NATR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.NATR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.NATRLookback rejects or an index that names no output.

func (*Core) NATRLookback

func (c *Core) NATRLookback(optInTimePeriod int) (int, error)

NATRLookback returns how many leading bars Core.NATR consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdNATR (see Core.SetUnstablePeriod).

It takes the parameters of Core.NATR and returns BadParam for one out of range.

func (*Core) NATROpen

func (c *Core) NATROpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*NATRStream, float64, error)

NATROpen opens a live NATRStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.NATR writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.NATR.

The error is InsufficientHistory for a history of at most Core.NATRLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) NATROpenAndFill

func (c *Core) NATROpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (*NATRStream, OutRange, error)

NATROpenAndFill opens a stream as Core.NATROpen does and also writes the outputs over the whole history, as Core.NATR writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.NATRLookback values and share no memory with an input or another output.

The errors are those of Core.NATROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) NVI

func (c *Core) NVI(startIdx, endIdx int, inClose, inVolume, outReal []float64) (OutRange, error)

NVI computes the Negative Volume Index over bars startIdx through endIdx.

Negative Volume Index: a running cumulative index that changes only on days when volume falls versus the prior day, compounding that day's percentage price change. The premise is that quiet, low-volume days reflect the actions of well-informed "smart money", so NVI is read as a proxy for that cohort's positioning.

Formula and more info at https://ta-lib.org/functions/nvi.

Inputs, each at least endIdx+1 long:

  • inClose: Close price of each bar.
  • inVolume: Volume of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Cumulative negative volume index (seeded at 1000)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.NVILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.NVI(0, len(close)-1, close, volume, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [1000.0000, ..., 522.1223]

func (*Core) NVIDisplayShift

func (c *Core) NVIDisplayShift(outputIdx int) (int, error)

NVIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.NVI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.NVI, from 0, and returns BadParam for an index that names no output.

func (*Core) NVILookback

func (c *Core) NVILookback() (int, error)

NVILookback returns how many leading bars Core.NVI consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) NVIOpen

func (c *Core) NVIOpen(inClose, inVolume []float64) (*NVIStream, float64, error)

NVIOpen opens a live NVIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.NVI writes there.

inClose and inVolume are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.NVILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) NVIOpenAndFill

func (c *Core) NVIOpenAndFill(inClose, inVolume, outReal []float64) (*NVIStream, OutRange, error)

NVIOpenAndFill opens a stream as Core.NVIOpen does and also writes the outputs over the whole history, as Core.NVI writes them for bars 0 through len(inClose)-1, returning that range.

Each output must hold len(inClose) minus Core.NVILookback values and share no memory with an input or another output.

The errors are those of Core.NVIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) OBV

func (c *Core) OBV(startIdx, endIdx int, inReal, inVolume, outReal []float64) (OutRange, error)

OBV computes the On Balance Volume over bars startIdx through endIdx.

On Balance Volume: a running cumulative total of volume, added on up-price bars and subtracted on down-price bars. Relates volume flow to price direction.

Formula and more info at https://ta-lib.org/functions/obv.

Inputs, each at least endIdx+1 long:

  • inReal: Price series, typically close.
  • inVolume: Volume of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Cumulative on-balance volume.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.OBVLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.OBV(0, len(series)-1, series, volume, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [13000.0000, ..., -136180.0000]

func (*Core) OBVDisplayShift

func (c *Core) OBVDisplayShift(outputIdx int) (int, error)

OBVDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.OBV. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.OBV, from 0, and returns BadParam for an index that names no output.

func (*Core) OBVLookback

func (c *Core) OBVLookback() (int, error)

OBVLookback returns how many leading bars Core.OBV consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) OBVOpen

func (c *Core) OBVOpen(inReal, inVolume []float64) (*OBVStream, float64, error)

OBVOpen opens a live OBVStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.OBV writes there.

inReal and inVolume are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.OBVLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) OBVOpenAndFill

func (c *Core) OBVOpenAndFill(inReal, inVolume, outReal []float64) (*OBVStream, OutRange, error)

OBVOpenAndFill opens a stream as Core.OBVOpen does and also writes the outputs over the whole history, as Core.OBV writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.OBVLookback values and share no memory with an input or another output.

The errors are those of Core.OBVOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) PERCENTB

func (c *Core) PERCENTB(startIdx, endIdx int, inReal []float64, optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType, outReal []float64) (OutRange, error)

PERCENTB computes the Bollinger Bands %B over bars startIdx through endIdx.

Bollinger Bands %B: where the input sits relative to its Bollinger Bands, 0 at the lower band and 1 at the upper band. Values below 0 or above 1 mean the input is outside the bands.

Formula and more info at https://ta-lib.org/functions/percentb.

Inputs, each at least endIdx+1 long:

  • inReal: Input data series.

Parameters:

  • optInTimePeriod: Periods for the MA and standard deviation. Default 20; range 2 to 10000; IntegerDefault selects the default.
  • optInNbDevUp: Standard-deviation multiplier for the upper band. Default 2; RealDefault selects the default.
  • optInNbDevDn: Standard-deviation multiplier for the lower band. Default 2; RealDefault selects the default.
  • optInMAType: Moving-average type for the middle band. Default MATypeSMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Position of the input between the lower band (0) and the upper band (1)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.PERCENTBLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.PERCENTB(0, len(series)-1, series, 20, 2, 2, talib.MATypeSMA, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
233 values from bar 19: [0.2142, ..., 0.0854]

func (*Core) PERCENTBDisplayShift

func (c *Core) PERCENTBDisplayShift(optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType, outputIdx int) (int, error)

PERCENTBDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.PERCENTB. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.PERCENTB followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.PERCENTBLookback rejects or an index that names no output.

func (*Core) PERCENTBLookback

func (c *Core) PERCENTBLookback(optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType) (int, error)

PERCENTBLookback returns how many leading bars Core.PERCENTB consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.PERCENTB and returns BadParam for one out of range.

func (*Core) PERCENTBOpen

func (c *Core) PERCENTBOpen(inReal []float64, optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType) (*PERCENTBStream, float64, error)

PERCENTBOpen opens a live PERCENTBStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.PERCENTB writes there.

inReal is the history; the parameters are those of Core.PERCENTB.

The error is InsufficientHistory for a history of at most Core.PERCENTBLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) PERCENTBOpenAndFill

func (c *Core) PERCENTBOpenAndFill(inReal []float64, optInTimePeriod int, optInNbDevUp, optInNbDevDn float64, optInMAType MAType, outReal []float64) (*PERCENTBStream, OutRange, error)

PERCENTBOpenAndFill opens a stream as Core.PERCENTBOpen does and also writes the outputs over the whole history, as Core.PERCENTB writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.PERCENTBLookback values and share no memory with an input or another output.

The errors are those of Core.PERCENTBOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) PERCENTILE

func (c *Core) PERCENTILE(startIdx, endIdx int, inReal []float64, optInTimePeriod int, optInPercentile float64, outReal []float64) (OutRange, error)

PERCENTILE computes the Percentile (nearest rank) over bars startIdx through endIdx.

Rolling percentile by the nearest-rank method: sort the trailing window ascending and report the value whose 1-based ordinal rank is the P-th percentile of the window size. The result is always a value that actually occurred in the window, never an interpolation, so it stays on the price scale and never invents a level the series never traded at. At P = 50 with an odd window it is the rolling median; at the extremes it degenerates to the rolling minimum and maximum.

Formula and more info at https://ta-lib.org/functions/percentile.

Inputs, each at least endIdx+1 long:

  • inReal: Source series to take the percentile of.

Parameters:

  • optInTimePeriod: Number of bars in the trailing window. Default 100; range 2 to 10000; IntegerDefault selects the default.
  • optInPercentile: Percentage position within the sorted window. Default 50; range 0 to 100; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: The value at the requested rank within the trailing window.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.PERCENTILELookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.PERCENTILE(0, len(series)-1, series, 100, 50, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
153 values from bar 99: [95.0000, ..., 97.2000]

func (*Core) PERCENTILEDisplayShift

func (c *Core) PERCENTILEDisplayShift(optInTimePeriod int, optInPercentile float64, outputIdx int) (int, error)

PERCENTILEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.PERCENTILE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.PERCENTILE followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.PERCENTILELookback rejects or an index that names no output.

func (*Core) PERCENTILELookback

func (c *Core) PERCENTILELookback(optInTimePeriod int, optInPercentile float64) (int, error)

PERCENTILELookback returns how many leading bars Core.PERCENTILE consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.PERCENTILE and returns BadParam for one out of range.

func (*Core) PERCENTILEOpen

func (c *Core) PERCENTILEOpen(inReal []float64, optInTimePeriod int, optInPercentile float64) (*PERCENTILEStream, float64, error)

PERCENTILEOpen opens a live PERCENTILEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.PERCENTILE writes there.

inReal is the history; the parameters are those of Core.PERCENTILE.

The error is InsufficientHistory for a history of at most Core.PERCENTILELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) PERCENTILEOpenAndFill

func (c *Core) PERCENTILEOpenAndFill(inReal []float64, optInTimePeriod int, optInPercentile float64, outReal []float64) (*PERCENTILEStream, OutRange, error)

PERCENTILEOpenAndFill opens a stream as Core.PERCENTILEOpen does and also writes the outputs over the whole history, as Core.PERCENTILE writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.PERCENTILELookback values and share no memory with an input or another output.

The errors are those of Core.PERCENTILEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) PERCENTRANK

func (c *Core) PERCENTRANK(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

PERCENTRANK computes the Percent Rank over bars startIdx through endIdx.

Percent Rank: where the current value sits inside the distribution of the values that came before it, as a percentage.

Formula and more info at https://ta-lib.org/functions/percentrank.

Inputs, each at least endIdx+1 long:

  • inReal: Source price/value series.

Parameters:

  • optInTimePeriod: Number of preceding values the current value is ranked against. Default 100; range 2 to 10000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Percentage of the preceding window strictly below the current value, 0 to 100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.PERCENTRANKLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.PERCENTRANK(0, len(series)-1, series, 100, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
152 values from bar 100: [0.0000, ..., 34.0000]

func (*Core) PERCENTRANKDisplayShift

func (c *Core) PERCENTRANKDisplayShift(optInTimePeriod, outputIdx int) (int, error)

PERCENTRANKDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.PERCENTRANK. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.PERCENTRANK followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.PERCENTRANKLookback rejects or an index that names no output.

func (*Core) PERCENTRANKLookback

func (c *Core) PERCENTRANKLookback(optInTimePeriod int) (int, error)

PERCENTRANKLookback returns how many leading bars Core.PERCENTRANK consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.PERCENTRANK and returns BadParam for one out of range.

func (*Core) PERCENTRANKOpen

func (c *Core) PERCENTRANKOpen(inReal []float64, optInTimePeriod int) (*PERCENTRANKStream, float64, error)

PERCENTRANKOpen opens a live PERCENTRANKStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.PERCENTRANK writes there.

inReal is the history; the parameters are those of Core.PERCENTRANK.

The error is InsufficientHistory for a history of at most Core.PERCENTRANKLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) PERCENTRANKOpenAndFill

func (c *Core) PERCENTRANKOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*PERCENTRANKStream, OutRange, error)

PERCENTRANKOpenAndFill opens a stream as Core.PERCENTRANKOpen does and also writes the outputs over the whole history, as Core.PERCENTRANK writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.PERCENTRANKLookback values and share no memory with an input or another output.

The errors are those of Core.PERCENTRANKOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) PLUS_DI

func (c *Core) PLUS_DI(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

PLUS_DI computes the Plus Directional Indicator over bars startIdx through endIdx.

Plus Directional Indicator: the Wilder-smoothed positive directional movement expressed as a percentage of the true range. Measures the strength of upward price movement. Rising +DI signals strengthening upward direction; compared against MINUS_DI to judge trend direction.

Formula and more info at https://ta-lib.org/functions/plus_di.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Wilder smoothing period. Default 14; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Plus Directional Indicator.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.PLUS_DILookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdPLUS_DI (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) PLUS_DIDisplayShift

func (c *Core) PLUS_DIDisplayShift(optInTimePeriod, outputIdx int) (int, error)

PLUS_DIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.PLUS_DI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.PLUS_DI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.PLUS_DILookback rejects or an index that names no output.

func (*Core) PLUS_DILookback

func (c *Core) PLUS_DILookback(optInTimePeriod int) (int, error)

PLUS_DILookback returns how many leading bars Core.PLUS_DI consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdPLUS_DI (see Core.SetUnstablePeriod).

It takes the parameters of Core.PLUS_DI and returns BadParam for one out of range.

func (*Core) PLUS_DIOpen

func (c *Core) PLUS_DIOpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*PLUS_DIStream, float64, error)

PLUS_DIOpen opens a live PLUS_DIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.PLUS_DI writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.PLUS_DI.

The error is InsufficientHistory for a history of at most Core.PLUS_DILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) PLUS_DIOpenAndFill

func (c *Core) PLUS_DIOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (*PLUS_DIStream, OutRange, error)

PLUS_DIOpenAndFill opens a stream as Core.PLUS_DIOpen does and also writes the outputs over the whole history, as Core.PLUS_DI writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.PLUS_DILookback values and share no memory with an input or another output.

The errors are those of Core.PLUS_DIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) PLUS_DM

func (c *Core) PLUS_DM(startIdx, endIdx int, inHigh, inLow []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

PLUS_DM computes the Plus Directional Movement over bars startIdx through endIdx.

Plus Directional Movement: the Wilder-smoothed accumulation of upward directional movement (+DM1). A component of the Directional Movement System used to build +DI/DX/ADX.

Formula and more info at https://ta-lib.org/functions/plus_dm.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInTimePeriod: Wilder smoothing period. Default 14; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Smoothed plus directional movement.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.PLUS_DMLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdPLUS_DM (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) PLUS_DMDisplayShift

func (c *Core) PLUS_DMDisplayShift(optInTimePeriod, outputIdx int) (int, error)

PLUS_DMDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.PLUS_DM. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.PLUS_DM followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.PLUS_DMLookback rejects or an index that names no output.

func (*Core) PLUS_DMLookback

func (c *Core) PLUS_DMLookback(optInTimePeriod int) (int, error)

PLUS_DMLookback returns how many leading bars Core.PLUS_DM consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdPLUS_DM (see Core.SetUnstablePeriod).

It takes the parameters of Core.PLUS_DM and returns BadParam for one out of range.

func (*Core) PLUS_DMOpen

func (c *Core) PLUS_DMOpen(inHigh, inLow []float64, optInTimePeriod int) (*PLUS_DMStream, float64, error)

PLUS_DMOpen opens a live PLUS_DMStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.PLUS_DM writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.PLUS_DM.

The error is InsufficientHistory for a history of at most Core.PLUS_DMLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) PLUS_DMOpenAndFill

func (c *Core) PLUS_DMOpenAndFill(inHigh, inLow []float64, optInTimePeriod int, outReal []float64) (*PLUS_DMStream, OutRange, error)

PLUS_DMOpenAndFill opens a stream as Core.PLUS_DMOpen does and also writes the outputs over the whole history, as Core.PLUS_DM writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.PLUS_DMLookback values and share no memory with an input or another output.

The errors are those of Core.PLUS_DMOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) PPO

func (c *Core) PPO(startIdx, endIdx int, inReal []float64, optInFastPeriod, optInSlowPeriod int, optInMAType MAType, outReal []float64) (OutRange, error)

PPO computes the Percentage Price Oscillator over bars startIdx through endIdx.

Percentage Price Oscillator: the difference between a fast and slow moving average expressed as a percentage of the slow MA. A normalized (scale-invariant) variant of APO. Positive when the fast MA is above the slow MA (upward momentum), negative otherwise; magnitude is the % deviation.

Formula and more info at https://ta-lib.org/functions/ppo.

Inputs, each at least endIdx+1 long:

  • inReal: Input data series.

Parameters:

  • optInFastPeriod: Period of the fast MA. Default 12; range 2 to 10000; IntegerDefault selects the default.
  • optInSlowPeriod: Period of the slow MA. Default 26; range 2 to 10000; IntegerDefault selects the default.
  • optInMAType: Moving average type used for both MAs. Default MATypeEMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: PPO value in percent.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.PPOLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.PPO(0, len(series)-1, series, 12, 26, talib.MATypeEMA, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
227 values from bar 25: [-4.1202, ..., -0.2805]

func (*Core) PPODisplayShift

func (c *Core) PPODisplayShift(optInFastPeriod, optInSlowPeriod int, optInMAType MAType, outputIdx int) (int, error)

PPODisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.PPO. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.PPO followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.PPOLookback rejects or an index that names no output.

func (*Core) PPOLookback

func (c *Core) PPOLookback(optInFastPeriod, optInSlowPeriod int, optInMAType MAType) (int, error)

PPOLookback returns how many leading bars Core.PPO consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.PPO and returns BadParam for one out of range.

func (*Core) PPOOpen

func (c *Core) PPOOpen(inReal []float64, optInFastPeriod, optInSlowPeriod int, optInMAType MAType) (*PPOStream, float64, error)

PPOOpen opens a live PPOStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.PPO writes there.

inReal is the history; the parameters are those of Core.PPO.

The error is InsufficientHistory for a history of at most Core.PPOLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) PPOOpenAndFill

func (c *Core) PPOOpenAndFill(inReal []float64, optInFastPeriod, optInSlowPeriod int, optInMAType MAType, outReal []float64) (*PPOStream, OutRange, error)

PPOOpenAndFill opens a stream as Core.PPOOpen does and also writes the outputs over the whole history, as Core.PPO writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.PPOLookback values and share no memory with an input or another output.

The errors are those of Core.PPOOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) PSO

func (c *Core) PSO(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInFastK_Period, optInEMAPeriod int, outReal []float64) (OutRange, error)

PSO computes the Premier Stochastic Oscillator over bars startIdx through endIdx.

Premier Stochastic Oscillator: a short-period Fast %K, recentred on zero and rescaled, double-smoothed and then squashed into the range -1 to +1. Leibfarth's reading is that the plain stochastic spends most of its life pinned at one end or the other, so the extremes stop meaning anything; the two exponential passes strip the bar-to-bar noise out of it, and the squash gives back a scale on which the extremes are rare again. Readings beyond ±0.9 are the extremes, and ±0.2 the band Leibfarth watches for the crossing back toward the middle.

Formula and more info at https://ta-lib.org/functions/pso.

Inputs, each at least endIdx+1 long:

  • inHigh: High price series.
  • inLow: Low price series.
  • inClose: Close price series.

Parameters:

  • optInFastK_Period: Time period for building the Fast-K line. Default 8; range 1 to 100000; IntegerDefault selects the default.
  • optInEMAPeriod: Period of each of the two smoothing passes. Default 5; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Premier Stochastic Oscillator, -1 to +1.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.PSOLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.PSO(0, len(high)-1, high, low, close, 8, 5, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
237 values from bar 15: [-0.9178, ..., -0.8578]

func (*Core) PSODisplayShift

func (c *Core) PSODisplayShift(optInFastK_Period, optInEMAPeriod, outputIdx int) (int, error)

PSODisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.PSO. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.PSO followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.PSOLookback rejects or an index that names no output.

func (*Core) PSOLookback

func (c *Core) PSOLookback(optInFastK_Period, optInEMAPeriod int) (int, error)

PSOLookback returns how many leading bars Core.PSO consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.PSO and returns BadParam for one out of range.

func (*Core) PSOOpen

func (c *Core) PSOOpen(inHigh, inLow, inClose []float64, optInFastK_Period, optInEMAPeriod int) (*PSOStream, float64, error)

PSOOpen opens a live PSOStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.PSO writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.PSO.

The error is InsufficientHistory for a history of at most Core.PSOLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) PSOOpenAndFill

func (c *Core) PSOOpenAndFill(inHigh, inLow, inClose []float64, optInFastK_Period, optInEMAPeriod int, outReal []float64) (*PSOStream, OutRange, error)

PSOOpenAndFill opens a stream as Core.PSOOpen does and also writes the outputs over the whole history, as Core.PSO writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.PSOLookback values and share no memory with an input or another output.

The errors are those of Core.PSOOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) PSY

func (c *Core) PSY(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

PSY computes the Psychological Line over bars startIdx through endIdx.

Psychological Line (PSY) measures the percentage of bars in a trailing window that closed strictly higher than the previous bar. Bounded in [0, 100], it tracks short-term buying sentiment: readings above 75 are commonly treated as overbought and readings below 25 as oversold.

Formula and more info at https://ta-lib.org/functions/psy.

Inputs, each at least endIdx+1 long:

  • inReal: Source price series.

Parameters:

  • optInTimePeriod: Number of trailing bar-to-bar changes counted. Default 12; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Psychological Line value in [0, 100].

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.PSYLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.PSY(0, len(series)-1, series, 12, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
240 values from bar 12: [0.0000, ..., 8.3333]

func (*Core) PSYDisplayShift

func (c *Core) PSYDisplayShift(optInTimePeriod, outputIdx int) (int, error)

PSYDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.PSY. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.PSY followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.PSYLookback rejects or an index that names no output.

func (*Core) PSYLookback

func (c *Core) PSYLookback(optInTimePeriod int) (int, error)

PSYLookback returns how many leading bars Core.PSY consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.PSY and returns BadParam for one out of range.

func (*Core) PSYOpen

func (c *Core) PSYOpen(inReal []float64, optInTimePeriod int) (*PSYStream, float64, error)

PSYOpen opens a live PSYStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.PSY writes there.

inReal is the history; the parameters are those of Core.PSY.

The error is InsufficientHistory for a history of at most Core.PSYLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) PSYOpenAndFill

func (c *Core) PSYOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*PSYStream, OutRange, error)

PSYOpenAndFill opens a stream as Core.PSYOpen does and also writes the outputs over the whole history, as Core.PSY writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.PSYLookback values and share no memory with an input or another output.

The errors are those of Core.PSYOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) PVI

func (c *Core) PVI(startIdx, endIdx int, inClose, inVolume, outReal []float64) (OutRange, error)

PVI computes the Positive Volume Index over bars startIdx through endIdx.

Positive Volume Index: a running cumulative index that changes only on days when volume rises versus the prior day, compounding that day's percentage price change. The premise is that active, high-volume days reflect the actions of the less-informed "crowd", so PVI is read as a proxy for that cohort's positioning.

Formula and more info at https://ta-lib.org/functions/pvi.

Inputs, each at least endIdx+1 long:

  • inClose: Close price of each bar.
  • inVolume: Volume of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Cumulative positive volume index (seeded at 1000)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.PVILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.PVI(0, len(close)-1, close, volume, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [1000.0000, ..., 1641.5289]

func (*Core) PVIDisplayShift

func (c *Core) PVIDisplayShift(outputIdx int) (int, error)

PVIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.PVI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.PVI, from 0, and returns BadParam for an index that names no output.

func (*Core) PVILookback

func (c *Core) PVILookback() (int, error)

PVILookback returns how many leading bars Core.PVI consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) PVIOpen

func (c *Core) PVIOpen(inClose, inVolume []float64) (*PVIStream, float64, error)

PVIOpen opens a live PVIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.PVI writes there.

inClose and inVolume are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.PVILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) PVIOpenAndFill

func (c *Core) PVIOpenAndFill(inClose, inVolume, outReal []float64) (*PVIStream, OutRange, error)

PVIOpenAndFill opens a stream as Core.PVIOpen does and also writes the outputs over the whole history, as Core.PVI writes them for bars 0 through len(inClose)-1, returning that range.

Each output must hold len(inClose) minus Core.PVILookback values and share no memory with an input or another output.

The errors are those of Core.PVIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) PVO

func (c *Core) PVO(startIdx, endIdx int, inVolume []float64, optInFastPeriod, optInSlowPeriod int, optInMAType MAType, outReal []float64) (OutRange, error)

PVO computes the Percentage Volume Oscillator over bars startIdx through endIdx.

Percentage Volume Oscillator: a variation of the Core.PPO (PPO, created by Gerald Appel) applied to the volume series instead of price. It is the difference between a fast and slow moving average of volume, expressed as a percentage of the slow MA. Positive when short-term volume is above its longer-term average (rising participation), negative when below. The default periods (12, 26) match MACD and PPO.

Formula and more info at https://ta-lib.org/functions/pvo.

Inputs, each at least endIdx+1 long:

  • inVolume: Volume of each bar.

Parameters:

  • optInFastPeriod: Period of the fast MA. Default 12; range 2 to 10000; IntegerDefault selects the default.
  • optInSlowPeriod: Period of the slow MA. Default 26; range 2 to 10000; IntegerDefault selects the default.
  • optInMAType: Moving average type used for both MAs. Default MATypeEMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: PVO value in percent.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.PVOLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.PVO(0, len(volume)-1, volume, 12, 26, talib.MATypeEMA, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
227 values from bar 25: [7.7662, ..., 1.3007]

func (*Core) PVODisplayShift

func (c *Core) PVODisplayShift(optInFastPeriod, optInSlowPeriod int, optInMAType MAType, outputIdx int) (int, error)

PVODisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.PVO. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.PVO followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.PVOLookback rejects or an index that names no output.

func (*Core) PVOLookback

func (c *Core) PVOLookback(optInFastPeriod, optInSlowPeriod int, optInMAType MAType) (int, error)

PVOLookback returns how many leading bars Core.PVO consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.PVO and returns BadParam for one out of range.

func (*Core) PVOOpen

func (c *Core) PVOOpen(inVolume []float64, optInFastPeriod, optInSlowPeriod int, optInMAType MAType) (*PVOStream, float64, error)

PVOOpen opens a live PVOStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.PVO writes there.

inVolume is the history; the parameters are those of Core.PVO.

The error is InsufficientHistory for a history of at most Core.PVOLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) PVOOpenAndFill

func (c *Core) PVOOpenAndFill(inVolume []float64, optInFastPeriod, optInSlowPeriod int, optInMAType MAType, outReal []float64) (*PVOStream, OutRange, error)

PVOOpenAndFill opens a stream as Core.PVOOpen does and also writes the outputs over the whole history, as Core.PVO writes them for bars 0 through len(inVolume)-1, returning that range.

Each output must hold len(inVolume) minus Core.PVOLookback values and share no memory with an input or another output.

The errors are those of Core.PVOOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) PVT

func (c *Core) PVT(startIdx, endIdx int, inClose, inVolume, outReal []float64) (OutRange, error)

PVT computes the Price Volume Trend over bars startIdx through endIdx.

Price Volume Trend: a running cumulative total of each bar's volume weighted by that bar's fractional price change. It is the On Balance Volume idea with partial credit — where OBV adds or subtracts a bar's whole volume on the sign of the move, PVT adds only the fraction of that volume proportional to the size of the move.

Formula and more info at https://ta-lib.org/functions/pvt.

Inputs, each at least endIdx+1 long:

  • inClose: Close price of each bar.
  • inVolume: Volume of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Cumulative price volume trend, seeded at zero.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.PVTLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.PVT(0, len(close)-1, close, volume, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [0.0000, ..., -1111.0302]

func (*Core) PVTDisplayShift

func (c *Core) PVTDisplayShift(outputIdx int) (int, error)

PVTDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.PVT. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.PVT, from 0, and returns BadParam for an index that names no output.

func (*Core) PVTLookback

func (c *Core) PVTLookback() (int, error)

PVTLookback returns how many leading bars Core.PVT consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) PVTOpen

func (c *Core) PVTOpen(inClose, inVolume []float64) (*PVTStream, float64, error)

PVTOpen opens a live PVTStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.PVT writes there.

inClose and inVolume are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.PVTLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) PVTOpenAndFill

func (c *Core) PVTOpenAndFill(inClose, inVolume, outReal []float64) (*PVTStream, OutRange, error)

PVTOpenAndFill opens a stream as Core.PVTOpen does and also writes the outputs over the whole history, as Core.PVT writes them for bars 0 through len(inClose)-1, returning that range.

Each output must hold len(inClose) minus Core.PVTLookback values and share no memory with an input or another output.

The errors are those of Core.PVTOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) QSTICK

func (c *Core) QSTICK(startIdx, endIdx int, inOpen, inClose []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

QSTICK computes the Qstick over bars startIdx through endIdx.

Tushar Chande and Stanley Kroll's Qstick (The New Technical Trader, 1994): a simple moving average of the candle body, close minus open. It measures how bullish or bearish the bodies have been over the window, independently of the wicks — above zero the bodies closed up on balance, below zero they closed down, and the zero-line crossings are the signal.

Formula and more info at https://ta-lib.org/functions/qstick.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Number of bars averaged. Default 10, matching Tulip Indicators and pandas-ta-classic. Other packages differ: TraderEvolution documents 1, and AmiBroker community code commonly uses 8. Default 10; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Average candle body over the window.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.QSTICKLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.QSTICK(0, len(open)-1, open, close, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
243 values from bar 9: [-1.2800, ..., -1.4800]

func (*Core) QSTICKDisplayShift

func (c *Core) QSTICKDisplayShift(optInTimePeriod, outputIdx int) (int, error)

QSTICKDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.QSTICK. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.QSTICK followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.QSTICKLookback rejects or an index that names no output.

func (*Core) QSTICKLookback

func (c *Core) QSTICKLookback(optInTimePeriod int) (int, error)

QSTICKLookback returns how many leading bars Core.QSTICK consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.QSTICK and returns BadParam for one out of range.

func (*Core) QSTICKOpen

func (c *Core) QSTICKOpen(inOpen, inClose []float64, optInTimePeriod int) (*QSTICKStream, float64, error)

QSTICKOpen opens a live QSTICKStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.QSTICK writes there.

inOpen and inClose are the histories, of one length; the parameters are those of Core.QSTICK.

The error is InsufficientHistory for a history of at most Core.QSTICKLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) QSTICKOpenAndFill

func (c *Core) QSTICKOpenAndFill(inOpen, inClose []float64, optInTimePeriod int, outReal []float64) (*QSTICKStream, OutRange, error)

QSTICKOpenAndFill opens a stream as Core.QSTICKOpen does and also writes the outputs over the whole history, as Core.QSTICK writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.QSTICKLookback values and share no memory with an input or another output.

The errors are those of Core.QSTICKOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) RMA

func (c *Core) RMA(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

RMA computes the Wilder's Smoothed Moving Average over bars startIdx through endIdx.

Wilder's smoothed moving average: an exponential average whose smoothing factor is the reciprocal of the period rather than the 2/(n+1) of a classic EMA, seeded with a simple average of the first window. J. Welles Wilder Jr. introduced it in 1978 as the smoothing inside RSI, ATR and the directional-movement family; this exposes it as a moving average in its own right.

Formula and more info at https://ta-lib.org/functions/rma.

Inputs, each at least endIdx+1 long:

  • inReal: Data on which to compute the average.

Parameters:

  • optInTimePeriod: Number of bars in the seed window, and the reciprocal of the smoothing factor. Default 30; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Wilder's smoothed moving average of the input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.RMALookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdRMA (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.RMA(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [95.2583, ..., 98.0766]

func (*Core) RMADisplayShift

func (c *Core) RMADisplayShift(optInTimePeriod, outputIdx int) (int, error)

RMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.RMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.RMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.RMALookback rejects or an index that names no output.

func (*Core) RMALookback

func (c *Core) RMALookback(optInTimePeriod int) (int, error)

RMALookback returns how many leading bars Core.RMA consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdRMA (see Core.SetUnstablePeriod).

It takes the parameters of Core.RMA and returns BadParam for one out of range.

func (*Core) RMAOpen

func (c *Core) RMAOpen(inReal []float64, optInTimePeriod int) (*RMAStream, float64, error)

RMAOpen opens a live RMAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.RMA writes there.

inReal is the history; the parameters are those of Core.RMA.

The error is InsufficientHistory for a history of at most Core.RMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) RMAOpenAndFill

func (c *Core) RMAOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*RMAStream, OutRange, error)

RMAOpenAndFill opens a stream as Core.RMAOpen does and also writes the outputs over the whole history, as Core.RMA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.RMALookback values and share no memory with an input or another output.

The errors are those of Core.RMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ROC

func (c *Core) ROC(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

ROC computes the Rate of change : ((price/prevPrice)-1)*100 over bars startIdx through endIdx.

Rate-of-change momentum oscillator: the percent change of price versus the price optInTimePeriod bars earlier. Centered at zero with positive and negative values. Positive when price rose over the period, negative when it fell; magnitude scales the move.

Formula and more info at https://ta-lib.org/functions/roc.

Inputs, each at least endIdx+1 long:

  • inReal: Input price series.

Parameters:

  • optInTimePeriod: Lookback distance to the prior price. Default 10; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Percent rate of change.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ROCLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ROC(0, len(series)-1, series, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [-13.6364, ..., -12.9570]

func (*Core) ROCDisplayShift

func (c *Core) ROCDisplayShift(optInTimePeriod, outputIdx int) (int, error)

ROCDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ROC. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ROC followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ROCLookback rejects or an index that names no output.

func (*Core) ROCLookback

func (c *Core) ROCLookback(optInTimePeriod int) (int, error)

ROCLookback returns how many leading bars Core.ROC consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ROC and returns BadParam for one out of range.

func (*Core) ROCOpen

func (c *Core) ROCOpen(inReal []float64, optInTimePeriod int) (*ROCStream, float64, error)

ROCOpen opens a live ROCStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ROC writes there.

inReal is the history; the parameters are those of Core.ROC.

The error is InsufficientHistory for a history of at most Core.ROCLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) ROCOpenAndFill

func (c *Core) ROCOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*ROCStream, OutRange, error)

ROCOpenAndFill opens a stream as Core.ROCOpen does and also writes the outputs over the whole history, as Core.ROC writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.ROCLookback values and share no memory with an input or another output.

The errors are those of Core.ROCOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ROCP

func (c *Core) ROCP(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

ROCP computes the Rate of change Percentage: (price-prevPrice)/prevPrice over bars startIdx through endIdx.

Rate of change expressed as a fraction of the price optInTimePeriod bars ago. Normalized and centered at zero (positive or negative). >0 rising vs N bars ago, <0 falling; equals ROC/100.

Formula and more info at https://ta-lib.org/functions/rocp.

Inputs, each at least endIdx+1 long:

  • inReal: Source price series.

Parameters:

  • optInTimePeriod: Lookback distance to the previous price. Default 10; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Fractional rate of change vs the value optInTimePeriod bars earlier.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ROCPLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ROCP(0, len(series)-1, series, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [-0.1364, ..., -0.1296]

func (*Core) ROCPDisplayShift

func (c *Core) ROCPDisplayShift(optInTimePeriod, outputIdx int) (int, error)

ROCPDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ROCP. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ROCP followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ROCPLookback rejects or an index that names no output.

func (*Core) ROCPLookback

func (c *Core) ROCPLookback(optInTimePeriod int) (int, error)

ROCPLookback returns how many leading bars Core.ROCP consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ROCP and returns BadParam for one out of range.

func (*Core) ROCPOpen

func (c *Core) ROCPOpen(inReal []float64, optInTimePeriod int) (*ROCPStream, float64, error)

ROCPOpen opens a live ROCPStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ROCP writes there.

inReal is the history; the parameters are those of Core.ROCP.

The error is InsufficientHistory for a history of at most Core.ROCPLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) ROCPOpenAndFill

func (c *Core) ROCPOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*ROCPStream, OutRange, error)

ROCPOpenAndFill opens a stream as Core.ROCPOpen does and also writes the outputs over the whole history, as Core.ROCP writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.ROCPLookback values and share no memory with an input or another output.

The errors are those of Core.ROCPOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ROCR

func (c *Core) ROCR(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

ROCR computes the Rate of change ratio: (price/prevPrice) over bars startIdx through endIdx.

Rate of Change Ratio: the ratio of the current price to the price optInTimePeriod bars ago. A momentum measure centered at 1. Always positive, centered at 1: >1 rising, <1 falling.

Formula and more info at https://ta-lib.org/functions/rocr.

Inputs, each at least endIdx+1 long:

  • inReal: Price series.

Parameters:

  • optInTimePeriod: Lookback distance in bars for the prior price. Default 10; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Ratio of current price to prior price.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ROCRLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ROCR(0, len(series)-1, series, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [0.8636, ..., 0.8704]

func (*Core) ROCR100

func (c *Core) ROCR100(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

ROCR100 computes the Rate of change ratio 100 scale: (price/prevPrice)*100 over bars startIdx through endIdx.

Rate-of-change ratio scaled by 100: current price as a percentage of the price optInTimePeriod bars ago. Momentum measure centered at 100 and always positive. Above 100 = price rose vs n bars ago; below 100 = price fell.

Formula and more info at https://ta-lib.org/functions/rocr100.

Inputs, each at least endIdx+1 long:

  • inReal: Input price/data series.

Parameters:

  • optInTimePeriod: Lookback distance (bars back) for the reference price. Default 10; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Rate-of-change ratio times 100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ROCR100Lookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ROCR100(0, len(series)-1, series, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
242 values from bar 10: [86.3636, ..., 87.0430]

func (*Core) ROCR100DisplayShift

func (c *Core) ROCR100DisplayShift(optInTimePeriod, outputIdx int) (int, error)

ROCR100DisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ROCR100. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ROCR100 followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ROCR100Lookback rejects or an index that names no output.

func (*Core) ROCR100Lookback

func (c *Core) ROCR100Lookback(optInTimePeriod int) (int, error)

ROCR100Lookback returns how many leading bars Core.ROCR100 consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ROCR100 and returns BadParam for one out of range.

func (*Core) ROCR100Open

func (c *Core) ROCR100Open(inReal []float64, optInTimePeriod int) (*ROCR100Stream, float64, error)

ROCR100Open opens a live ROCR100Stream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ROCR100 writes there.

inReal is the history; the parameters are those of Core.ROCR100.

The error is InsufficientHistory for a history of at most Core.ROCR100Lookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) ROCR100OpenAndFill

func (c *Core) ROCR100OpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*ROCR100Stream, OutRange, error)

ROCR100OpenAndFill opens a stream as Core.ROCR100Open does and also writes the outputs over the whole history, as Core.ROCR100 writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.ROCR100Lookback values and share no memory with an input or another output.

The errors are those of Core.ROCR100Open, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ROCRDisplayShift

func (c *Core) ROCRDisplayShift(optInTimePeriod, outputIdx int) (int, error)

ROCRDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ROCR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ROCR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ROCRLookback rejects or an index that names no output.

func (*Core) ROCRLookback

func (c *Core) ROCRLookback(optInTimePeriod int) (int, error)

ROCRLookback returns how many leading bars Core.ROCR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ROCR and returns BadParam for one out of range.

func (*Core) ROCROpen

func (c *Core) ROCROpen(inReal []float64, optInTimePeriod int) (*ROCRStream, float64, error)

ROCROpen opens a live ROCRStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ROCR writes there.

inReal is the history; the parameters are those of Core.ROCR.

The error is InsufficientHistory for a history of at most Core.ROCRLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) ROCROpenAndFill

func (c *Core) ROCROpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*ROCRStream, OutRange, error)

ROCROpenAndFill opens a stream as Core.ROCROpen does and also writes the outputs over the whole history, as Core.ROCR writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.ROCRLookback values and share no memory with an input or another output.

The errors are those of Core.ROCROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ROGERSSATCHELL

func (c *Core) ROGERSSATCHELL(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, optInTimePeriod int, optInAnnualization float64, outReal []float64) (OutRange, error)

ROGERSSATCHELL computes the Rogers-Satchell Volatility over bars startIdx through endIdx.

Rogers-Satchell volatility: a range-based estimator that reads one bar's open, high, low and close as a single unbiased estimate of that bar's variance, then reports the root of the mean over the last n bars, scaled to periods per year.

Formula and more info at https://ta-lib.org/functions/rogerssatchell.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Number of bars in the window. n = 1 is the paper's own single-bar estimator. Default 10; range 1 to 100000; IntegerDefault selects the default.
  • optInAnnualization: Periods per year. Pass 1 for the per-bar figure. Default 252; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Estimated volatility, in log-return units.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ROGERSSATCHELLLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ROGERSSATCHELL(0, len(open)-1, open, high, low, close, 10, 252, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
243 values from bar 9: [0.5275, ..., 0.6667]

func (*Core) ROGERSSATCHELLDisplayShift

func (c *Core) ROGERSSATCHELLDisplayShift(optInTimePeriod int, optInAnnualization float64, outputIdx int) (int, error)

ROGERSSATCHELLDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ROGERSSATCHELL. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ROGERSSATCHELL followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ROGERSSATCHELLLookback rejects or an index that names no output.

func (*Core) ROGERSSATCHELLLookback

func (c *Core) ROGERSSATCHELLLookback(optInTimePeriod int, optInAnnualization float64) (int, error)

ROGERSSATCHELLLookback returns how many leading bars Core.ROGERSSATCHELL consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ROGERSSATCHELL and returns BadParam for one out of range.

func (*Core) ROGERSSATCHELLOpen

func (c *Core) ROGERSSATCHELLOpen(inOpen, inHigh, inLow, inClose []float64, optInTimePeriod int, optInAnnualization float64) (*ROGERSSATCHELLStream, float64, error)

ROGERSSATCHELLOpen opens a live ROGERSSATCHELLStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ROGERSSATCHELL writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.ROGERSSATCHELL.

The error is InsufficientHistory for a history of at most Core.ROGERSSATCHELLLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ROGERSSATCHELLOpenAndFill

func (c *Core) ROGERSSATCHELLOpenAndFill(inOpen, inHigh, inLow, inClose []float64, optInTimePeriod int, optInAnnualization float64, outReal []float64) (*ROGERSSATCHELLStream, OutRange, error)

ROGERSSATCHELLOpenAndFill opens a stream as Core.ROGERSSATCHELLOpen does and also writes the outputs over the whole history, as Core.ROGERSSATCHELL writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.ROGERSSATCHELLLookback values and share no memory with an input or another output.

The errors are those of Core.ROGERSSATCHELLOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) RSI

func (c *Core) RSI(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

RSI computes the Relative Strength Index over bars startIdx through endIdx.

Wilder's Relative Strength Index, a momentum oscillator bounded 0-100 from the ratio of average gains to average losses over the period. Used to gauge overbought/oversold conditions. >70 overbought, <30 oversold.

Formula and more info at https://ta-lib.org/functions/rsi.

Inputs, each at least endIdx+1 long:

  • inReal: Price series (typically close)

Parameters:

  • optInTimePeriod: Lookback for the gain/loss averaging. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: RSI value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.RSILookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdRSI (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.RSI(0, len(series)-1, series, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
238 values from bar 14: [0.0000, ..., 34.9770]

func (*Core) RSIDisplayShift

func (c *Core) RSIDisplayShift(optInTimePeriod, outputIdx int) (int, error)

RSIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.RSI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.RSI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.RSILookback rejects or an index that names no output.

func (*Core) RSILookback

func (c *Core) RSILookback(optInTimePeriod int) (int, error)

RSILookback returns how many leading bars Core.RSI consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdRSI (see Core.SetUnstablePeriod).

It takes the parameters of Core.RSI and returns BadParam for one out of range.

func (*Core) RSIOpen

func (c *Core) RSIOpen(inReal []float64, optInTimePeriod int) (*RSIStream, float64, error)

RSIOpen opens a live RSIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.RSI writes there.

inReal is the history; the parameters are those of Core.RSI.

The error is InsufficientHistory for a history of at most Core.RSILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) RSIOpenAndFill

func (c *Core) RSIOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*RSIStream, OutRange, error)

RSIOpenAndFill opens a stream as Core.RSIOpen does and also writes the outputs over the whole history, as Core.RSI writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.RSILookback values and share no memory with an input or another output.

The errors are those of Core.RSIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) RVI

func (c *Core) RVI(startIdx, endIdx int, inReal []float64, optInTimePeriod, optInStdDevPeriod int, outReal []float64) (OutRange, error)

RVI computes the Relative Volatility Index over bars startIdx through endIdx.

Relative Volatility Index: Donald Dorsey's volatility oscillator, built exactly like RSI except that the quantity routed to the up and down buckets is the rolling standard deviation of price rather than the size of the move. The direction of the close-to-close change still decides which bucket a bar feeds.

Formula and more info at https://ta-lib.org/functions/rvi.

Inputs, each at least endIdx+1 long:

  • inReal: Source price/value series, canonically the close.

Parameters:

  • optInTimePeriod: Wilder smoothing period applied to both legs. Default 14; range 1 to 100000; IntegerDefault selects the default.
  • optInStdDevPeriod: Number of trailing values the standard deviation spans. Default 10; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Relative Volatility Index value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.RVILookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdRVI (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.RVI(0, len(series)-1, series, 14, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
230 values from bar 22: [5.1115, ..., 28.9200]

func (*Core) RVIDisplayShift

func (c *Core) RVIDisplayShift(optInTimePeriod, optInStdDevPeriod, outputIdx int) (int, error)

RVIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.RVI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.RVI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.RVILookback rejects or an index that names no output.

func (*Core) RVILookback

func (c *Core) RVILookback(optInTimePeriod, optInStdDevPeriod int) (int, error)

RVILookback returns how many leading bars Core.RVI consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdRVI (see Core.SetUnstablePeriod).

It takes the parameters of Core.RVI and returns BadParam for one out of range.

func (*Core) RVIOpen

func (c *Core) RVIOpen(inReal []float64, optInTimePeriod, optInStdDevPeriod int) (*RVIStream, float64, error)

RVIOpen opens a live RVIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.RVI writes there.

inReal is the history; the parameters are those of Core.RVI.

The error is InsufficientHistory for a history of at most Core.RVILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) RVIOpenAndFill

func (c *Core) RVIOpenAndFill(inReal []float64, optInTimePeriod, optInStdDevPeriod int, outReal []float64) (*RVIStream, OutRange, error)

RVIOpenAndFill opens a stream as Core.RVIOpen does and also writes the outputs over the whole history, as Core.RVI writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.RVILookback values and share no memory with an input or another output.

The errors are those of Core.RVIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) RVIR

func (c *Core) RVIR(startIdx, endIdx int, inHigh, inLow []float64, optInTimePeriod, optInStdDevPeriod int, outReal []float64) (OutRange, error)

RVIR computes the Relative Volatility Index, refined high/low form over bars startIdx through endIdx.

Relative Volatility Index, refined form: Donald Dorsey's 1995 revision of his own indicator, which runs the 1993 RVI over the daily highs and again over the daily lows and averages the two indices.

Formula and more info at https://ta-lib.org/functions/rvir.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInTimePeriod: Wilder smoothing period applied to both legs of both indices. Default 14; range 1 to 100000; IntegerDefault selects the default.
  • optInStdDevPeriod: Number of trailing values each standard deviation spans. Default 10; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: The averaged index, in 0..100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.RVIRLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.RVIR(0, len(high)-1, high, low, 14, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
230 values from bar 22: [4.3628, ..., 29.8639]

func (*Core) RVIRDisplayShift

func (c *Core) RVIRDisplayShift(optInTimePeriod, optInStdDevPeriod, outputIdx int) (int, error)

RVIRDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.RVIR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.RVIR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.RVIRLookback rejects or an index that names no output.

func (*Core) RVIRLookback

func (c *Core) RVIRLookback(optInTimePeriod, optInStdDevPeriod int) (int, error)

RVIRLookback returns how many leading bars Core.RVIR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.RVIR and returns BadParam for one out of range.

func (*Core) RVIROpen

func (c *Core) RVIROpen(inHigh, inLow []float64, optInTimePeriod, optInStdDevPeriod int) (*RVIRStream, float64, error)

RVIROpen opens a live RVIRStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.RVIR writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.RVIR.

The error is InsufficientHistory for a history of at most Core.RVIRLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) RVIROpenAndFill

func (c *Core) RVIROpenAndFill(inHigh, inLow []float64, optInTimePeriod, optInStdDevPeriod int, outReal []float64) (*RVIRStream, OutRange, error)

RVIROpenAndFill opens a stream as Core.RVIROpen does and also writes the outputs over the whole history, as Core.RVIR writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.RVIRLookback values and share no memory with an input or another output.

The errors are those of Core.RVIROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) RVOL

func (c *Core) RVOL(startIdx, endIdx int, inVolume []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

RVOL computes the Relative Volume over bars startIdx through endIdx.

Relative Volume: today's volume as a ratio to the average volume of the bars that came before it. A value of 1 means the bar traded exactly its recent average, above 1 means unusual participation, below 1 means the move is thin. Because the current bar is excluded from its own baseline, a volume spike shows up at full size instead of being diluted by the average it is compared against.

Formula and more info at https://ta-lib.org/functions/rvol.

Inputs, each at least endIdx+1 long:

  • inVolume: Volume of each bar.

Parameters:

  • optInTimePeriod: Number of preceding bars averaged to form the baseline. Default 20; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Ratio of the current bar's volume to the average of the preceding window.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.RVOLLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.RVOL(0, len(volume)-1, volume, 20, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
232 values from bar 20: [1.2547, ..., 1.0021]

func (*Core) RVOLDisplayShift

func (c *Core) RVOLDisplayShift(optInTimePeriod, outputIdx int) (int, error)

RVOLDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.RVOL. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.RVOL followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.RVOLLookback rejects or an index that names no output.

func (*Core) RVOLLookback

func (c *Core) RVOLLookback(optInTimePeriod int) (int, error)

RVOLLookback returns how many leading bars Core.RVOL consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.RVOL and returns BadParam for one out of range.

func (*Core) RVOLOpen

func (c *Core) RVOLOpen(inVolume []float64, optInTimePeriod int) (*RVOLStream, float64, error)

RVOLOpen opens a live RVOLStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.RVOL writes there.

inVolume is the history; the parameters are those of Core.RVOL.

The error is InsufficientHistory for a history of at most Core.RVOLLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) RVOLOpenAndFill

func (c *Core) RVOLOpenAndFill(inVolume []float64, optInTimePeriod int, outReal []float64) (*RVOLStream, OutRange, error)

RVOLOpenAndFill opens a stream as Core.RVOLOpen does and also writes the outputs over the whole history, as Core.RVOL writes them for bars 0 through len(inVolume)-1, returning that range.

Each output must hold len(inVolume) minus Core.RVOLLookback values and share no memory with an input or another output.

The errors are those of Core.RVOLOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) RestoreCandleDefault

func (c *Core) RestoreCandleDefault(settingType CandleSettingType) error

RestoreCandleDefault restores one candlestick setting to its default, or every one given CandleSettingTypeAllCandleSettings.

func (*Core) SAR

func (c *Core) SAR(startIdx, endIdx int, inHigh, inLow []float64, optInAcceleration, optInMaximum float64, outReal []float64) (OutRange, error)

SAR computes the Parabolic SAR over bars startIdx through endIdx.

Wilder's Parabolic SAR (Stop And Reverse): a trailing stop/reverse level that accelerates toward price via an acceleration factor. Signals trend direction and trailing exit points. SAR below price = uptrend (long); SAR above price = downtrend (short). Price crossing SAR flips direction.

Formula and more info at https://ta-lib.org/functions/sar.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInAcceleration: Step added to the acceleration factor on each new extreme point. Default 0.02; minimum 0; RealDefault selects the default.
  • optInMaximum: Ceiling on the acceleration factor. Default 0.2; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Parabolic SAR stop/reverse level per bar.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SARLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SAR(0, len(high)-1, high, low, 0.02, 0.2, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
251 values from bar 1: [113.8000, ..., 101.1702]

func (*Core) SARDisplayShift

func (c *Core) SARDisplayShift(optInAcceleration, optInMaximum float64, outputIdx int) (int, error)

SARDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SAR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SAR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SARLookback rejects or an index that names no output.

func (*Core) SAREXT

func (c *Core) SAREXT(startIdx, endIdx int, inHigh, inLow []float64, optInStartValue, optInOffsetOnReverse, optInAccelerationInitLong, optInAccelerationLong, optInAccelerationMaxLong, optInAccelerationInitShort, optInAccelerationShort, optInAccelerationMaxShort float64, outReal []float64) (OutRange, error)

SAREXT computes the Parabolic SAR - Extended over bars startIdx through endIdx.

Extended Parabolic SAR (stop and reverse) giving the caller full control over the initial state and separate acceleration factors for long and short positions. Unlike SAR, it returns negative values while short so reversals are distinguishable. Sign flip of the output marks a trend reversal (positive=long stop, negative=short stop).

Formula and more info at https://ta-lib.org/functions/sarext.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInStartValue: Initial SAR/direction: 0 auto, >0 start long at value, <0 start short at -value. Default 0; RealDefault selects the default.
  • optInOffsetOnReverse: Fractional offset applied to the stop on each reversal. Default 0; minimum 0; RealDefault selects the default.
  • optInAccelerationInitLong: Initial acceleration factor when long. Default 0.02; minimum 0; RealDefault selects the default.
  • optInAccelerationLong: AF increment per new long extreme. Default 0.02; minimum 0; RealDefault selects the default.
  • optInAccelerationMaxLong: Cap on the long acceleration factor. Default 0.2; minimum 0; RealDefault selects the default.
  • optInAccelerationInitShort: Initial acceleration factor when short. Default 0.02; minimum 0; RealDefault selects the default.
  • optInAccelerationShort: AF increment per new short extreme. Default 0.02; minimum 0; RealDefault selects the default.
  • optInAccelerationMaxShort: Cap on the short acceleration factor. Default 0.2; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: SAR stop level; positive while long, negative while short.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SAREXTLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SAREXT(0, len(high)-1, high, low, 0, 0, 0.02, 0.02, 0.2, 0.02, 0.02, 0.2, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
251 values from bar 1: [-113.8000, ..., -101.1702]

func (*Core) SAREXTDisplayShift

func (c *Core) SAREXTDisplayShift(optInStartValue, optInOffsetOnReverse, optInAccelerationInitLong, optInAccelerationLong, optInAccelerationMaxLong, optInAccelerationInitShort, optInAccelerationShort, optInAccelerationMaxShort float64, outputIdx int) (int, error)

SAREXTDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SAREXT. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SAREXT followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SAREXTLookback rejects or an index that names no output.

func (*Core) SAREXTLookback

func (c *Core) SAREXTLookback(optInStartValue, optInOffsetOnReverse, optInAccelerationInitLong, optInAccelerationLong, optInAccelerationMaxLong, optInAccelerationInitShort, optInAccelerationShort, optInAccelerationMaxShort float64) (int, error)

SAREXTLookback returns how many leading bars Core.SAREXT consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.SAREXT and returns BadParam for one out of range.

func (*Core) SAREXTOpen

func (c *Core) SAREXTOpen(inHigh, inLow []float64, optInStartValue, optInOffsetOnReverse, optInAccelerationInitLong, optInAccelerationLong, optInAccelerationMaxLong, optInAccelerationInitShort, optInAccelerationShort, optInAccelerationMaxShort float64) (*SAREXTStream, float64, error)

SAREXTOpen opens a live SAREXTStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SAREXT writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.SAREXT.

The error is InsufficientHistory for a history of at most Core.SAREXTLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) SAREXTOpenAndFill

func (c *Core) SAREXTOpenAndFill(inHigh, inLow []float64, optInStartValue, optInOffsetOnReverse, optInAccelerationInitLong, optInAccelerationLong, optInAccelerationMaxLong, optInAccelerationInitShort, optInAccelerationShort, optInAccelerationMaxShort float64, outReal []float64) (*SAREXTStream, OutRange, error)

SAREXTOpenAndFill opens a stream as Core.SAREXTOpen does and also writes the outputs over the whole history, as Core.SAREXT writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.SAREXTLookback values and share no memory with an input or another output.

The errors are those of Core.SAREXTOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SARLookback

func (c *Core) SARLookback(optInAcceleration, optInMaximum float64) (int, error)

SARLookback returns how many leading bars Core.SAR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.SAR and returns BadParam for one out of range.

func (*Core) SAROpen

func (c *Core) SAROpen(inHigh, inLow []float64, optInAcceleration, optInMaximum float64) (*SARStream, float64, error)

SAROpen opens a live SARStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SAR writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.SAR.

The error is InsufficientHistory for a history of at most Core.SARLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) SAROpenAndFill

func (c *Core) SAROpenAndFill(inHigh, inLow []float64, optInAcceleration, optInMaximum float64, outReal []float64) (*SARStream, OutRange, error)

SAROpenAndFill opens a stream as Core.SAROpen does and also writes the outputs over the whole history, as Core.SAR writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.SARLookback values and share no memory with an input or another output.

The errors are those of Core.SAROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SHARPE

func (c *Core) SHARPE(startIdx, endIdx int, inReal []float64, optInTimePeriod int, optInRiskFreeRate, optInAnnualization float64, outReal []float64) (OutRange, error)

SHARPE computes the Rolling Sharpe Ratio over bars startIdx through endIdx.

The rolling Sharpe ratio: the mean return in excess of a risk-free rate, divided by the standard deviation of that excess return, over a trailing window. A drift-over-volatility measure of the series itself, scaled to a year. Above 0 the window's returns beat the risk-free rate on average; the larger the value, the more return per unit of volatility.

Formula and more info at https://ta-lib.org/functions/sharpe.

Inputs, each at least endIdx+1 long:

  • inReal: The price series; its returns are computed internally.

Parameters:

  • optInTimePeriod: Number of returns in the window; one price more is read. Default 20; range 2 to 100000; IntegerDefault selects the default.
  • optInRiskFreeRate: Risk-free return per bar, subtracted from each return. Default 0; RealDefault selects the default.
  • optInAnnualization: Bars per year; the per-bar ratio is multiplied by its square root. Default 252; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Annualized Sharpe ratio of the trailing window, or ±Inf or NaN where the window has no spread.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SHARPELookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SHARPE(0, len(series)-1, series, 20, 0, 252, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
232 values from bar 20: [-29.1890, ..., -0.9883]

func (*Core) SHARPEDisplayShift

func (c *Core) SHARPEDisplayShift(optInTimePeriod int, optInRiskFreeRate, optInAnnualization float64, outputIdx int) (int, error)

SHARPEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SHARPE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SHARPE followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SHARPELookback rejects or an index that names no output.

func (*Core) SHARPELookback

func (c *Core) SHARPELookback(optInTimePeriod int, optInRiskFreeRate, optInAnnualization float64) (int, error)

SHARPELookback returns how many leading bars Core.SHARPE consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.SHARPE and returns BadParam for one out of range.

func (*Core) SHARPEOpen

func (c *Core) SHARPEOpen(inReal []float64, optInTimePeriod int, optInRiskFreeRate, optInAnnualization float64) (*SHARPEStream, float64, error)

SHARPEOpen opens a live SHARPEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SHARPE writes there.

inReal is the history; the parameters are those of Core.SHARPE.

The error is InsufficientHistory for a history of at most Core.SHARPELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) SHARPEOpenAndFill

func (c *Core) SHARPEOpenAndFill(inReal []float64, optInTimePeriod int, optInRiskFreeRate, optInAnnualization float64, outReal []float64) (*SHARPEStream, OutRange, error)

SHARPEOpenAndFill opens a stream as Core.SHARPEOpen does and also writes the outputs over the whole history, as Core.SHARPE writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SHARPELookback values and share no memory with an input or another output.

The errors are those of Core.SHARPEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SI

func (c *Core) SI(startIdx, endIdx int, inOpen, inHigh, inLow, inClose []float64, optInLimitMove float64, outReal []float64) (OutRange, error)

SI computes the Wilder Swing Index over bars startIdx through endIdx.

Wilder's Swing Index: one number rating each bar against the bar before it, from both bars' open and close and the current bar's high and low, signed by the direction of the swing. A strong close above the prior close on a wide range reads high and positive, a strong down swing reads high and negative. It is scaled against the limit move, the largest one-bar move the market allows, and stays between -100 and +100 while every move is within that limit. J. Welles Wilder Jr. introduced it in 1978 and trades its running total, ASI.

Formula and more info at https://ta-lib.org/functions/si.

Inputs, each at least endIdx+1 long:

  • inOpen: Open price of each bar.
  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInLimitMove: Limit move, the largest one-bar price move the index is scaled against, in price units. Default 3; minimum 0.00000001; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Swing index of the bar against the previous bar.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	open := make([]float64, 252) // your data, oldest first
	for i := range open {
		open[i] = 90 + float64(((i+39)%40-20)*((i+39)%40-20))/20
	}
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SI(0, len(open)-1, open, high, low, close, 3, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
251 values from bar 1: [-50.1824, ..., 6.8089]

func (*Core) SIDisplayShift

func (c *Core) SIDisplayShift(optInLimitMove float64, outputIdx int) (int, error)

SIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SILookback rejects or an index that names no output.

func (*Core) SILookback

func (c *Core) SILookback(optInLimitMove float64) (int, error)

SILookback returns how many leading bars Core.SI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.SI and returns BadParam for one out of range.

func (*Core) SIN

func (c *Core) SIN(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

SIN computes the Vector Trigonometric Sin over bars startIdx through endIdx.

Element-wise sine of the input series.

Formula and more info at https://ta-lib.org/functions/sin.

Inputs, each at least endIdx+1 long:

  • inReal: Input values (radians)

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Sine of each input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SINLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = -6.3 + 12.6*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SIN(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [-0.0168, ..., 0.0168]

func (*Core) SINDisplayShift

func (c *Core) SINDisplayShift(outputIdx int) (int, error)

SINDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SIN. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.SIN, from 0, and returns BadParam for an index that names no output.

func (*Core) SINH

func (c *Core) SINH(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

SINH computes the Vector Trigonometric Sinh over bars startIdx through endIdx.

Element-wise hyperbolic sine of the input series.

Formula and more info at https://ta-lib.org/functions/sinh.

Inputs, each at least endIdx+1 long:

  • inReal: Input series.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Hyperbolic sine of each input value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SINHLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = -5 + 10*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SINH(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [-74.2032, ..., 74.2032]

func (*Core) SINHDisplayShift

func (c *Core) SINHDisplayShift(outputIdx int) (int, error)

SINHDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SINH. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.SINH, from 0, and returns BadParam for an index that names no output.

func (*Core) SINHLookback

func (c *Core) SINHLookback() (int, error)

SINHLookback returns how many leading bars Core.SINH consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) SINHOpen

func (c *Core) SINHOpen(inReal []float64) (*SINHStream, float64, error)

SINHOpen opens a live SINHStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SINH writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.SINHLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) SINHOpenAndFill

func (c *Core) SINHOpenAndFill(inReal, outReal []float64) (*SINHStream, OutRange, error)

SINHOpenAndFill opens a stream as Core.SINHOpen does and also writes the outputs over the whole history, as Core.SINH writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SINHLookback values and share no memory with an input or another output.

The errors are those of Core.SINHOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SINLookback

func (c *Core) SINLookback() (int, error)

SINLookback returns how many leading bars Core.SIN consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) SINOpen

func (c *Core) SINOpen(inReal []float64) (*SINStream, float64, error)

SINOpen opens a live SINStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SIN writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.SINLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) SINOpenAndFill

func (c *Core) SINOpenAndFill(inReal, outReal []float64) (*SINStream, OutRange, error)

SINOpenAndFill opens a stream as Core.SINOpen does and also writes the outputs over the whole history, as Core.SIN writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SINLookback values and share no memory with an input or another output.

The errors are those of Core.SINOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SIOpen

func (c *Core) SIOpen(inOpen, inHigh, inLow, inClose []float64, optInLimitMove float64) (*SIStream, float64, error)

SIOpen opens a live SIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SI writes there.

inOpen, inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.SI.

The error is InsufficientHistory for a history of at most Core.SILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) SIOpenAndFill

func (c *Core) SIOpenAndFill(inOpen, inHigh, inLow, inClose []float64, optInLimitMove float64, outReal []float64) (*SIStream, OutRange, error)

SIOpenAndFill opens a stream as Core.SIOpen does and also writes the outputs over the whole history, as Core.SI writes them for bars 0 through len(inOpen)-1, returning that range.

Each output must hold len(inOpen) minus Core.SILookback values and share no memory with an input or another output.

The errors are those of Core.SIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SKEW

func (c *Core) SKEW(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

SKEW computes the Rolling Skewness over bars startIdx through endIdx.

An estimate, from the trailing window, of the skewness of the distribution its values come from: the third standardised moment. An asymmetry measure: above 0 the distribution has a longer tail above its mean, below 0 a longer tail below it, and a symmetric window reads 0. The companion to Core.KURTOSIS, Core.VAR and Core.STDDEV in the same group.

Formula and more info at https://ta-lib.org/functions/skew.

Inputs, each at least endIdx+1 long:

  • inReal: The series to measure.

Parameters:

  • optInTimePeriod: Number of trailing values in the window. Default 30; range 3 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Skewness of the trailing window, or 0 where the window has no spread.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SKEWLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SKEW(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [1.2121, ..., 0.3185]

func (*Core) SKEWDisplayShift

func (c *Core) SKEWDisplayShift(optInTimePeriod, outputIdx int) (int, error)

SKEWDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SKEW. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SKEW followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SKEWLookback rejects or an index that names no output.

func (*Core) SKEWLookback

func (c *Core) SKEWLookback(optInTimePeriod int) (int, error)

SKEWLookback returns how many leading bars Core.SKEW consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.SKEW and returns BadParam for one out of range.

func (*Core) SKEWOpen

func (c *Core) SKEWOpen(inReal []float64, optInTimePeriod int) (*SKEWStream, float64, error)

SKEWOpen opens a live SKEWStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SKEW writes there.

inReal is the history; the parameters are those of Core.SKEW.

The error is InsufficientHistory for a history of at most Core.SKEWLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) SKEWOpenAndFill

func (c *Core) SKEWOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*SKEWStream, OutRange, error)

SKEWOpenAndFill opens a stream as Core.SKEWOpen does and also writes the outputs over the whole history, as Core.SKEW writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SKEWLookback values and share no memory with an input or another output.

The errors are those of Core.SKEWOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SMA

func (c *Core) SMA(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

SMA computes the Simple Moving Average over bars startIdx through endIdx.

Simple Moving Average: the unweighted arithmetic mean of the last N input values. Used to smooth a series.

Formula and more info at https://ta-lib.org/functions/sma.

Inputs, each at least endIdx+1 long:

  • inReal: Source series to average.

Parameters:

  • optInTimePeriod: Number of bars in the averaging window. Default 30; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Simple moving average of the input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SMALookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SMA(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [95.2583, ..., 98.5583]

func (*Core) SMADisplayShift

func (c *Core) SMADisplayShift(optInTimePeriod, outputIdx int) (int, error)

SMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SMALookback rejects or an index that names no output.

func (*Core) SMALookback

func (c *Core) SMALookback(optInTimePeriod int) (int, error)

SMALookback returns how many leading bars Core.SMA consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.SMA and returns BadParam for one out of range.

func (*Core) SMAOpen

func (c *Core) SMAOpen(inReal []float64, optInTimePeriod int) (*SMAStream, float64, error)

SMAOpen opens a live SMAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SMA writes there.

inReal is the history; the parameters are those of Core.SMA.

The error is InsufficientHistory for a history of at most Core.SMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) SMAOpenAndFill

func (c *Core) SMAOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*SMAStream, OutRange, error)

SMAOpenAndFill opens a stream as Core.SMAOpen does and also writes the outputs over the whole history, as Core.SMA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SMALookback values and share no memory with an input or another output.

The errors are those of Core.SMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SMI

func (c *Core) SMI(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int, outSMI, outSMISignal []float64) (OutRange, error)

SMI computes the Stochastic Momentum Index over bars startIdx through endIdx.

Stochastic Momentum Index: where the close sits relative to the midpoint of the recent high/low range, double-smoothed. Lane's stochastic measures the close against the bottom of the range; Blau measures it against the middle, then smooths numerator and denominator separately with two exponential averages before dividing, which is what buys the low-lag, smooth-contoured curve. The result runs -100 to +100 rather than 0 to 100, so the zero line is the reference: positive means the close is above the midpoint of its range, negative below. Extreme readings mark overbought and oversold conditions, and crossings of the signal line are the usual trade trigger.

Formula and more info at https://ta-lib.org/functions/smi.

Inputs, each at least endIdx+1 long:

  • inHigh: High price series.
  • inLow: Low price series.
  • inClose: Close price series.

Parameters:

  • optInTimePeriod: Period of the high/low range. Default 13; range 2 to 100000; IntegerDefault selects the default.
  • optInFastPeriod: Period of the second smoothing, applied to the first. Default 2; range 2 to 100000; IntegerDefault selects the default.
  • optInSlowPeriod: Period of the first smoothing, applied to the raw momentum. Default 25; range 2 to 100000; IntegerDefault selects the default.
  • optInSignalPeriod: Smoothing period of the signal line. Default 9; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outSMI: Stochastic Momentum Index, -100 to +100.
  • outSMISignal: Exponential average of the SMI line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SMILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	smi := make([]float64, 252)
	smiSignal := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SMI(0, len(high)-1, high, low, close, 13, 2, 25, 9, smi, smiSignal)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("smi = [%.4f, ..., %.4f]\n", smi[0], smi[r.NBElement-1])
	fmt.Printf("smiSignal = [%.4f, ..., %.4f]\n", smiSignal[0], smiSignal[r.NBElement-1])
}
Output:
207 values from bar 45:
smi = [11.1733, ..., -9.8490]
smiSignal = [5.5619, ..., 8.6665]

func (*Core) SMIDisplayShift

func (c *Core) SMIDisplayShift(optInTimePeriod, optInFastPeriod, optInSlowPeriod, optInSignalPeriod, outputIdx int) (int, error)

SMIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SMI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SMI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SMILookback rejects or an index that names no output.

func (*Core) SMILookback

func (c *Core) SMILookback(optInTimePeriod, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int) (int, error)

SMILookback returns how many leading bars Core.SMI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.SMI and returns BadParam for one out of range.

func (*Core) SMIOpen

func (c *Core) SMIOpen(inHigh, inLow, inClose []float64, optInTimePeriod, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int) (*SMIStream, float64, float64, error)

SMIOpen opens a live SMIStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outSMI and outSMISignal), the values Core.SMI writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.SMI.

The error is InsufficientHistory for a history of at most Core.SMILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) SMIOpenAndFill

func (c *Core) SMIOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod, optInFastPeriod, optInSlowPeriod, optInSignalPeriod int, outSMI, outSMISignal []float64) (*SMIStream, OutRange, error)

SMIOpenAndFill opens a stream as Core.SMIOpen does and also writes the outputs over the whole history, as Core.SMI writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.SMILookback values and share no memory with an input or another output.

The errors are those of Core.SMIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SORTINO

func (c *Core) SORTINO(startIdx, endIdx int, inReal []float64, optInTimePeriod int, optInMAR, optInAnnualization float64, outReal []float64) (OutRange, error)

SORTINO computes the Rolling Sortino Ratio over bars startIdx through endIdx.

The rolling Sortino ratio: the mean return in excess of a minimum acceptable return (MAR), divided by the downside deviation, over a trailing window, scaled to a year. It is the Sharpe ratio with upside volatility taken out of the denominator: only returns below the MAR count as risk. Above 0 the window's returns beat the MAR on average; the larger the value, the more return per unit of downside.

Formula and more info at https://ta-lib.org/functions/sortino.

Inputs, each at least endIdx+1 long:

  • inReal: The price series; its returns are computed internally.

Parameters:

  • optInTimePeriod: Number of returns in the window; one price more is read. Default 20; range 2 to 100000; IntegerDefault selects the default.
  • optInMAR: Minimum acceptable return per bar; returns below it are the downside. Default 0; RealDefault selects the default.
  • optInAnnualization: Bars per year; the per-bar ratio is multiplied by its square root. Default 252; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Annualized Sortino ratio of the trailing window, or +Inf or NaN where the window has no return below the MAR.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SORTINOLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SORTINO(0, len(series)-1, series, 20, 0, 252, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
232 values from bar 20: [-14.0258, ..., -1.4064]

func (*Core) SORTINODisplayShift

func (c *Core) SORTINODisplayShift(optInTimePeriod int, optInMAR, optInAnnualization float64, outputIdx int) (int, error)

SORTINODisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SORTINO. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SORTINO followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SORTINOLookback rejects or an index that names no output.

func (*Core) SORTINOLookback

func (c *Core) SORTINOLookback(optInTimePeriod int, optInMAR, optInAnnualization float64) (int, error)

SORTINOLookback returns how many leading bars Core.SORTINO consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.SORTINO and returns BadParam for one out of range.

func (*Core) SORTINOOpen

func (c *Core) SORTINOOpen(inReal []float64, optInTimePeriod int, optInMAR, optInAnnualization float64) (*SORTINOStream, float64, error)

SORTINOOpen opens a live SORTINOStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SORTINO writes there.

inReal is the history; the parameters are those of Core.SORTINO.

The error is InsufficientHistory for a history of at most Core.SORTINOLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) SORTINOOpenAndFill

func (c *Core) SORTINOOpenAndFill(inReal []float64, optInTimePeriod int, optInMAR, optInAnnualization float64, outReal []float64) (*SORTINOStream, OutRange, error)

SORTINOOpenAndFill opens a stream as Core.SORTINOOpen does and also writes the outputs over the whole history, as Core.SORTINO writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SORTINOLookback values and share no memory with an input or another output.

The errors are those of Core.SORTINOOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SQRT

func (c *Core) SQRT(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

SQRT computes the Vector Square Root over bars startIdx through endIdx.

Element-wise square root of the input series.

Formula and more info at https://ta-lib.org/functions/sqrt.

Inputs, each at least endIdx+1 long:

  • inReal: Input values.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Square root of each input value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SQRTLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 100 * float64(i) / 251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SQRT(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [0.0000, ..., 10.0000]

func (*Core) SQRTDisplayShift

func (c *Core) SQRTDisplayShift(outputIdx int) (int, error)

SQRTDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SQRT. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.SQRT, from 0, and returns BadParam for an index that names no output.

func (*Core) SQRTLookback

func (c *Core) SQRTLookback() (int, error)

SQRTLookback returns how many leading bars Core.SQRT consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) SQRTOpen

func (c *Core) SQRTOpen(inReal []float64) (*SQRTStream, float64, error)

SQRTOpen opens a live SQRTStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SQRT writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.SQRTLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) SQRTOpenAndFill

func (c *Core) SQRTOpenAndFill(inReal, outReal []float64) (*SQRTStream, OutRange, error)

SQRTOpenAndFill opens a stream as Core.SQRTOpen does and also writes the outputs over the whole history, as Core.SQRT writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SQRTLookback values and share no memory with an input or another output.

The errors are those of Core.SQRTOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SQZMOM

func (c *Core) SQZMOM(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInBBPeriod int, optInNbDev float64, optInKCPeriod int, optInFactorWide, optInFactorNormal, optInFactorNarrow float64, outMomentum []float64, outSqueeze []int32) (OutRange, error)

SQZMOM computes the Squeeze Momentum and Level over bars startIdx through endIdx.

John Carter's TTM Squeeze, in the form LazyBear published on TradingView in 2014. Volatility compression is read by comparing the Bollinger Bands against a Keltner Channel: when the bands sit inside the channel the market is coiled, and when they push outside it the coil has released. LazyBear replaced Carter's simple momentum with a linear regression of the close against a Donchian/SMA anchor, which is the histogram that StockCharts, ta4j and trading-signals compute, and pandas-ta with lazybear=True.

Formula and more info at https://ta-lib.org/functions/sqzmom.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Closing price of each bar.

Parameters:

  • optInBBPeriod: Number of bars in the Bollinger Band window. Default 20; range 2 to 100000; IntegerDefault selects the default.
  • optInNbDev: Number of standard deviations the Bollinger Bands are placed at. Default 2; minimum 0; RealDefault selects the default.
  • optInKCPeriod: Number of bars in the Keltner Channel, the true-range mean and the regression. Default 20; range 2 to 100000; IntegerDefault selects the default.
  • optInFactorWide: Keltner width, in true-range means, of the widest channel. Default 2; minimum 0; RealDefault selects the default.
  • optInFactorNormal: Keltner width of the classic channel. Default 1.5; minimum 0; RealDefault selects the default.
  • optInFactorNarrow: Keltner width of the tightest channel. Default 1; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outMomentum: Linear regression of the close against the Donchian/SMA anchor.
  • outSqueeze: Compression level: 3 narrow, 2 normal, 1 wide, -1 released, 0 otherwise.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SQZMOMLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	momentum := make([]float64, 252)
	squeeze := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.SQZMOM(0, len(high)-1, high, low, close, 20, 2, 20, 2, 1.5, 1, momentum, squeeze)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("momentum = [%.4f, ..., %.4f]\n", momentum[0], momentum[r.NBElement-1])
	fmt.Printf("squeeze = [%d, ..., %d]\n", squeeze[0], squeeze[r.NBElement-1])
}
Output:
214 values from bar 38:
momentum = [10.2949, ..., -4.9330]
squeeze = [-1, ..., 1]

func (*Core) SQZMOMDisplayShift

func (c *Core) SQZMOMDisplayShift(optInBBPeriod int, optInNbDev float64, optInKCPeriod int, optInFactorWide, optInFactorNormal, optInFactorNarrow float64, outputIdx int) (int, error)

SQZMOMDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SQZMOM. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SQZMOM followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SQZMOMLookback rejects or an index that names no output.

func (*Core) SQZMOMLookback

func (c *Core) SQZMOMLookback(optInBBPeriod int, optInNbDev float64, optInKCPeriod int, optInFactorWide, optInFactorNormal, optInFactorNarrow float64) (int, error)

SQZMOMLookback returns how many leading bars Core.SQZMOM consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.SQZMOM and returns BadParam for one out of range.

func (*Core) SQZMOMOpen

func (c *Core) SQZMOMOpen(inHigh, inLow, inClose []float64, optInBBPeriod int, optInNbDev float64, optInKCPeriod int, optInFactorWide, optInFactorNormal, optInFactorNarrow float64) (*SQZMOMStream, float64, int32, error)

SQZMOMOpen opens a live SQZMOMStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outMomentum and outSqueeze), the values Core.SQZMOM writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.SQZMOM.

The error is InsufficientHistory for a history of at most Core.SQZMOMLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) SQZMOMOpenAndFill

func (c *Core) SQZMOMOpenAndFill(inHigh, inLow, inClose []float64, optInBBPeriod int, optInNbDev float64, optInKCPeriod int, optInFactorWide, optInFactorNormal, optInFactorNarrow float64, outMomentum []float64, outSqueeze []int32) (*SQZMOMStream, OutRange, error)

SQZMOMOpenAndFill opens a stream as Core.SQZMOMOpen does and also writes the outputs over the whole history, as Core.SQZMOM writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.SQZMOMLookback values and share no memory with an input or another output.

The errors are those of Core.SQZMOMOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SSF

func (c *Core) SSF(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

SSF computes the Ehlers SuperSmoother Filter over bars startIdx through endIdx.

John Ehlers' SuperSmoother: a two-pole low-pass smoother with a zero at Nyquist, which he recommends for use instead of an EMA and builds most of his later indicators on. Read it as a smoothed price line with less lag than an EMA of comparable smoothness.

Formula and more info at https://ta-lib.org/functions/ssf.

Inputs, each at least endIdx+1 long:

  • inReal: The series to smooth; Ehlers' examples use the close.

Parameters:

  • optInTimePeriod: Critical period: the wavelength that divides the pass band and the reject band. Default 10; range 1 to 10000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: The smoothed line, on the same scale as the input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SSFLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdSSF (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SSF(0, len(series)-1, series, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
243 values from bar 9: [98.3806, ..., 95.8430]

func (*Core) SSFDisplayShift

func (c *Core) SSFDisplayShift(optInTimePeriod, outputIdx int) (int, error)

SSFDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SSF. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SSF followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SSFLookback rejects or an index that names no output.

func (*Core) SSFLookback

func (c *Core) SSFLookback(optInTimePeriod int) (int, error)

SSFLookback returns how many leading bars Core.SSF consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdSSF (see Core.SetUnstablePeriod).

It takes the parameters of Core.SSF and returns BadParam for one out of range.

func (*Core) SSFOpen

func (c *Core) SSFOpen(inReal []float64, optInTimePeriod int) (*SSFStream, float64, error)

SSFOpen opens a live SSFStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SSF writes there.

inReal is the history; the parameters are those of Core.SSF.

The error is InsufficientHistory for a history of at most Core.SSFLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) SSFOpenAndFill

func (c *Core) SSFOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*SSFStream, OutRange, error)

SSFOpenAndFill opens a stream as Core.SSFOpen does and also writes the outputs over the whole history, as Core.SSF writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SSFLookback values and share no memory with an input or another output.

The errors are those of Core.SSFOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) STC

func (c *Core) STC(startIdx, endIdx int, inReal []float64, optInFastPeriod, optInSlowPeriod, optInCyclePeriod int, outReal []float64) (OutRange, error)

STC computes the Schaff Trend Cycle over bars startIdx through endIdx.

Schaff Trend Cycle (Doug Schaff): a MACD line passed twice through a stochastic, each pass smoothed by half. Bounded 0 to 100, read against 25 and 75: turning up from below 25 is bullish, turning down from above 75 bearish.

Formula and more info at https://ta-lib.org/functions/stc.

Inputs, each at least endIdx+1 long:

  • inReal: Input series (typically close)

Parameters:

  • optInFastPeriod: Period of the fast EMA. Default 23; range 2 to 100000; IntegerDefault selects the default.
  • optInSlowPeriod: Period of the slow EMA. Default 50; range 2 to 100000; IntegerDefault selects the default.
  • optInCyclePeriod: Window of both stochastic stages. Default 10; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Schaff Trend Cycle, from 0 to 100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.STCLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdSTC (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.STC(0, len(series)-1, series, 23, 50, 10, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
185 values from bar 67: [100.0000, ..., 0.7354]

func (*Core) STCDisplayShift

func (c *Core) STCDisplayShift(optInFastPeriod, optInSlowPeriod, optInCyclePeriod, outputIdx int) (int, error)

STCDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.STC. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.STC followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.STCLookback rejects or an index that names no output.

func (*Core) STCLookback

func (c *Core) STCLookback(optInFastPeriod, optInSlowPeriod, optInCyclePeriod int) (int, error)

STCLookback returns how many leading bars Core.STC consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdSTC (see Core.SetUnstablePeriod).

It takes the parameters of Core.STC and returns BadParam for one out of range.

func (*Core) STCOpen

func (c *Core) STCOpen(inReal []float64, optInFastPeriod, optInSlowPeriod, optInCyclePeriod int) (*STCStream, float64, error)

STCOpen opens a live STCStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.STC writes there.

inReal is the history; the parameters are those of Core.STC.

The error is InsufficientHistory for a history of at most Core.STCLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) STCOpenAndFill

func (c *Core) STCOpenAndFill(inReal []float64, optInFastPeriod, optInSlowPeriod, optInCyclePeriod int, outReal []float64) (*STCStream, OutRange, error)

STCOpenAndFill opens a stream as Core.STCOpen does and also writes the outputs over the whole history, as Core.STC writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.STCLookback values and share no memory with an input or another output.

The errors are those of Core.STCOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) STDDEV

func (c *Core) STDDEV(startIdx, endIdx int, inReal []float64, optInTimePeriod int, optInNbDev float64, outReal []float64) (OutRange, error)

STDDEV computes the Standard Deviation over bars startIdx through endIdx.

Rolling standard deviation of a series over a window, scaled by a deviations multiplier. Delegates to VAR, then takes the square root.

Formula and more info at https://ta-lib.org/functions/stddev.

Inputs, each at least endIdx+1 long:

  • inReal: Series to measure dispersion of.

Parameters:

  • optInTimePeriod: Window length. Default 5; range 2 to 100000; IntegerDefault selects the default.
  • optInNbDev: Multiplier applied to the standard deviation. Default 1; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Standard deviation at each bar, scaled by optInNbDev.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.STDDEVLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.STDDEV(0, len(series)-1, series, 5, 1, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
248 values from bar 4: [2.5470, ..., 1.5579]

func (*Core) STDDEVDisplayShift

func (c *Core) STDDEVDisplayShift(optInTimePeriod int, optInNbDev float64, outputIdx int) (int, error)

STDDEVDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.STDDEV. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.STDDEV followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.STDDEVLookback rejects or an index that names no output.

func (*Core) STDDEVLookback

func (c *Core) STDDEVLookback(optInTimePeriod int, optInNbDev float64) (int, error)

STDDEVLookback returns how many leading bars Core.STDDEV consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.STDDEV and returns BadParam for one out of range.

func (*Core) STDDEVOpen

func (c *Core) STDDEVOpen(inReal []float64, optInTimePeriod int, optInNbDev float64) (*STDDEVStream, float64, error)

STDDEVOpen opens a live STDDEVStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.STDDEV writes there.

inReal is the history; the parameters are those of Core.STDDEV.

The error is InsufficientHistory for a history of at most Core.STDDEVLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) STDDEVOpenAndFill

func (c *Core) STDDEVOpenAndFill(inReal []float64, optInTimePeriod int, optInNbDev float64, outReal []float64) (*STDDEVStream, OutRange, error)

STDDEVOpenAndFill opens a stream as Core.STDDEVOpen does and also writes the outputs over the whole history, as Core.STDDEV writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.STDDEVLookback values and share no memory with an input or another output.

The errors are those of Core.STDDEVOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) STOCH

func (c *Core) STOCH(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInFastK_Period, optInSlowK_Period int, optInSlowK_MAType MAType, optInSlowD_Period int, optInSlowD_MAType MAType, outSlowK, outSlowD []float64) (OutRange, error)

STOCH computes the Stochastic over bars startIdx through endIdx.

Slow Stochastic oscillator: locates the close within the high-low range over a lookback period, then double-smooths it. Returns the Slow-%K and Slow-%D lines. SlowK/SlowD > 80 overbought, < 20 oversold; %K crossing %D signals momentum shifts.

Formula and more info at https://ta-lib.org/functions/stoch.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInFastK_Period: Lookback window for the raw %K high-low range. Default 5; range 1 to 100000; IntegerDefault selects the default.
  • optInSlowK_Period: Smoothing period turning FastK into SlowK. Default 3; range 1 to 10000; IntegerDefault selects the default.
  • optInSlowK_MAType: MA type used to smooth into SlowK. Default MATypeSMA; MATypeDEFAULT selects the default.
  • optInSlowD_Period: Smoothing period for the SlowD signal line. Default 3; range 1 to 10000; IntegerDefault selects the default.
  • optInSlowD_MAType: MA type used for the SlowD line. Default MATypeSMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outSlowK: Raw FastK smoothed by SlowK_Period MA.
  • outSlowD: Signal line: SlowK smoothed by SlowD_Period MA.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.STOCHLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	slowK := make([]float64, 252)
	slowD := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.STOCH(0, len(high)-1, high, low, close, 5, 3, talib.MATypeSMA, 3, talib.MATypeSMA,
		slowK, slowD)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("slowK = [%.4f, ..., %.4f]\n", slowK[0], slowK[r.NBElement-1])
	fmt.Printf("slowD = [%.4f, ..., %.4f]\n", slowD[0], slowD[r.NBElement-1])
}
Output:
244 values from bar 8:
slowK = [23.3810, ..., 26.0994]
slowD = [14.2544, ..., 20.8394]

func (*Core) STOCHDisplayShift

func (c *Core) STOCHDisplayShift(optInFastK_Period, optInSlowK_Period int, optInSlowK_MAType MAType, optInSlowD_Period int, optInSlowD_MAType MAType, outputIdx int) (int, error)

STOCHDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.STOCH. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.STOCH followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.STOCHLookback rejects or an index that names no output.

func (*Core) STOCHF

func (c *Core) STOCHF(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInFastK_Period, optInFastD_Period int, optInFastD_MAType MAType, outFastK, outFastD []float64) (OutRange, error)

STOCHF computes the Stochastic Fast over bars startIdx through endIdx.

Fast Stochastic Oscillator: the raw %K line and its moving-average-smoothed %D line. Unlike STOCH (which slows both lines), STOCHF returns the unsmoothed FastK and FastD. Oscillates 0-100; >80 overbought, <20 oversold.

Formula and more info at https://ta-lib.org/functions/stochf.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInFastK_Period: Lookback window for the highest-high/lowest-low of Fast-K. Default 5; range 1 to 100000; IntegerDefault selects the default.
  • optInFastD_Period: Smoothing period for the Fast-D line. Default 3; range 1 to 10000; IntegerDefault selects the default.
  • optInFastD_MAType: Moving-average type used to smooth Fast-D. Default MATypeSMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outFastK: Raw %K stochastic line.
  • outFastD: MA-smoothed %K (signal line)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.STOCHFLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	fastK := make([]float64, 252)
	fastD := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.STOCHF(0, len(high)-1, high, low, close, 5, 3, talib.MATypeSMA, fastK, fastD)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("fastK = [%.4f, ..., %.4f]\n", fastK[0], fastK[r.NBElement-1])
	fmt.Printf("fastD = [%.4f, ..., %.4f]\n", fastD[0], fastD[r.NBElement-1])
}
Output:
246 values from bar 6:
fastK = [10.7143, ..., 36.5385]
fastD = [6.8772, ..., 26.0994]

func (*Core) STOCHFDisplayShift

func (c *Core) STOCHFDisplayShift(optInFastK_Period, optInFastD_Period int, optInFastD_MAType MAType, outputIdx int) (int, error)

STOCHFDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.STOCHF. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.STOCHF followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.STOCHFLookback rejects or an index that names no output.

func (*Core) STOCHFLookback

func (c *Core) STOCHFLookback(optInFastK_Period, optInFastD_Period int, optInFastD_MAType MAType) (int, error)

STOCHFLookback returns how many leading bars Core.STOCHF consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.STOCHF and returns BadParam for one out of range.

func (*Core) STOCHFOpen

func (c *Core) STOCHFOpen(inHigh, inLow, inClose []float64, optInFastK_Period, optInFastD_Period int, optInFastD_MAType MAType) (*STOCHFStream, float64, float64, error)

STOCHFOpen opens a live STOCHFStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outFastK and outFastD), the values Core.STOCHF writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.STOCHF.

The error is InsufficientHistory for a history of at most Core.STOCHFLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) STOCHFOpenAndFill

func (c *Core) STOCHFOpenAndFill(inHigh, inLow, inClose []float64, optInFastK_Period, optInFastD_Period int, optInFastD_MAType MAType, outFastK, outFastD []float64) (*STOCHFStream, OutRange, error)

STOCHFOpenAndFill opens a stream as Core.STOCHFOpen does and also writes the outputs over the whole history, as Core.STOCHF writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.STOCHFLookback values and share no memory with an input or another output.

The errors are those of Core.STOCHFOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) STOCHLookback

func (c *Core) STOCHLookback(optInFastK_Period, optInSlowK_Period int, optInSlowK_MAType MAType, optInSlowD_Period int, optInSlowD_MAType MAType) (int, error)

STOCHLookback returns how many leading bars Core.STOCH consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.STOCH and returns BadParam for one out of range.

func (*Core) STOCHOpen

func (c *Core) STOCHOpen(inHigh, inLow, inClose []float64, optInFastK_Period, optInSlowK_Period int, optInSlowK_MAType MAType, optInSlowD_Period int, optInSlowD_MAType MAType) (*STOCHStream, float64, float64, error)

STOCHOpen opens a live STOCHStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outSlowK and outSlowD), the values Core.STOCH writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.STOCH.

The error is InsufficientHistory for a history of at most Core.STOCHLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) STOCHOpenAndFill

func (c *Core) STOCHOpenAndFill(inHigh, inLow, inClose []float64, optInFastK_Period, optInSlowK_Period int, optInSlowK_MAType MAType, optInSlowD_Period int, optInSlowD_MAType MAType, outSlowK, outSlowD []float64) (*STOCHStream, OutRange, error)

STOCHOpenAndFill opens a stream as Core.STOCHOpen does and also writes the outputs over the whole history, as Core.STOCH writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.STOCHLookback values and share no memory with an input or another output.

The errors are those of Core.STOCHOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) STOCHRSI

func (c *Core) STOCHRSI(startIdx, endIdx int, inReal []float64, optInTimePeriod, optInFastK_Period, optInFastD_Period int, optInFastD_MAType MAType, outFastK, outFastD []float64) (OutRange, error)

STOCHRSI computes the Stochastic Relative Strength Index over bars startIdx through endIdx.

Applies the Fast Stochastic (STOCHF) oscillator to an RSI series instead of price, measuring where RSI sits within its recent min/max range. Oscillates 0-100; high = RSI near its recent top, low = near its recent bottom.

Formula and more info at https://ta-lib.org/functions/stochrsi.

Inputs, each at least endIdx+1 long:

  • inReal: Source series fed into the RSI calculation.

Parameters:

  • optInTimePeriod: RSI period. Default 14; range 2 to 100000; IntegerDefault selects the default.
  • optInFastK_Period: Lookback window for the RSI min/max stochastic. Default 5; range 1 to 100000; IntegerDefault selects the default.
  • optInFastD_Period: Smoothing period for %D. Default 3; range 1 to 10000; IntegerDefault selects the default.
  • optInFastD_MAType: MA type used to smooth %D. Default MATypeSMA; MATypeDEFAULT selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outFastK: Unsmoothed stochastic of the RSI (raw %K)
  • outFastD: %K smoothed over FastD_Period (signal line)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.STOCHRSILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	fastK := make([]float64, 252)
	fastD := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.STOCHRSI(0, len(series)-1, series, 14, 5, 3, talib.MATypeSMA, fastK, fastD)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("fastK = [%.4f, ..., %.4f]\n", fastK[0], fastK[r.NBElement-1])
	fmt.Printf("fastD = [%.4f, ..., %.4f]\n", fastD[0], fastD[r.NBElement-1])
}
Output:
232 values from bar 20:
fastK = [0.0000, ..., 0.0000]
fastD = [0.0000, ..., 0.0000]

func (*Core) STOCHRSIDisplayShift

func (c *Core) STOCHRSIDisplayShift(optInTimePeriod, optInFastK_Period, optInFastD_Period int, optInFastD_MAType MAType, outputIdx int) (int, error)

STOCHRSIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.STOCHRSI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.STOCHRSI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.STOCHRSILookback rejects or an index that names no output.

func (*Core) STOCHRSILookback

func (c *Core) STOCHRSILookback(optInTimePeriod, optInFastK_Period, optInFastD_Period int, optInFastD_MAType MAType) (int, error)

STOCHRSILookback returns how many leading bars Core.STOCHRSI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.STOCHRSI and returns BadParam for one out of range.

func (*Core) STOCHRSIOpen

func (c *Core) STOCHRSIOpen(inReal []float64, optInTimePeriod, optInFastK_Period, optInFastD_Period int, optInFastD_MAType MAType) (*STOCHRSIStream, float64, float64, error)

STOCHRSIOpen opens a live STOCHRSIStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outFastK and outFastD), the values Core.STOCHRSI writes there.

inReal is the history; the parameters are those of Core.STOCHRSI.

The error is InsufficientHistory for a history of at most Core.STOCHRSILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) STOCHRSIOpenAndFill

func (c *Core) STOCHRSIOpenAndFill(inReal []float64, optInTimePeriod, optInFastK_Period, optInFastD_Period int, optInFastD_MAType MAType, outFastK, outFastD []float64) (*STOCHRSIStream, OutRange, error)

STOCHRSIOpenAndFill opens a stream as Core.STOCHRSIOpen does and also writes the outputs over the whole history, as Core.STOCHRSI writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.STOCHRSILookback values and share no memory with an input or another output.

The errors are those of Core.STOCHRSIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SUB

func (c *Core) SUB(startIdx, endIdx int, inReal0, inReal1, outReal []float64) (OutRange, error)

SUB computes the Vector Arithmetic Subtraction over bars startIdx through endIdx.

Element-wise subtraction of two input series.

Formula and more info at https://ta-lib.org/functions/sub.

Inputs, each at least endIdx+1 long:

  • inReal0: Minuend series.
  • inReal1: Subtrahend series.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Per-element difference inReal0 - inReal1.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SUBLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series0 := make([]float64, 252) // your data, oldest first
	for i := range series0 {
		series0[i] = float64(10*(i%40-20)*(i%40-20)-2000) / 201
	}
	series1 := make([]float64, 252) // your data, oldest first
	for i := range series1 {
		series1[i] = -5 + 10*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SUB(0, len(series0)-1, series0, series1, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [14.9502, ..., -10.9204]

func (*Core) SUBDisplayShift

func (c *Core) SUBDisplayShift(outputIdx int) (int, error)

SUBDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SUB. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.SUB, from 0, and returns BadParam for an index that names no output.

func (*Core) SUBLookback

func (c *Core) SUBLookback() (int, error)

SUBLookback returns how many leading bars Core.SUB consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) SUBOpen

func (c *Core) SUBOpen(inReal0, inReal1 []float64) (*SUBStream, float64, error)

SUBOpen opens a live SUBStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SUB writes there.

inReal0 and inReal1 are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.SUBLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) SUBOpenAndFill

func (c *Core) SUBOpenAndFill(inReal0, inReal1, outReal []float64) (*SUBStream, OutRange, error)

SUBOpenAndFill opens a stream as Core.SUBOpen does and also writes the outputs over the whole history, as Core.SUB writes them for bars 0 through len(inReal0)-1, returning that range.

Each output must hold len(inReal0) minus Core.SUBLookback values and share no memory with an input or another output.

The errors are those of Core.SUBOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SUM

func (c *Core) SUM(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

SUM computes the Summation over bars startIdx through endIdx.

Rolling sum of the input over a fixed period. Each output is the sum of the most recent optInTimePeriod input values.

Formula and more info at https://ta-lib.org/functions/sum.

Inputs, each at least endIdx+1 long:

  • inReal: Values to sum.

Parameters:

  • optInTimePeriod: Window length summed. Default 30; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Windowed sum over the period.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SUMLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.SUM(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [2857.7500, ..., 2956.7500]

func (*Core) SUMDisplayShift

func (c *Core) SUMDisplayShift(optInTimePeriod, outputIdx int) (int, error)

SUMDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SUM. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SUM followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SUMLookback rejects or an index that names no output.

func (*Core) SUMLookback

func (c *Core) SUMLookback(optInTimePeriod int) (int, error)

SUMLookback returns how many leading bars Core.SUM consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.SUM and returns BadParam for one out of range.

func (*Core) SUMOpen

func (c *Core) SUMOpen(inReal []float64, optInTimePeriod int) (*SUMStream, float64, error)

SUMOpen opens a live SUMStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SUM writes there.

inReal is the history; the parameters are those of Core.SUM.

The error is InsufficientHistory for a history of at most Core.SUMLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) SUMOpenAndFill

func (c *Core) SUMOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*SUMStream, OutRange, error)

SUMOpenAndFill opens a stream as Core.SUMOpen does and also writes the outputs over the whole history, as Core.SUM writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SUMLookback values and share no memory with an input or another output.

The errors are those of Core.SUMOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SUPERTREND

func (c *Core) SUPERTREND(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, optInMultiplier float64, outSupertrend []float64, outTrend []int32) (OutRange, error)

SUPERTREND computes the SuperTrend over bars startIdx through endIdx.

An ATR-scaled trailing band that follows price on one side at a time and flips to the other side when the close breaks through it. The trend rides the lower band while it is up and the upper band while it is down, so the line is usually below price in an uptrend and above it in a downtrend, and the flip is the signal. Attributed to Olivier Seban.

Formula and more info at https://ta-lib.org/functions/supertrend.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Smoothing period of the Average True Range. Default 10; range 2 to 100000; IntegerDefault selects the default.
  • optInMultiplier: Multiplier applied to the Average True Range to set the band width. Default 3; minimum 0; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outSupertrend: The SuperTrend line: the band the trend is currently riding.
  • outTrend: Trend direction: +1 while the trend rides the lower band, -1 while it rides the upper one.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SUPERTRENDLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	supertrend := make([]float64, 252)
	trend := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.SUPERTREND(0, len(high)-1, high, low, close, 10, 3, supertrend, trend)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("supertrend = [%.4f, ..., %.4f]\n", supertrend[0], supertrend[r.NBElement-1])
	fmt.Printf("trend = [%d, ..., %d]\n", trend[0], trend[r.NBElement-1])
}
Output:
242 values from bar 10:
supertrend = [80.2700, ..., 93.1916]
trend = [1, ..., 1]

func (*Core) SUPERTRENDDisplayShift

func (c *Core) SUPERTRENDDisplayShift(optInTimePeriod int, optInMultiplier float64, outputIdx int) (int, error)

SUPERTRENDDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SUPERTREND. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SUPERTREND followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SUPERTRENDLookback rejects or an index that names no output.

func (*Core) SUPERTRENDLookback

func (c *Core) SUPERTRENDLookback(optInTimePeriod int, optInMultiplier float64) (int, error)

SUPERTRENDLookback returns how many leading bars Core.SUPERTREND consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.SUPERTREND and returns BadParam for one out of range.

func (*Core) SUPERTRENDOpen

func (c *Core) SUPERTRENDOpen(inHigh, inLow, inClose []float64, optInTimePeriod int, optInMultiplier float64) (*SUPERTRENDStream, float64, int32, error)

SUPERTRENDOpen opens a live SUPERTRENDStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outSupertrend and outTrend), the values Core.SUPERTREND writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.SUPERTREND.

The error is InsufficientHistory for a history of at most Core.SUPERTRENDLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) SUPERTRENDOpenAndFill

func (c *Core) SUPERTRENDOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, optInMultiplier float64, outSupertrend []float64, outTrend []int32) (*SUPERTRENDStream, OutRange, error)

SUPERTRENDOpenAndFill opens a stream as Core.SUPERTRENDOpen does and also writes the outputs over the whole history, as Core.SUPERTREND writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.SUPERTRENDLookback values and share no memory with an input or another output.

The errors are those of Core.SUPERTRENDOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SWAK_2PHP

func (c *Core) SWAK_2PHP(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

SWAK_2PHP computes the Swiss Army Knife - Two-Pole High-Pass Filter over bars startIdx through endIdx.

The two-pole high-pass row of John Ehlers' Swiss Army Knife filter: the same double real pole the Gaussian and Butterworth rows use, with a detrending numerator instead of a smoothing one. It removes what is slower than the cutoff period and rolls off twice as steeply as the one-pole row.

Formula and more info at https://ta-lib.org/functions/swak_2php.

Inputs, each at least endIdx+1 long:

  • inReal: The series to detrend; Ehlers' default is the bar midpoint (H+L)/2, which the caller passes as Core.MEDPRICE output.

Parameters:

  • optInTimePeriod: Cutoff period; cycles longer than it are removed, cycles shorter pass. Default 20; range 2 to 10000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: The detrended line, centred on zero.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SWAK_2PHPLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdSWAK_2PHP (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SWAK_2PHPDisplayShift

func (c *Core) SWAK_2PHPDisplayShift(optInTimePeriod, outputIdx int) (int, error)

SWAK_2PHPDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SWAK_2PHP. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SWAK_2PHP followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SWAK_2PHPLookback rejects or an index that names no output.

func (*Core) SWAK_2PHPLookback

func (c *Core) SWAK_2PHPLookback(optInTimePeriod int) (int, error)

SWAK_2PHPLookback returns how many leading bars Core.SWAK_2PHP consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdSWAK_2PHP (see Core.SetUnstablePeriod).

It takes the parameters of Core.SWAK_2PHP and returns BadParam for one out of range.

func (*Core) SWAK_2PHPOpen

func (c *Core) SWAK_2PHPOpen(inReal []float64, optInTimePeriod int) (*SWAK_2PHPStream, float64, error)

SWAK_2PHPOpen opens a live SWAK_2PHPStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SWAK_2PHP writes there.

inReal is the history; the parameters are those of Core.SWAK_2PHP.

The error is InsufficientHistory for a history of at most Core.SWAK_2PHPLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) SWAK_2PHPOpenAndFill

func (c *Core) SWAK_2PHPOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*SWAK_2PHPStream, OutRange, error)

SWAK_2PHPOpenAndFill opens a stream as Core.SWAK_2PHPOpen does and also writes the outputs over the whole history, as Core.SWAK_2PHP writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SWAK_2PHPLookback values and share no memory with an input or another output.

The errors are those of Core.SWAK_2PHPOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SWAK_BP

func (c *Core) SWAK_BP(startIdx, endIdx int, inReal []float64, optInTimePeriod int, optInDelta float64, outReal []float64) (OutRange, error)

SWAK_BP computes the Swiss Army Knife - Band-Pass Filter over bars startIdx through endIdx.

The band-pass row of John Ehlers' Swiss Army Knife filter: a cycle extractor that keeps a band of periods around a chosen centre and removes everything on both sides of it.

Formula and more info at https://ta-lib.org/functions/swak_bp.

Inputs, each at least endIdx+1 long:

  • inReal: The series to filter; Ehlers' default is the bar midpoint (H+L)/2, which the caller passes as Core.MEDPRICE output.

Parameters:

  • optInTimePeriod: Centre period of the band; the filter passes this one untouched. Default 20; range 5 to 2000; IntegerDefault selects the default.
  • optInDelta: Half-bandwidth as a fraction of the centre period; smaller is a narrower band and a longer settling transient. Default 0.1; range 0.05 to 0.5; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: The extracted cycle, centred on zero.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SWAK_BPLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdSWAK_BP (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SWAK_BPDisplayShift

func (c *Core) SWAK_BPDisplayShift(optInTimePeriod int, optInDelta float64, outputIdx int) (int, error)

SWAK_BPDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SWAK_BP. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SWAK_BP followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SWAK_BPLookback rejects or an index that names no output.

func (*Core) SWAK_BPLookback

func (c *Core) SWAK_BPLookback(optInTimePeriod int, optInDelta float64) (int, error)

SWAK_BPLookback returns how many leading bars Core.SWAK_BP consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdSWAK_BP (see Core.SetUnstablePeriod).

It takes the parameters of Core.SWAK_BP and returns BadParam for one out of range.

func (*Core) SWAK_BPOpen

func (c *Core) SWAK_BPOpen(inReal []float64, optInTimePeriod int, optInDelta float64) (*SWAK_BPStream, float64, error)

SWAK_BPOpen opens a live SWAK_BPStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SWAK_BP writes there.

inReal is the history; the parameters are those of Core.SWAK_BP.

The error is InsufficientHistory for a history of at most Core.SWAK_BPLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) SWAK_BPOpenAndFill

func (c *Core) SWAK_BPOpenAndFill(inReal []float64, optInTimePeriod int, optInDelta float64, outReal []float64) (*SWAK_BPStream, OutRange, error)

SWAK_BPOpenAndFill opens a stream as Core.SWAK_BPOpen does and also writes the outputs over the whole history, as Core.SWAK_BP writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SWAK_BPLookback values and share no memory with an input or another output.

The errors are those of Core.SWAK_BPOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SWAK_BUTTER

func (c *Core) SWAK_BUTTER(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

SWAK_BUTTER computes the Swiss Army Knife - Butterworth Filter over bars startIdx through endIdx.

The Butterworth row of John Ehlers' Swiss Army Knife filter: the Gaussian row's double real pole with two zeros added at Nyquist, giving a two-pole low-pass that cuts the shortest cycles harder than the Gaussian does while keeping the same pole placement.

Formula and more info at https://ta-lib.org/functions/swak_butter.

Inputs, each at least endIdx+1 long:

  • inReal: The series to filter; Ehlers' default is the bar midpoint (H+L)/2, which the caller passes as Core.MEDPRICE output.

Parameters:

  • optInTimePeriod: Cutoff period; shorter keeps more of the fast motion, longer smooths harder and lags more. Default 20; range 2 to 10000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: The filtered line, on the same scale as the input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SWAK_BUTTERLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdSWAK_BUTTER (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SWAK_BUTTERDisplayShift

func (c *Core) SWAK_BUTTERDisplayShift(optInTimePeriod, outputIdx int) (int, error)

SWAK_BUTTERDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SWAK_BUTTER. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SWAK_BUTTER followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SWAK_BUTTERLookback rejects or an index that names no output.

func (*Core) SWAK_BUTTERLookback

func (c *Core) SWAK_BUTTERLookback(optInTimePeriod int) (int, error)

SWAK_BUTTERLookback returns how many leading bars Core.SWAK_BUTTER consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdSWAK_BUTTER (see Core.SetUnstablePeriod).

It takes the parameters of Core.SWAK_BUTTER and returns BadParam for one out of range.

func (*Core) SWAK_BUTTEROpen

func (c *Core) SWAK_BUTTEROpen(inReal []float64, optInTimePeriod int) (*SWAK_BUTTERStream, float64, error)

SWAK_BUTTEROpen opens a live SWAK_BUTTERStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SWAK_BUTTER writes there.

inReal is the history; the parameters are those of Core.SWAK_BUTTER.

The error is InsufficientHistory for a history of at most Core.SWAK_BUTTERLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) SWAK_BUTTEROpenAndFill

func (c *Core) SWAK_BUTTEROpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*SWAK_BUTTERStream, OutRange, error)

SWAK_BUTTEROpenAndFill opens a stream as Core.SWAK_BUTTEROpen does and also writes the outputs over the whole history, as Core.SWAK_BUTTER writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SWAK_BUTTERLookback values and share no memory with an input or another output.

The errors are those of Core.SWAK_BUTTEROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SWAK_GAUSS

func (c *Core) SWAK_GAUSS(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

SWAK_GAUSS computes the Swiss Army Knife - Gaussian Filter over bars startIdx through endIdx.

The Gaussian row of John Ehlers' Swiss Army Knife filter: a two-pole low-pass smoother whose impulse response approximates a Gaussian, so it lags price without the overshoot a sharper filter leaves behind a turn.

Formula and more info at https://ta-lib.org/functions/swak_gauss.

Inputs, each at least endIdx+1 long:

  • inReal: The series to filter; Ehlers' default is the bar midpoint (H+L)/2, which the caller passes as Core.MEDPRICE output.

Parameters:

  • optInTimePeriod: Cutoff period; shorter keeps more of the fast motion, longer smooths harder and lags more. Default 20; range 2 to 10000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: The filtered line, on the same scale as the input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SWAK_GAUSSLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdSWAK_GAUSS (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SWAK_GAUSSDisplayShift

func (c *Core) SWAK_GAUSSDisplayShift(optInTimePeriod, outputIdx int) (int, error)

SWAK_GAUSSDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SWAK_GAUSS. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SWAK_GAUSS followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SWAK_GAUSSLookback rejects or an index that names no output.

func (*Core) SWAK_GAUSSLookback

func (c *Core) SWAK_GAUSSLookback(optInTimePeriod int) (int, error)

SWAK_GAUSSLookback returns how many leading bars Core.SWAK_GAUSS consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdSWAK_GAUSS (see Core.SetUnstablePeriod).

It takes the parameters of Core.SWAK_GAUSS and returns BadParam for one out of range.

func (*Core) SWAK_GAUSSOpen

func (c *Core) SWAK_GAUSSOpen(inReal []float64, optInTimePeriod int) (*SWAK_GAUSSStream, float64, error)

SWAK_GAUSSOpen opens a live SWAK_GAUSSStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SWAK_GAUSS writes there.

inReal is the history; the parameters are those of Core.SWAK_GAUSS.

The error is InsufficientHistory for a history of at most Core.SWAK_GAUSSLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) SWAK_GAUSSOpenAndFill

func (c *Core) SWAK_GAUSSOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*SWAK_GAUSSStream, OutRange, error)

SWAK_GAUSSOpenAndFill opens a stream as Core.SWAK_GAUSSOpen does and also writes the outputs over the whole history, as Core.SWAK_GAUSS writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SWAK_GAUSSLookback values and share no memory with an input or another output.

The errors are those of Core.SWAK_GAUSSOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SWAK_HP

func (c *Core) SWAK_HP(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

SWAK_HP computes the Swiss Army Knife - High-Pass Filter over bars startIdx through endIdx.

The high-pass row of John Ehlers' Swiss Army Knife filter: a one-pole detrender that removes what is slower than the cutoff period and keeps what is faster.

Formula and more info at https://ta-lib.org/functions/swak_hp.

Inputs, each at least endIdx+1 long:

  • inReal: The series to detrend; Ehlers' default is the bar midpoint (H+L)/2, which the caller passes as Core.MEDPRICE output.

Parameters:

  • optInTimePeriod: Cutoff period; cycles longer than it are removed, cycles shorter pass. Default 20; range 5 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: The detrended line, centred on zero.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.SWAK_HPLookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdSWAK_HP (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SWAK_HPDisplayShift

func (c *Core) SWAK_HPDisplayShift(optInTimePeriod, outputIdx int) (int, error)

SWAK_HPDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.SWAK_HP. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.SWAK_HP followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.SWAK_HPLookback rejects or an index that names no output.

func (*Core) SWAK_HPLookback

func (c *Core) SWAK_HPLookback(optInTimePeriod int) (int, error)

SWAK_HPLookback returns how many leading bars Core.SWAK_HP consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdSWAK_HP (see Core.SetUnstablePeriod).

It takes the parameters of Core.SWAK_HP and returns BadParam for one out of range.

func (*Core) SWAK_HPOpen

func (c *Core) SWAK_HPOpen(inReal []float64, optInTimePeriod int) (*SWAK_HPStream, float64, error)

SWAK_HPOpen opens a live SWAK_HPStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.SWAK_HP writes there.

inReal is the history; the parameters are those of Core.SWAK_HP.

The error is InsufficientHistory for a history of at most Core.SWAK_HPLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) SWAK_HPOpenAndFill

func (c *Core) SWAK_HPOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*SWAK_HPStream, OutRange, error)

SWAK_HPOpenAndFill opens a stream as Core.SWAK_HPOpen does and also writes the outputs over the whole history, as Core.SWAK_HP writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.SWAK_HPLookback values and share no memory with an input or another output.

The errors are those of Core.SWAK_HPOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) SetCandleSetting

func (c *Core) SetCandleSetting(settingType CandleSettingType, rangeType RangeType, avgPeriod int, factor float64) error

SetCandleSetting overrides one candlestick setting. avgPeriod is in 0 to IndexMax and factor is finite and not negative. A rejected call returns BadParam and changes nothing.

func (*Core) SetEMAVariation

func (c *Core) SetEMAVariation(variation EMAVariation) error

SetEMAVariation selects how the EMA family is seeded; a stream reads it when it opens. A value that names no EMAVariation returns BadParam and changes nothing.

func (*Core) SetUnstablePeriod

func (c *Core) SetUnstablePeriod(id FuncUnstId, period int) error

SetUnstablePeriod sets the extra warm-up bars of one function, or of every function given FuncUnstIdALL: 0 to IndexMax, or UnstableAutoPrec4 or UnstableAutoPrec8. A rejected call returns BadParam and changes nothing.

func (*Core) T3

func (c *Core) T3(startIdx, endIdx int, inReal []float64, optInTimePeriod int, optInVFactor float64, outReal []float64) (OutRange, error)

T3 computes the Triple Exponential Moving Average (T3) over bars startIdx through endIdx.

Tillson's T3: a low-lag moving average built from six chained EMAs, combined via volume-factor-weighted coefficients. Not the same as EMA3, despite both being called "triple EMA".

Formula and more info at https://ta-lib.org/functions/t3.

Inputs, each at least endIdx+1 long:

  • inReal: Source series to smooth.

Parameters:

  • optInTimePeriod: EMA period for each of the six stages. Default 5; range 1 to 100000; IntegerDefault selects the default.
  • optInVFactor: Volume factor weighting the coefficients (0 = plain triple EMA, higher = more DEMA-like sharpening) Default 0.7; range 0 to 1; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: T3 smoothed line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.T3Lookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdT3 (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.T3(0, len(series)-1, series, 5, 0.7, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
228 values from bar 24: [89.7982, ..., 96.4619]

func (*Core) T3DisplayShift

func (c *Core) T3DisplayShift(optInTimePeriod int, optInVFactor float64, outputIdx int) (int, error)

T3DisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.T3. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.T3 followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.T3Lookback rejects or an index that names no output.

func (*Core) T3Lookback

func (c *Core) T3Lookback(optInTimePeriod int, optInVFactor float64) (int, error)

T3Lookback returns how many leading bars Core.T3 consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdT3 (see Core.SetUnstablePeriod).

It takes the parameters of Core.T3 and returns BadParam for one out of range.

func (*Core) T3Open

func (c *Core) T3Open(inReal []float64, optInTimePeriod int, optInVFactor float64) (*T3Stream, float64, error)

T3Open opens a live T3Stream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.T3 writes there.

inReal is the history; the parameters are those of Core.T3.

The error is InsufficientHistory for a history of at most Core.T3Lookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) T3OpenAndFill

func (c *Core) T3OpenAndFill(inReal []float64, optInTimePeriod int, optInVFactor float64, outReal []float64) (*T3Stream, OutRange, error)

T3OpenAndFill opens a stream as Core.T3Open does and also writes the outputs over the whole history, as Core.T3 writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.T3Lookback values and share no memory with an input or another output.

The errors are those of Core.T3Open, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) TAN

func (c *Core) TAN(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

TAN computes the Vector Trigonometric Tan over bars startIdx through endIdx.

Element-wise tangent of the input series.

Formula and more info at https://ta-lib.org/functions/tan.

Inputs, each at least endIdx+1 long:

  • inReal: input values.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: tangent of each input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.TANLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = -1.2 + 2.4*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.TAN(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [-2.5722, ..., 2.5722]

func (*Core) TANDisplayShift

func (c *Core) TANDisplayShift(outputIdx int) (int, error)

TANDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.TAN. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.TAN, from 0, and returns BadParam for an index that names no output.

func (*Core) TANH

func (c *Core) TANH(startIdx, endIdx int, inReal, outReal []float64) (OutRange, error)

TANH computes the Vector Trigonometric Tanh over bars startIdx through endIdx.

Element-wise hyperbolic tangent of the input series.

Formula and more info at https://ta-lib.org/functions/tanh.

Inputs, each at least endIdx+1 long:

  • inReal: Input value series.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Hyperbolic tangent of each input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.TANHLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = -3 + 6*float64(i)/251.0
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.TANH(0, len(series)-1, series, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [-0.9951, ..., 0.9951]

func (*Core) TANHDisplayShift

func (c *Core) TANHDisplayShift(outputIdx int) (int, error)

TANHDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.TANH. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.TANH, from 0, and returns BadParam for an index that names no output.

func (*Core) TANHLookback

func (c *Core) TANHLookback() (int, error)

TANHLookback returns how many leading bars Core.TANH consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) TANHOpen

func (c *Core) TANHOpen(inReal []float64) (*TANHStream, float64, error)

TANHOpen opens a live TANHStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.TANH writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.TANHLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) TANHOpenAndFill

func (c *Core) TANHOpenAndFill(inReal, outReal []float64) (*TANHStream, OutRange, error)

TANHOpenAndFill opens a stream as Core.TANHOpen does and also writes the outputs over the whole history, as Core.TANH writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.TANHLookback values and share no memory with an input or another output.

The errors are those of Core.TANHOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) TANLookback

func (c *Core) TANLookback() (int, error)

TANLookback returns how many leading bars Core.TAN consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) TANOpen

func (c *Core) TANOpen(inReal []float64) (*TANStream, float64, error)

TANOpen opens a live TANStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.TAN writes there.

inReal is the history.

The error is InsufficientHistory for a history of at most Core.TANLookback bars and OutOfRangeEndIndex for one longer than [IndexMax]+1 bars.

func (*Core) TANOpenAndFill

func (c *Core) TANOpenAndFill(inReal, outReal []float64) (*TANStream, OutRange, error)

TANOpenAndFill opens a stream as Core.TANOpen does and also writes the outputs over the whole history, as Core.TAN writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.TANLookback values and share no memory with an input or another output.

The errors are those of Core.TANOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) TEMA

func (c *Core) TEMA(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

TEMA computes the Triple Exponential Moving Average over bars startIdx through endIdx.

Triple Exponential Moving Average: a smoothed price overlay built from three successively-applied EMAs to reduce lag versus a plain EMA. Distinct from EMA3, also called "triple EMA" in the literature.

Formula and more info at https://ta-lib.org/functions/tema.

Inputs, each at least endIdx+1 long:

  • inReal: Source price/data series.

Parameters:

  • optInTimePeriod: EMA period used for all three passes. Default 30; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: The TEMA line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.TEMALookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.TEMA(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
165 values from bar 87: [104.1646, ..., 100.0117]

func (*Core) TEMADisplayShift

func (c *Core) TEMADisplayShift(optInTimePeriod, outputIdx int) (int, error)

TEMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.TEMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.TEMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.TEMALookback rejects or an index that names no output.

func (*Core) TEMALookback

func (c *Core) TEMALookback(optInTimePeriod int) (int, error)

TEMALookback returns how many leading bars Core.TEMA consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.TEMA and returns BadParam for one out of range.

func (*Core) TEMAOpen

func (c *Core) TEMAOpen(inReal []float64, optInTimePeriod int) (*TEMAStream, float64, error)

TEMAOpen opens a live TEMAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.TEMA writes there.

inReal is the history; the parameters are those of Core.TEMA.

The error is InsufficientHistory for a history of at most Core.TEMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) TEMAOpenAndFill

func (c *Core) TEMAOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*TEMAStream, OutRange, error)

TEMAOpenAndFill opens a stream as Core.TEMAOpen does and also writes the outputs over the whole history, as Core.TEMA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.TEMALookback values and share no memory with an input or another output.

The errors are those of Core.TEMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) TRANGE

func (c *Core) TRANGE(startIdx, endIdx int, inHigh, inLow, inClose, outReal []float64) (OutRange, error)

TRANGE computes the True Range over bars startIdx through endIdx.

True Range: the greatest of today's high-low span and the two gaps between yesterday's close and today's high/low. Base volatility measure used to build ATR/NATR. Larger values mean wider or gappier bars (higher volatility).

Formula and more info at https://ta-lib.org/functions/trange.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: True Range value per bar.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.TRANGELookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.TRANGE(0, len(high)-1, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
251 values from bar 1: [6.8000, ..., 4.4000]

func (*Core) TRANGEDisplayShift

func (c *Core) TRANGEDisplayShift(outputIdx int) (int, error)

TRANGEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.TRANGE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.TRANGE, from 0, and returns BadParam for an index that names no output.

func (*Core) TRANGELookback

func (c *Core) TRANGELookback() (int, error)

TRANGELookback returns how many leading bars Core.TRANGE consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) TRANGEOpen

func (c *Core) TRANGEOpen(inHigh, inLow, inClose []float64) (*TRANGEStream, float64, error)

TRANGEOpen opens a live TRANGEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.TRANGE writes there.

inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.TRANGELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) TRANGEOpenAndFill

func (c *Core) TRANGEOpenAndFill(inHigh, inLow, inClose, outReal []float64) (*TRANGEStream, OutRange, error)

TRANGEOpenAndFill opens a stream as Core.TRANGEOpen does and also writes the outputs over the whole history, as Core.TRANGE writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.TRANGELookback values and share no memory with an input or another output.

The errors are those of Core.TRANGEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) TRIMA

func (c *Core) TRIMA(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

TRIMA computes the Triangular Moving Average over bars startIdx through endIdx.

Triangular Moving Average: a double-smoothed moving average that weights prices toward the middle of the window most heavily. Equivalent to an SMA of an SMA, computed here via an incremental triangular-weighted running numerator.

Formula and more info at https://ta-lib.org/functions/trima.

Inputs, each at least endIdx+1 long:

  • inReal: Source price series.

Parameters:

  • optInTimePeriod: Number of bars in the averaging window. Default 30; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Triangular moving average.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.TRIMALookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.TRIMA(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [93.5083, ..., 100.8417]

func (*Core) TRIMADisplayShift

func (c *Core) TRIMADisplayShift(optInTimePeriod, outputIdx int) (int, error)

TRIMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.TRIMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.TRIMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.TRIMALookback rejects or an index that names no output.

func (*Core) TRIMALookback

func (c *Core) TRIMALookback(optInTimePeriod int) (int, error)

TRIMALookback returns how many leading bars Core.TRIMA consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.TRIMA and returns BadParam for one out of range.

func (*Core) TRIMAOpen

func (c *Core) TRIMAOpen(inReal []float64, optInTimePeriod int) (*TRIMAStream, float64, error)

TRIMAOpen opens a live TRIMAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.TRIMA writes there.

inReal is the history; the parameters are those of Core.TRIMA.

The error is InsufficientHistory for a history of at most Core.TRIMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) TRIMAOpenAndFill

func (c *Core) TRIMAOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*TRIMAStream, OutRange, error)

TRIMAOpenAndFill opens a stream as Core.TRIMAOpen does and also writes the outputs over the whole history, as Core.TRIMA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.TRIMALookback values and share no memory with an input or another output.

The errors are those of Core.TRIMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) TRIX

func (c *Core) TRIX(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

TRIX computes the 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA over bars startIdx through endIdx.

1-day Rate-Of-Change of a triple-smoothed EMA of the input. Momentum oscillator that filters out price moves shorter than the chosen period. Oscillates around zero; sign, zero-crossings and slope signal momentum direction.

Formula and more info at https://ta-lib.org/functions/trix.

Inputs, each at least endIdx+1 long:

  • inReal: Source series to smooth.

Parameters:

  • optInTimePeriod: EMA period used at each of the three smoothing passes. Default 30; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: 1-day percent ROC of the triple EMA.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.TRIXLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.TRIX(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
164 values from bar 88: [0.0692, ..., 0.0796]

func (*Core) TRIXDisplayShift

func (c *Core) TRIXDisplayShift(optInTimePeriod, outputIdx int) (int, error)

TRIXDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.TRIX. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.TRIX followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.TRIXLookback rejects or an index that names no output.

func (*Core) TRIXLookback

func (c *Core) TRIXLookback(optInTimePeriod int) (int, error)

TRIXLookback returns how many leading bars Core.TRIX consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.TRIX and returns BadParam for one out of range.

func (*Core) TRIXOpen

func (c *Core) TRIXOpen(inReal []float64, optInTimePeriod int) (*TRIXStream, float64, error)

TRIXOpen opens a live TRIXStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.TRIX writes there.

inReal is the history; the parameters are those of Core.TRIX.

The error is InsufficientHistory for a history of at most Core.TRIXLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) TRIXOpenAndFill

func (c *Core) TRIXOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*TRIXStream, OutRange, error)

TRIXOpenAndFill opens a stream as Core.TRIXOpen does and also writes the outputs over the whole history, as Core.TRIX writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.TRIXLookback values and share no memory with an input or another output.

The errors are those of Core.TRIXOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) TSF

func (c *Core) TSF(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

TSF computes the Time Series Forecast over bars startIdx through endIdx.

Time Series Forecast: fits a least-squares linear regression line over the last N bars and projects it one x-step beyond LINEARREG. Same regression as LINEARREG but evaluated at x=period instead of x=period-1.

Formula and more info at https://ta-lib.org/functions/tsf.

Inputs, each at least endIdx+1 long:

  • inReal: Input series to regress and forecast.

Parameters:

  • optInTimePeriod: Number of bars in the regression window. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Regression line value projected to x=period (one step past LINEARREG)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.TSFLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.TSF(0, len(series)-1, series, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [89.8000, ..., 92.7824]

func (*Core) TSFDisplayShift

func (c *Core) TSFDisplayShift(optInTimePeriod, outputIdx int) (int, error)

TSFDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.TSF. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.TSF followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.TSFLookback rejects or an index that names no output.

func (*Core) TSFLookback

func (c *Core) TSFLookback(optInTimePeriod int) (int, error)

TSFLookback returns how many leading bars Core.TSF consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.TSF and returns BadParam for one out of range.

func (*Core) TSFOpen

func (c *Core) TSFOpen(inReal []float64, optInTimePeriod int) (*TSFStream, float64, error)

TSFOpen opens a live TSFStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.TSF writes there.

inReal is the history; the parameters are those of Core.TSF.

The error is InsufficientHistory for a history of at most Core.TSFLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) TSFOpenAndFill

func (c *Core) TSFOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*TSFStream, OutRange, error)

TSFOpenAndFill opens a stream as Core.TSFOpen does and also writes the outputs over the whole history, as Core.TSF writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.TSFLookback values and share no memory with an input or another output.

The errors are those of Core.TSFOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) TSI

func (c *Core) TSI(startIdx, endIdx int, inReal []float64, optInFirstPeriod, optInSecondPeriod int, outReal []float64) (OutRange, error)

TSI computes the True Strength Index over bars startIdx through endIdx.

True Strength Index: William Blau's double-smoothed momentum oscillator. The one-bar price change is smoothed twice with exponential averages, and the same pair of averages is applied to the magnitude of that change; the ratio of the two is scaled by 100. Dividing the smoothed signed momentum by the smoothed absolute momentum normalises the reading, so the result is bounded by -100 and +100 and comparable across instruments. The double smoothing is what separates it from a raw momentum plot: the curve is smooth enough to read while keeping far less lag than a single average of the same total length.

Formula and more info at https://ta-lib.org/functions/tsi.

Inputs, each at least endIdx+1 long:

  • inReal: Source price/value series, canonically the close.

Parameters:

  • optInFirstPeriod: Period of the first smoothing, applied to the raw momentum. Default 25; range 2 to 100000; IntegerDefault selects the default.
  • optInSecondPeriod: Period of the second smoothing, applied to the first. Default 13; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: True Strength Index, -100 to +100.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.TSILookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.TSI(0, len(series)-1, series, 25, 13, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
215 values from bar 37: [-16.9532, ..., -2.2395]

func (*Core) TSIDisplayShift

func (c *Core) TSIDisplayShift(optInFirstPeriod, optInSecondPeriod, outputIdx int) (int, error)

TSIDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.TSI. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.TSI followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.TSILookback rejects or an index that names no output.

func (*Core) TSILookback

func (c *Core) TSILookback(optInFirstPeriod, optInSecondPeriod int) (int, error)

TSILookback returns how many leading bars Core.TSI consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.TSI and returns BadParam for one out of range.

func (*Core) TSIOpen

func (c *Core) TSIOpen(inReal []float64, optInFirstPeriod, optInSecondPeriod int) (*TSIStream, float64, error)

TSIOpen opens a live TSIStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.TSI writes there.

inReal is the history; the parameters are those of Core.TSI.

The error is InsufficientHistory for a history of at most Core.TSILookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) TSIOpenAndFill

func (c *Core) TSIOpenAndFill(inReal []float64, optInFirstPeriod, optInSecondPeriod int, outReal []float64) (*TSIStream, OutRange, error)

TSIOpenAndFill opens a stream as Core.TSIOpen does and also writes the outputs over the whole history, as Core.TSI writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.TSILookback values and share no memory with an input or another output.

The errors are those of Core.TSIOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) TYPPRICE

func (c *Core) TYPPRICE(startIdx, endIdx int, inHigh, inLow, inClose, outReal []float64) (OutRange, error)

TYPPRICE computes the Typical Price over bars startIdx through endIdx.

Typical Price: the average of the high, low, and close of each bar. A single representative price per period.

Formula and more info at https://ta-lib.org/functions/typprice.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: typical price per bar.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.TYPPRICELookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.TYPPRICE(0, len(high)-1, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [110.5333, ..., 94.5833]

func (*Core) TYPPRICEDisplayShift

func (c *Core) TYPPRICEDisplayShift(outputIdx int) (int, error)

TYPPRICEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.TYPPRICE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.TYPPRICE, from 0, and returns BadParam for an index that names no output.

func (*Core) TYPPRICELookback

func (c *Core) TYPPRICELookback() (int, error)

TYPPRICELookback returns how many leading bars Core.TYPPRICE consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) TYPPRICEOpen

func (c *Core) TYPPRICEOpen(inHigh, inLow, inClose []float64) (*TYPPRICEStream, float64, error)

TYPPRICEOpen opens a live TYPPRICEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.TYPPRICE writes there.

inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.TYPPRICELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) TYPPRICEOpenAndFill

func (c *Core) TYPPRICEOpenAndFill(inHigh, inLow, inClose, outReal []float64) (*TYPPRICEStream, OutRange, error)

TYPPRICEOpenAndFill opens a stream as Core.TYPPRICEOpen does and also writes the outputs over the whole history, as Core.TYPPRICE writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.TYPPRICELookback values and share no memory with an input or another output.

The errors are those of Core.TYPPRICEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ULCER

func (c *Core) ULCER(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

ULCER computes the Ulcer Index over bars startIdx through endIdx.

Peter Martin's Ulcer Index: the root mean square of the percent drawdowns from the highest earlier value in each N-bar window. It reads downside volatility only: 0 while the series keeps making new highs, rising with the depth and the duration of declines; upside swings do not count. The Ulcer Index is the denominator of the Martin ratio (Ulcer Performance Index).

Formula and more info at https://ta-lib.org/functions/ulcer.

Inputs, each at least endIdx+1 long:

  • inReal: Input price series.

Parameters:

  • optInTimePeriod: Bars in each window. Default 14; range 2 to 10000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Root mean square of the percent drawdowns from the window's running peak.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ULCERLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ULCER(0, len(series)-1, series, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [10.4305, ..., 8.5995]

func (*Core) ULCERDisplayShift

func (c *Core) ULCERDisplayShift(optInTimePeriod, outputIdx int) (int, error)

ULCERDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ULCER. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ULCER followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ULCERLookback rejects or an index that names no output.

func (*Core) ULCERLookback

func (c *Core) ULCERLookback(optInTimePeriod int) (int, error)

ULCERLookback returns how many leading bars Core.ULCER consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ULCER and returns BadParam for one out of range.

func (*Core) ULCEROpen

func (c *Core) ULCEROpen(inReal []float64, optInTimePeriod int) (*ULCERStream, float64, error)

ULCEROpen opens a live ULCERStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ULCER writes there.

inReal is the history; the parameters are those of Core.ULCER.

The error is InsufficientHistory for a history of at most Core.ULCERLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) ULCEROpenAndFill

func (c *Core) ULCEROpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*ULCERStream, OutRange, error)

ULCEROpenAndFill opens a stream as Core.ULCEROpen does and also writes the outputs over the whole history, as Core.ULCER writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.ULCERLookback values and share no memory with an input or another output.

The errors are those of Core.ULCEROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ULCER_ROLL

func (c *Core) ULCER_ROLL(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

ULCER_ROLL computes the Ulcer Index, rolling high over bars startIdx through endIdx.

The Ulcer Index over a rolling high: the root mean square of the last N percent drawdowns, each taken from the highest value of the N bars ending there. It reads downside volatility only: 0 while the series keeps making new highs, rising with the depth and the duration of declines; upside swings do not count. The Ulcer Index is the denominator of the Martin ratio (Ulcer Performance Index).

Formula and more info at https://ta-lib.org/functions/ulcer_roll.

Inputs, each at least endIdx+1 long:

  • inReal: Input price series.

Parameters:

  • optInTimePeriod: Bars in the rolling high, and drawdowns in the mean. Default 14; range 2 to 10000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Root mean square of the percent drawdowns from the rolling high.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ULCER_ROLLLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ULCER_ROLLDisplayShift

func (c *Core) ULCER_ROLLDisplayShift(optInTimePeriod, outputIdx int) (int, error)

ULCER_ROLLDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ULCER_ROLL. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ULCER_ROLL followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ULCER_ROLLLookback rejects or an index that names no output.

func (*Core) ULCER_ROLLLookback

func (c *Core) ULCER_ROLLLookback(optInTimePeriod int) (int, error)

ULCER_ROLLLookback returns how many leading bars Core.ULCER_ROLL consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ULCER_ROLL and returns BadParam for one out of range.

func (*Core) ULCER_ROLLOpen

func (c *Core) ULCER_ROLLOpen(inReal []float64, optInTimePeriod int) (*ULCER_ROLLStream, float64, error)

ULCER_ROLLOpen opens a live ULCER_ROLLStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ULCER_ROLL writes there.

inReal is the history; the parameters are those of Core.ULCER_ROLL.

The error is InsufficientHistory for a history of at most Core.ULCER_ROLLLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) ULCER_ROLLOpenAndFill

func (c *Core) ULCER_ROLLOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*ULCER_ROLLStream, OutRange, error)

ULCER_ROLLOpenAndFill opens a stream as Core.ULCER_ROLLOpen does and also writes the outputs over the whole history, as Core.ULCER_ROLL writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.ULCER_ROLLLookback values and share no memory with an input or another output.

The errors are those of Core.ULCER_ROLLOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ULTOSC

func (c *Core) ULTOSC(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod1, optInTimePeriod2, optInTimePeriod3 int, outReal []float64) (OutRange, error)

ULTOSC computes the Ultimate Oscillator over bars startIdx through endIdx.

Ultimate Oscillator: momentum indicator combining buying-pressure/true-range ratios over three time periods into one 0-100 weighted average. Blends short-, medium-, and long-term momentum to damp single-period noise. Ranges 0-100; conventionally >70 overbought, <30 oversold.

Formula and more info at https://ta-lib.org/functions/ultosc.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod1: Bars for one averaging window. Default 7; range 1 to 100000; IntegerDefault selects the default.
  • optInTimePeriod2: Bars for another averaging window. Default 14; range 1 to 100000; IntegerDefault selects the default.
  • optInTimePeriod3: Bars for another averaging window. Default 28; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Ultimate Oscillator value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ULTOSCLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ULTOSC(0, len(high)-1, high, low, close, 7, 14, 28, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
224 values from bar 28: [49.2116, ..., 42.8735]

func (*Core) ULTOSCDisplayShift

func (c *Core) ULTOSCDisplayShift(optInTimePeriod1, optInTimePeriod2, optInTimePeriod3, outputIdx int) (int, error)

ULTOSCDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ULTOSC. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ULTOSC followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ULTOSCLookback rejects or an index that names no output.

func (*Core) ULTOSCLookback

func (c *Core) ULTOSCLookback(optInTimePeriod1, optInTimePeriod2, optInTimePeriod3 int) (int, error)

ULTOSCLookback returns how many leading bars Core.ULTOSC consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ULTOSC and returns BadParam for one out of range.

func (*Core) ULTOSCOpen

func (c *Core) ULTOSCOpen(inHigh, inLow, inClose []float64, optInTimePeriod1, optInTimePeriod2, optInTimePeriod3 int) (*ULTOSCStream, float64, error)

ULTOSCOpen opens a live ULTOSCStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ULTOSC writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.ULTOSC.

The error is InsufficientHistory for a history of at most Core.ULTOSCLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ULTOSCOpenAndFill

func (c *Core) ULTOSCOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod1, optInTimePeriod2, optInTimePeriod3 int, outReal []float64) (*ULTOSCStream, OutRange, error)

ULTOSCOpenAndFill opens a stream as Core.ULTOSCOpen does and also writes the outputs over the whole history, as Core.ULTOSC writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.ULTOSCLookback values and share no memory with an input or another output.

The errors are those of Core.ULTOSCOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) UnstablePeriod

func (c *Core) UnstablePeriod(id FuncUnstId) (int, error)

UnstablePeriod returns the unstable period set for one function.

func (*Core) VAR

func (c *Core) VAR(startIdx, endIdx int, inReal []float64, optInTimePeriod int, optInNbDev float64, outReal []float64) (OutRange, error)

VAR computes the Variance over bars startIdx through endIdx.

Rolling population variance of a real series over a given period. Measures dispersion of values around their mean. Higher values indicate greater dispersion; 0 means constant input.

Formula and more info at https://ta-lib.org/functions/var.

Inputs, each at least endIdx+1 long:

  • inReal: Source series.

Parameters:

  • optInTimePeriod: Window length for the variance. Default 5; range 1 to 100000; IntegerDefault selects the default.
  • optInNbDev: Deviation count accepted by the API but never used in the computation. Default 1; RealDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Rolling population variance.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.VARLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.VAR(0, len(series)-1, series, 5, 1, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
248 values from bar 4: [6.4870, ..., 2.4270]

func (*Core) VARDisplayShift

func (c *Core) VARDisplayShift(optInTimePeriod int, optInNbDev float64, outputIdx int) (int, error)

VARDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.VAR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.VAR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.VARLookback rejects or an index that names no output.

func (*Core) VARLookback

func (c *Core) VARLookback(optInTimePeriod int, optInNbDev float64) (int, error)

VARLookback returns how many leading bars Core.VAR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.VAR and returns BadParam for one out of range.

func (*Core) VAROpen

func (c *Core) VAROpen(inReal []float64, optInTimePeriod int, optInNbDev float64) (*VARStream, float64, error)

VAROpen opens a live VARStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.VAR writes there.

inReal is the history; the parameters are those of Core.VAR.

The error is InsufficientHistory for a history of at most Core.VARLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) VAROpenAndFill

func (c *Core) VAROpenAndFill(inReal []float64, optInTimePeriod int, optInNbDev float64, outReal []float64) (*VARStream, OutRange, error)

VAROpenAndFill opens a stream as Core.VAROpen does and also writes the outputs over the whole history, as Core.VAR writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.VARLookback values and share no memory with an input or another output.

The errors are those of Core.VAROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) VHF

func (c *Core) VHF(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

VHF computes the Vertical Horizontal Filter over bars startIdx through endIdx.

Vertical Horizontal Filter: Adam White's trend-versus-range filter, the range a window covered divided by the path it actually travelled.

Formula and more info at https://ta-lib.org/functions/vhf.

Inputs, each at least endIdx+1 long:

  • inReal: Source price/value series, canonically the close.

Parameters:

  • optInTimePeriod: Number of trailing closes spanned by the range. Default 28; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Vertical Horizontal Filter value.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.VHFLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.VHF(0, len(series)-1, series, 28, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
224 values from bar 28: [0.7780, ..., 0.5408]

func (*Core) VHFDisplayShift

func (c *Core) VHFDisplayShift(optInTimePeriod, outputIdx int) (int, error)

VHFDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.VHF. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.VHF followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.VHFLookback rejects or an index that names no output.

func (*Core) VHFLookback

func (c *Core) VHFLookback(optInTimePeriod int) (int, error)

VHFLookback returns how many leading bars Core.VHF consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.VHF and returns BadParam for one out of range.

func (*Core) VHFOpen

func (c *Core) VHFOpen(inReal []float64, optInTimePeriod int) (*VHFStream, float64, error)

VHFOpen opens a live VHFStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.VHF writes there.

inReal is the history; the parameters are those of Core.VHF.

The error is InsufficientHistory for a history of at most Core.VHFLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) VHFOpenAndFill

func (c *Core) VHFOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*VHFStream, OutRange, error)

VHFOpenAndFill opens a stream as Core.VHFOpen does and also writes the outputs over the whole history, as Core.VHF writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.VHFLookback values and share no memory with an input or another output.

The errors are those of Core.VHFOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) VIDYA

func (c *Core) VIDYA(startIdx, endIdx int, inReal []float64, optInTimePeriod, optInCMOPeriod int, outReal []float64) (OutRange, error)

VIDYA computes the Variable Index Dynamic Average over bars startIdx through endIdx.

Variable Index Dynamic Average (Tushar Chande): an EMA whose smoothing factor is scaled every bar by the absolute value of the Chande Momentum Oscillator. It follows the price like an EMA in a one-way move and stops moving when up and down moves balance, so it flattens out in consolidations.

Formula and more info at https://ta-lib.org/functions/vidya.

Inputs, each at least endIdx+1 long:

  • inReal: Data on which to compute the average.

Parameters:

  • optInTimePeriod: The EMA length whose alpha the CMO scales. Default 12; range 1 to 100000; IntegerDefault selects the default.
  • optInCMOPeriod: Number of trailing price changes in the CMO. Default 9; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Variable Index Dynamic Average line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.VIDYALookback: a range that ends before it returns NBElement 0.

The lookback includes the unstable period the Core holds for FuncUnstIdVIDYA (see Core.SetUnstablePeriod).

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.VIDYA(0, len(series)-1, series, 12, 9, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
243 values from bar 9: [102.2203, ..., 99.2604]

func (*Core) VIDYADisplayShift

func (c *Core) VIDYADisplayShift(optInTimePeriod, optInCMOPeriod, outputIdx int) (int, error)

VIDYADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.VIDYA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.VIDYA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.VIDYALookback rejects or an index that names no output.

func (*Core) VIDYALookback

func (c *Core) VIDYALookback(optInTimePeriod, optInCMOPeriod int) (int, error)

VIDYALookback returns how many leading bars Core.VIDYA consumes before its first value: called with startIdx 0, its first value is at that bar.

The lookback includes the unstable period the Core holds for FuncUnstIdVIDYA (see Core.SetUnstablePeriod).

It takes the parameters of Core.VIDYA and returns BadParam for one out of range.

func (*Core) VIDYAOpen

func (c *Core) VIDYAOpen(inReal []float64, optInTimePeriod, optInCMOPeriod int) (*VIDYAStream, float64, error)

VIDYAOpen opens a live VIDYAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.VIDYA writes there.

inReal is the history; the parameters are those of Core.VIDYA.

The error is InsufficientHistory for a history of at most Core.VIDYALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) VIDYAOpenAndFill

func (c *Core) VIDYAOpenAndFill(inReal []float64, optInTimePeriod, optInCMOPeriod int, outReal []float64) (*VIDYAStream, OutRange, error)

VIDYAOpenAndFill opens a stream as Core.VIDYAOpen does and also writes the outputs over the whole history, as Core.VIDYA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.VIDYALookback values and share no memory with an input or another output.

The errors are those of Core.VIDYAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) VORTEX

func (c *Core) VORTEX(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outPlusVI, outMinusVI []float64) (OutRange, error)

VORTEX computes the Vortex Indicator over bars startIdx through endIdx.

Vortex Indicator: Etienne Botes and Douglas Siepman's two-line trend indicator (Technical Analysis of Stocks & Commodities 28:1, January 2010). Positive and negative "vortex movement" — the reach from today's high to yesterday's low and from today's low to yesterday's high — each summed over the period and normalized by the summed true range.

Formula and more info at https://ta-lib.org/functions/vortex.

Inputs, each at least endIdx+1 long:

  • inHigh: High price series.
  • inLow: Low price series.
  • inClose: Close price series.

Parameters:

  • optInTimePeriod: Number of bars in the rolling sums. Default 14; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outPlusVI: Positive vortex line (+VI)
  • outMinusVI: Negative vortex line (−VI)

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.VORTEXLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	plusVi := make([]float64, 252)
	minusVi := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.VORTEX(0, len(high)-1, high, low, close, 14, plusVi, minusVi)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("plusVi = [%.4f, ..., %.4f]\n", plusVi[0], plusVi[r.NBElement-1])
	fmt.Printf("minusVi = [%.4f, ..., %.4f]\n", minusVi[0], minusVi[r.NBElement-1])
}
Output:
238 values from bar 14:
plusVi = [0.7639, ..., 0.8092]
minusVi = [1.2348, ..., 1.0703]

func (*Core) VORTEXDisplayShift

func (c *Core) VORTEXDisplayShift(optInTimePeriod, outputIdx int) (int, error)

VORTEXDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.VORTEX. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.VORTEX followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.VORTEXLookback rejects or an index that names no output.

func (*Core) VORTEXLookback

func (c *Core) VORTEXLookback(optInTimePeriod int) (int, error)

VORTEXLookback returns how many leading bars Core.VORTEX consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.VORTEX and returns BadParam for one out of range.

func (*Core) VORTEXOpen

func (c *Core) VORTEXOpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*VORTEXStream, float64, float64, error)

VORTEXOpen opens a live VORTEXStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outPlusVI and outMinusVI), the values Core.VORTEX writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.VORTEX.

The error is InsufficientHistory for a history of at most Core.VORTEXLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) VORTEXOpenAndFill

func (c *Core) VORTEXOpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outPlusVI, outMinusVI []float64) (*VORTEXStream, OutRange, error)

VORTEXOpenAndFill opens a stream as Core.VORTEXOpen does and also writes the outputs over the whole history, as Core.VORTEX writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.VORTEXLookback values and share no memory with an input or another output.

The errors are those of Core.VORTEXOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) VWAP

func (c *Core) VWAP(startIdx, endIdx int, inHigh, inLow, inClose, inVolume, outReal []float64) (OutRange, error)

VWAP computes the Volume Weighted Average Price over bars startIdx through endIdx.

Volume Weighted Average Price: the average price paid per unit of volume traded, accumulated from the first bar of the range onward. Because every bar is weighted by the volume that traded on it, VWAP tracks where the bulk of the money actually changed hands rather than where the last trade printed. Price above VWAP is read as buyers paying up relative to the session's average cost, price below it as the reverse, which is why execution desks quote fills against it.

Formula and more info at https://ta-lib.org/functions/vwap.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.
  • inVolume: Volume of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Volume weighted average price, cumulative from the first bar of the range.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.VWAPLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.VWAP(0, len(high)-1, high, low, close, volume, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [110.5333, ..., 96.9388]

func (*Core) VWAPDisplayShift

func (c *Core) VWAPDisplayShift(outputIdx int) (int, error)

VWAPDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.VWAP. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.VWAP, from 0, and returns BadParam for an index that names no output.

func (*Core) VWAPLookback

func (c *Core) VWAPLookback() (int, error)

VWAPLookback returns how many leading bars Core.VWAP consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) VWAPOpen

func (c *Core) VWAPOpen(inHigh, inLow, inClose, inVolume []float64) (*VWAPStream, float64, error)

VWAPOpen opens a live VWAPStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.VWAP writes there.

inHigh, inLow, inClose and inVolume are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.VWAPLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) VWAPOpenAndFill

func (c *Core) VWAPOpenAndFill(inHigh, inLow, inClose, inVolume, outReal []float64) (*VWAPStream, OutRange, error)

VWAPOpenAndFill opens a stream as Core.VWAPOpen does and also writes the outputs over the whole history, as Core.VWAP writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.VWAPLookback values and share no memory with an input or another output.

The errors are those of Core.VWAPOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) VWMA

func (c *Core) VWMA(startIdx, endIdx int, inReal, inVolume []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

VWMA computes the Volume Weighted Moving Average over bars startIdx through endIdx.

Volume Weighted Moving Average: the mean price over a trailing window of optInTimePeriod bars, each bar weighted by its own volume. Heavily traded bars pull the average toward their price; quiet bars barely move it.

Formula and more info at https://ta-lib.org/functions/vwma.

Inputs, each at least endIdx+1 long:

  • inReal: Source price series, close by convention.
  • inVolume: Volume of each bar.

Parameters:

  • optInTimePeriod: Number of bars in the weighting window. Default 30; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Volume weighted moving average of the input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.VWMALookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	volume := make([]float64, 252) // your data, oldest first
	for i := range volume {
		volume[i] = float64(10000 + 100*i + 30*(i%20-10)*(i%20-10))
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.VWMA(0, len(series)-1, series, volume, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [95.0090, ..., 98.7219]

func (*Core) VWMADisplayShift

func (c *Core) VWMADisplayShift(optInTimePeriod, outputIdx int) (int, error)

VWMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.VWMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.VWMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.VWMALookback rejects or an index that names no output.

func (*Core) VWMALookback

func (c *Core) VWMALookback(optInTimePeriod int) (int, error)

VWMALookback returns how many leading bars Core.VWMA consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.VWMA and returns BadParam for one out of range.

func (*Core) VWMAOpen

func (c *Core) VWMAOpen(inReal, inVolume []float64, optInTimePeriod int) (*VWMAStream, float64, error)

VWMAOpen opens a live VWMAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.VWMA writes there.

inReal and inVolume are the histories, of one length; the parameters are those of Core.VWMA.

The error is InsufficientHistory for a history of at most Core.VWMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) VWMAOpenAndFill

func (c *Core) VWMAOpenAndFill(inReal, inVolume []float64, optInTimePeriod int, outReal []float64) (*VWMAStream, OutRange, error)

VWMAOpenAndFill opens a stream as Core.VWMAOpen does and also writes the outputs over the whole history, as Core.VWMA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.VWMALookback values and share no memory with an input or another output.

The errors are those of Core.VWMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) WAD

func (c *Core) WAD(startIdx, endIdx int, inHigh, inLow, inClose, outReal []float64) (OutRange, error)

WAD computes the Williams' Accumulation/Distribution over bars startIdx through endIdx.

Williams' Accumulation/Distribution: a cumulative line meant to expose whether a security is quietly under accumulation (informed buying) or distribution (informed selling) beneath the surface of price. Larry Williams built it to catch that shift before price confirms it — traders watch for the line to diverge from price, since a line that keeps rising while price stalls or falls points to accumulation, and one that stalls while price pushes to a new high points to distribution.

Formula and more info at https://ta-lib.org/functions/wad.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Cumulative accumulation/distribution.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.WADLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.WAD(0, len(high)-1, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [0.0000, ..., -81.1500]

func (*Core) WADDisplayShift

func (c *Core) WADDisplayShift(outputIdx int) (int, error)

WADDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.WAD. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.WAD, from 0, and returns BadParam for an index that names no output.

func (*Core) WADLookback

func (c *Core) WADLookback() (int, error)

WADLookback returns how many leading bars Core.WAD consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) WADOpen

func (c *Core) WADOpen(inHigh, inLow, inClose []float64) (*WADStream, float64, error)

WADOpen opens a live WADStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.WAD writes there.

inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.WADLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) WADOpenAndFill

func (c *Core) WADOpenAndFill(inHigh, inLow, inClose, outReal []float64) (*WADStream, OutRange, error)

WADOpenAndFill opens a stream as Core.WADOpen does and also writes the outputs over the whole history, as Core.WAD writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.WADLookback values and share no memory with an input or another output.

The errors are those of Core.WADOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) WAVETREND

func (c *Core) WAVETREND(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInChannelPeriod, optInAveragePeriod, optInSignalPeriod int, outWT1, outWT2 []float64) (OutRange, error)

WAVETREND computes the WaveTrend Oscillator over bars startIdx through endIdx.

WaveTrend Oscillator: how far the typical price sits from its own exponential average, divided by an exponential average of that distance and by Lambert's CCI constant, then smoothed. The reading is the plain stochastic's complaint answered a different way — rather than bounding the oscillator by construction, it scales it by how far price has recently been travelling, so the same numeric level means the same thing in a quiet market and a fast one. The oscillator line and its short simple average cross; the crossings that matter are the ones beyond the extremes, which the author draws at ±53 and ±60.

Formula and more info at https://ta-lib.org/functions/wavetrend.

Inputs, each at least endIdx+1 long:

  • inHigh: High price series.
  • inLow: Low price series.
  • inClose: Close price series.

Parameters:

  • optInChannelPeriod: Period of the price channel, used by both the average and the deviation. Default 10; range 2 to 100000; IntegerDefault selects the default.
  • optInAveragePeriod: Smoothing for the oscillator line. Default 21; range 1 to 100000; IntegerDefault selects the default.
  • optInSignalPeriod: Period of the simple average making the signal line. Default 4; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outWT1: WaveTrend oscillator line.
  • outWT2: Simple average of the oscillator line.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.WAVETRENDLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	wt1 := make([]float64, 252)
	wt2 := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.WAVETREND(0, len(high)-1, high, low, close, 10, 21, 4, wt1, wt2)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("wt1 = [%.4f, ..., %.4f]\n", wt1[0], wt1[r.NBElement-1])
	fmt.Printf("wt2 = [%.4f, ..., %.4f]\n", wt2[0], wt2[r.NBElement-1])
}
Output:
211 values from bar 41:
wt1 = [49.0117, ..., -11.2816]
wt2 = [45.6703, ..., -1.7372]

func (*Core) WAVETRENDDisplayShift

func (c *Core) WAVETRENDDisplayShift(optInChannelPeriod, optInAveragePeriod, optInSignalPeriod, outputIdx int) (int, error)

WAVETRENDDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.WAVETREND. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.WAVETREND followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.WAVETRENDLookback rejects or an index that names no output.

func (*Core) WAVETRENDLookback

func (c *Core) WAVETRENDLookback(optInChannelPeriod, optInAveragePeriod, optInSignalPeriod int) (int, error)

WAVETRENDLookback returns how many leading bars Core.WAVETREND consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.WAVETREND and returns BadParam for one out of range.

func (*Core) WAVETRENDOpen

func (c *Core) WAVETRENDOpen(inHigh, inLow, inClose []float64, optInChannelPeriod, optInAveragePeriod, optInSignalPeriod int) (*WAVETRENDStream, float64, float64, error)

WAVETRENDOpen opens a live WAVETRENDStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outWT1 and outWT2), the values Core.WAVETREND writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.WAVETREND.

The error is InsufficientHistory for a history of at most Core.WAVETRENDLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) WAVETRENDOpenAndFill

func (c *Core) WAVETRENDOpenAndFill(inHigh, inLow, inClose []float64, optInChannelPeriod, optInAveragePeriod, optInSignalPeriod int, outWT1, outWT2 []float64) (*WAVETRENDStream, OutRange, error)

WAVETRENDOpenAndFill opens a stream as Core.WAVETRENDOpen does and also writes the outputs over the whole history, as Core.WAVETREND writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.WAVETRENDLookback values and share no memory with an input or another output.

The errors are those of Core.WAVETRENDOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) WCLPRICE

func (c *Core) WCLPRICE(startIdx, endIdx int, inHigh, inLow, inClose, outReal []float64) (OutRange, error)

WCLPRICE computes the Weighted Close Price over bars startIdx through endIdx.

Weighted Close Price: a per-bar price average giving the close double weight relative to high and low.

Formula and more info at https://ta-lib.org/functions/wclprice.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Weighted close price per bar.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.WCLPRICELookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.WCLPRICE(0, len(high)-1, high, low, close, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
252 values from bar 0: [110.8000, ..., 94.8500]

func (*Core) WCLPRICEDisplayShift

func (c *Core) WCLPRICEDisplayShift(outputIdx int) (int, error)

WCLPRICEDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.WCLPRICE. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the output's position among the outputs of Core.WCLPRICE, from 0, and returns BadParam for an index that names no output.

func (*Core) WCLPRICELookback

func (c *Core) WCLPRICELookback() (int, error)

WCLPRICELookback returns how many leading bars Core.WCLPRICE consumes before its first value: called with startIdx 0, its first value is at that bar.

func (*Core) WCLPRICEOpen

func (c *Core) WCLPRICEOpen(inHigh, inLow, inClose []float64) (*WCLPRICEStream, float64, error)

WCLPRICEOpen opens a live WCLPRICEStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.WCLPRICE writes there.

inHigh, inLow and inClose are the histories, of one length.

The error is InsufficientHistory for a history of at most Core.WCLPRICELookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for histories of different lengths.

func (*Core) WCLPRICEOpenAndFill

func (c *Core) WCLPRICEOpenAndFill(inHigh, inLow, inClose, outReal []float64) (*WCLPRICEStream, OutRange, error)

WCLPRICEOpenAndFill opens a stream as Core.WCLPRICEOpen does and also writes the outputs over the whole history, as Core.WCLPRICE writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.WCLPRICELookback values and share no memory with an input or another output.

The errors are those of Core.WCLPRICEOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) WILLR

func (c *Core) WILLR(startIdx, endIdx int, inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

WILLR computes the Williams' %R over bars startIdx through endIdx.

Williams' %R momentum oscillator over a rolling period, bounded in [-100, 0]. Measures where the current close sits relative to the high-low range of the last N bars. Near 0 = close at period high (overbought); near -100 = close at period low (oversold).

Formula and more info at https://ta-lib.org/functions/willr.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.
  • inClose: Close price of each bar.

Parameters:

  • optInTimePeriod: Lookback bars for the high/low range. Default 14; range 2 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Williams' %R value in [-100, 0].

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.WILLRLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	close := make([]float64, 252) // your data, oldest first
	for i := range close {
		close[i] = 88.4 + float64((i%40-20)*(i%40-20)+4*(i%9-4)*(i%9-4))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.WILLR(0, len(high)-1, high, low, close, 14, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
239 values from bar 13: [-91.2525, ..., -81.1414]

func (*Core) WILLRDisplayShift

func (c *Core) WILLRDisplayShift(optInTimePeriod, outputIdx int) (int, error)

WILLRDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.WILLR. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.WILLR followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.WILLRLookback rejects or an index that names no output.

func (*Core) WILLRLookback

func (c *Core) WILLRLookback(optInTimePeriod int) (int, error)

WILLRLookback returns how many leading bars Core.WILLR consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.WILLR and returns BadParam for one out of range.

func (*Core) WILLROpen

func (c *Core) WILLROpen(inHigh, inLow, inClose []float64, optInTimePeriod int) (*WILLRStream, float64, error)

WILLROpen opens a live WILLRStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.WILLR writes there.

inHigh, inLow and inClose are the histories, of one length; the parameters are those of Core.WILLR.

The error is InsufficientHistory for a history of at most Core.WILLRLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) WILLROpenAndFill

func (c *Core) WILLROpenAndFill(inHigh, inLow, inClose []float64, optInTimePeriod int, outReal []float64) (*WILLRStream, OutRange, error)

WILLROpenAndFill opens a stream as Core.WILLROpen does and also writes the outputs over the whole history, as Core.WILLR writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.WILLRLookback values and share no memory with an input or another output.

The errors are those of Core.WILLROpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) WMA

func (c *Core) WMA(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

WMA computes the Weighted Moving Average over bars startIdx through endIdx.

Linearly weighted moving average: each of the last N prices is weighted by its position, oldest getting weight 1 and newest weight N. Smooths price while emphasizing recent bars.

Formula and more info at https://ta-lib.org/functions/wma.

Inputs, each at least endIdx+1 long:

  • inReal: Source price/data series.

Parameters:

  • optInTimePeriod: Number of bars in the weighting window. Default 30; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Weighted moving average series.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.WMALookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.WMA(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
223 values from bar 29: [92.6000, ..., 100.1935]

func (*Core) WMADisplayShift

func (c *Core) WMADisplayShift(optInTimePeriod, outputIdx int) (int, error)

WMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.WMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.WMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.WMALookback rejects or an index that names no output.

func (*Core) WMALookback

func (c *Core) WMALookback(optInTimePeriod int) (int, error)

WMALookback returns how many leading bars Core.WMA consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.WMA and returns BadParam for one out of range.

func (*Core) WMAOpen

func (c *Core) WMAOpen(inReal []float64, optInTimePeriod int) (*WMAStream, float64, error)

WMAOpen opens a live WMAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.WMA writes there.

inReal is the history; the parameters are those of Core.WMA.

The error is InsufficientHistory for a history of at most Core.WMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) WMAOpenAndFill

func (c *Core) WMAOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*WMAStream, OutRange, error)

WMAOpenAndFill opens a stream as Core.WMAOpen does and also writes the outputs over the whole history, as Core.WMA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.WMALookback values and share no memory with an input or another output.

The errors are those of Core.WMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ZIGZAG

func (c *Core) ZIGZAG(startIdx, endIdx int, inHigh, inLow []float64, optInSensitivity float64, optInMinTrendLength int, outZigZag []float64, outTrend, outPivotIdx []int32) (OutRange, error)

ZIGZAG computes the Zig Zag over bars startIdx through endIdx.

The percent-filter swing line. A leg runs from the last confirmed pivot to the most extreme price since it, and it reverses only when price moves at least optInSensitivity percent away from that extreme and at least optInMinTrendLength bars have passed since the pivot's own bar. Achelis describes the chart form and warns that "the last 'leg' displayed in a Zig Zag chart can change".

Formula and more info at https://ta-lib.org/functions/zigzag.

Inputs, each at least endIdx+1 long:

  • inHigh: High price of each bar.
  • inLow: Low price of each bar.

Parameters:

  • optInSensitivity: Minimum move away from the current extreme that reverses the leg, in percent. Default 5; range 0 to 100; RealDefault selects the default.
  • optInMinTrendLength: Minimum number of bars between two pivots. Default 1; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outZigZag: Price of the swing extreme currently being tracked.
  • outTrend: +1 while the leg is up, -1 while it is down.
  • outPivotIdx: Absolute index, into the input, of the bar that extreme sits on.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ZIGZAGLookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	high := make([]float64, 252) // your data, oldest first
	for i := range high {
		high[i] = 92 + float64((i%40-20)*(i%40-20)+(i%13-6)*(i%13-6))/20
	}
	low := make([]float64, 252) // your data, oldest first
	for i := range low {
		low[i] = 88 + float64((i%40-20)*(i%40-20)-(i%13-6)*(i%13-6))/20
	}
	zigZag := make([]float64, 252)
	trend := make([]int32, 252)
	pivotIdx := make([]int32, 252)

	core := talib.NewCore()
	r, err := core.ZIGZAG(0, len(high)-1, high, low, 5, 1, zigZag, trend, pivotIdx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
	fmt.Printf("zigZag = [%.4f, ..., %.4f]\n", zigZag[0], zigZag[r.NBElement-1])
	fmt.Printf("trend = [%d, ..., %d]\n", trend[0], trend[r.NBElement-1])
	fmt.Printf("pivotIdx = [%d, ..., %d]\n", pivotIdx[0], pivotIdx[r.NBElement-1])
}
Output:
251 values from bar 1:
zigZag = [104.8000, ..., 91.8500]
trend = [-1, ..., -1]
pivotIdx = [1, ..., 251]

func (*Core) ZIGZAGDisplayShift

func (c *Core) ZIGZAGDisplayShift(optInSensitivity float64, optInMinTrendLength, outputIdx int) (int, error)

ZIGZAGDisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ZIGZAG. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ZIGZAG followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ZIGZAGLookback rejects or an index that names no output.

func (*Core) ZIGZAGLookback

func (c *Core) ZIGZAGLookback(optInSensitivity float64, optInMinTrendLength int) (int, error)

ZIGZAGLookback returns how many leading bars Core.ZIGZAG consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ZIGZAG and returns BadParam for one out of range.

func (*Core) ZIGZAGOpen

func (c *Core) ZIGZAGOpen(inHigh, inLow []float64, optInSensitivity float64, optInMinTrendLength int) (*ZIGZAGStream, float64, int32, int32, error)

ZIGZAGOpen opens a live ZIGZAGStream on a warm-up history, oldest bar first, and returns it with its values at the last history bar (outZigZag, outTrend and outPivotIdx), the values Core.ZIGZAG writes there.

inHigh and inLow are the histories, of one length; the parameters are those of Core.ZIGZAG.

The error is InsufficientHistory for a history of at most Core.ZIGZAGLookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range or histories of different lengths.

func (*Core) ZIGZAGOpenAndFill

func (c *Core) ZIGZAGOpenAndFill(inHigh, inLow []float64, optInSensitivity float64, optInMinTrendLength int, outZigZag []float64, outTrend, outPivotIdx []int32) (*ZIGZAGStream, OutRange, error)

ZIGZAGOpenAndFill opens a stream as Core.ZIGZAGOpen does and also writes the outputs over the whole history, as Core.ZIGZAG writes them for bars 0 through len(inHigh)-1, returning that range.

Each output must hold len(inHigh) minus Core.ZIGZAGLookback values and share no memory with an input or another output.

The errors are those of Core.ZIGZAGOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

func (*Core) ZLEMA

func (c *Core) ZLEMA(startIdx, endIdx int, inReal []float64, optInTimePeriod int, outReal []float64) (OutRange, error)

ZLEMA computes the Zero-Lag Exponential Moving Average over bars startIdx through endIdx.

Zero-Lag Exponential Moving Average: an Core.EMA applied not to price but to a de-lagged series that extrapolates price forward by the EMA's own lag, cancelling that lag to first order. It tracks a trend far more closely than an EMA of the same length, at the cost of overshooting sharp reversals — the extrapolation keeps pushing in the old direction for a bar or two. Read it as an EMA that turns sooner: crossings of price and average, and changes in its slope, arrive earlier than the equivalent EMA signal, and its overshoot after a spike is a property of the filter rather than a move in the market.

Formula and more info at https://ta-lib.org/functions/zlema.

Inputs, each at least endIdx+1 long:

  • inReal: Source price series, close by convention.

Parameters:

  • optInTimePeriod: Number of bars in the exponential average; the de-lag distance derives from it. Default 30; range 1 to 100000; IntegerDefault selects the default.

Outputs, each at least as long as the values written (the input length always suffices):

  • outReal: Zero-lag exponential moving average of the input.

Element k of each output is the value at bar BegIdx+k of the returned OutRange, and BegIdx is at least Core.ZLEMALookback: a range that ends before it returns NBElement 0.

A real output may be one of the inputs, the same slice, to compute in place; outputs may not otherwise share memory with an input or with each other.

The error is OutOfRangeStartIndex or OutOfRangeEndIndex for a range outside 0 to IndexMax or ending before it starts, and BadParam for a parameter out of range, an input too short, an output empty or too short or memory shared otherwise. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

Example
package main

import (
	"fmt"
	"log"

	talib "ta-lib.github.io/go"
)

func main() {
	series := make([]float64, 252) // your data, oldest first
	for i := range series {
		series[i] = 90 + float64((i%40-20)*(i%40-20))/20
	}
	out := make([]float64, 252)

	core := talib.NewCore()
	r, err := core.ZLEMA(0, len(series)-1, series, 30, out)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])
}
Output:
209 values from bar 43: [97.8583, ..., 101.5795]

func (*Core) ZLEMADisplayShift

func (c *Core) ZLEMADisplayShift(optInTimePeriod, outputIdx int) (int, error)

ZLEMADisplayShift returns how many bars ahead (positive) or behind (negative) of the bar that computed it a chart draws output outputIdx of Core.ZLEMA. The values are never shifted.

Every output of this function is drawn at its own bar, so the answer is 0.

It takes the parameters of Core.ZLEMA followed by the output's position among its outputs, from 0, and returns BadParam for a parameter Core.ZLEMALookback rejects or an index that names no output.

func (*Core) ZLEMALookback

func (c *Core) ZLEMALookback(optInTimePeriod int) (int, error)

ZLEMALookback returns how many leading bars Core.ZLEMA consumes before its first value: called with startIdx 0, its first value is at that bar.

It takes the parameters of Core.ZLEMA and returns BadParam for one out of range.

func (*Core) ZLEMAOpen

func (c *Core) ZLEMAOpen(inReal []float64, optInTimePeriod int) (*ZLEMAStream, float64, error)

ZLEMAOpen opens a live ZLEMAStream on a warm-up history, oldest bar first, and returns it with its value at the last history bar, the value Core.ZLEMA writes there.

inReal is the history; the parameters are those of Core.ZLEMA.

The error is InsufficientHistory for a history of at most Core.ZLEMALookback bars, OutOfRangeEndIndex for one longer than [IndexMax]+1 bars, and BadParam for a parameter out of range.

func (*Core) ZLEMAOpenAndFill

func (c *Core) ZLEMAOpenAndFill(inReal []float64, optInTimePeriod int, outReal []float64) (*ZLEMAStream, OutRange, error)

ZLEMAOpenAndFill opens a stream as Core.ZLEMAOpen does and also writes the outputs over the whole history, as Core.ZLEMA writes them for bars 0 through len(inReal)-1, returning that range.

Each output must hold len(inReal) minus Core.ZLEMALookback values and share no memory with an input or another output.

The errors are those of Core.ZLEMAOpen, and BadParam for an output that is empty, too short or sharing memory. A slice whose capacity a three-index expression cut, as slices.Clip does, can escape the sharing check.

type DEMAStream

type DEMAStream struct {
	// contains filtered or unexported fields
}

DEMAStream is a live DEMA over a growing series: DEMAStream.Update takes each new closed bar and returns the value Core.DEMA computes at that bar over the same series. Open one with Core.DEMAOpen or Core.DEMAOpenAndFill.

A stream belongs to one goroutine; DEMAStream.Clone forks it.

func (*DEMAStream) Advance

func (sp *DEMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*DEMAStream) Clone

func (sp *DEMAStream) Clone() *DEMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*DEMAStream) OutRange

func (sp *DEMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.DEMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*DEMAStream) Peek

func (sp *DEMAStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*DEMAStream) Update

func (sp *DEMAStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*DEMAStream) Value

func (sp *DEMAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type DIVStream

type DIVStream struct {
	// contains filtered or unexported fields
}

DIVStream is a live DIV over a growing series: DIVStream.Update takes each new closed bar and returns the value Core.DIV computes at that bar over the same series. Open one with Core.DIVOpen or Core.DIVOpenAndFill.

A stream belongs to one goroutine; DIVStream.Clone forks it.

func (*DIVStream) Advance

func (sp *DIVStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*DIVStream) Clone

func (sp *DIVStream) Clone() *DIVStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*DIVStream) OutRange

func (sp *DIVStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.DIV reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*DIVStream) Peek

func (sp *DIVStream) Peek(inReal0, inReal1 float64) (float64, error)

Peek returns what Update would return for the bar (inReal0 and inReal1), changing nothing. It returns BadParam for a bar value that is not finite.

func (*DIVStream) Update

func (sp *DIVStream) Update(inReal0, inReal1 float64) (float64, error)

Update commits one closed bar (inReal0 and inReal1) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*DIVStream) Value

func (sp *DIVStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type DONCHIANStream

type DONCHIANStream struct {
	// contains filtered or unexported fields
}

DONCHIANStream is a live DONCHIAN over a growing series: DONCHIANStream.Update takes each new closed bar and returns the values Core.DONCHIAN computes at that bar over the same series. Open one with Core.DONCHIANOpen or Core.DONCHIANOpenAndFill.

A stream belongs to one goroutine; DONCHIANStream.Clone forks it.

func (*DONCHIANStream) Advance

func (sp *DONCHIANStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*DONCHIANStream) Clone

func (sp *DONCHIANStream) Clone() *DONCHIANStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*DONCHIANStream) OutRange

func (sp *DONCHIANStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.DONCHIAN reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*DONCHIANStream) Peek

func (sp *DONCHIANStream) Peek(inHigh, inLow float64) (float64, float64, float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*DONCHIANStream) Update

func (sp *DONCHIANStream) Update(inHigh, inLow float64) (float64, float64, float64, error)

Update commits one closed bar (inHigh and inLow) and returns its outputs: outRealUpperBand, outRealMiddleBand and outRealLowerBand. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*DONCHIANStream) Value

func (sp *DONCHIANStream) Value() (float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type DOSCStream

type DOSCStream struct {
	// contains filtered or unexported fields
}

DOSCStream is a live DOSC over a growing series: DOSCStream.Update takes each new closed bar and returns the value Core.DOSC computes at that bar over the same series. Open one with Core.DOSCOpen or Core.DOSCOpenAndFill.

A stream belongs to one goroutine; DOSCStream.Clone forks it.

func (*DOSCStream) Advance

func (sp *DOSCStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*DOSCStream) Clone

func (sp *DOSCStream) Clone() *DOSCStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*DOSCStream) OutRange

func (sp *DOSCStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.DOSC reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*DOSCStream) Peek

func (sp *DOSCStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*DOSCStream) Update

func (sp *DOSCStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*DOSCStream) Value

func (sp *DOSCStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type DPOStream

type DPOStream struct {
	// contains filtered or unexported fields
}

DPOStream is a live DPO over a growing series: DPOStream.Update takes each new closed bar and returns the value Core.DPO computes at that bar over the same series. Open one with Core.DPOOpen or Core.DPOOpenAndFill.

A stream belongs to one goroutine; DPOStream.Clone forks it.

func (*DPOStream) Advance

func (sp *DPOStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*DPOStream) Clone

func (sp *DPOStream) Clone() *DPOStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*DPOStream) OutRange

func (sp *DPOStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.DPO reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*DPOStream) Peek

func (sp *DPOStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*DPOStream) Update

func (sp *DPOStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*DPOStream) Value

func (sp *DPOStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type DXStream

type DXStream struct {
	// contains filtered or unexported fields
}

DXStream is a live DX over a growing series: DXStream.Update takes each new closed bar and returns the value Core.DX computes at that bar over the same series. Open one with Core.DXOpen or Core.DXOpenAndFill.

A stream belongs to one goroutine; DXStream.Clone forks it.

func (*DXStream) Advance

func (sp *DXStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*DXStream) Clone

func (sp *DXStream) Clone() *DXStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*DXStream) OutRange

func (sp *DXStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.DX reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*DXStream) Peek

func (sp *DXStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*DXStream) Update

func (sp *DXStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*DXStream) Value

func (sp *DXStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type EFIStream

type EFIStream struct {
	// contains filtered or unexported fields
}

EFIStream is a live EFI over a growing series: EFIStream.Update takes each new closed bar and returns the value Core.EFI computes at that bar over the same series. Open one with Core.EFIOpen or Core.EFIOpenAndFill.

A stream belongs to one goroutine; EFIStream.Clone forks it.

func (*EFIStream) Advance

func (sp *EFIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*EFIStream) Clone

func (sp *EFIStream) Clone() *EFIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*EFIStream) OutRange

func (sp *EFIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.EFI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*EFIStream) Peek

func (sp *EFIStream) Peek(inClose, inVolume float64) (float64, error)

Peek returns what Update would return for the bar (inClose and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*EFIStream) Update

func (sp *EFIStream) Update(inClose, inVolume float64) (float64, error)

Update commits one closed bar (inClose and inVolume) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*EFIStream) Value

func (sp *EFIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type EMAStream

type EMAStream struct {
	// contains filtered or unexported fields
}

EMAStream is a live EMA over a growing series: EMAStream.Update takes each new closed bar and returns the value Core.EMA computes at that bar over the same series. Open one with Core.EMAOpen or Core.EMAOpenAndFill.

A stream belongs to one goroutine; EMAStream.Clone forks it.

func (*EMAStream) Advance

func (sp *EMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*EMAStream) Clone

func (sp *EMAStream) Clone() *EMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*EMAStream) OutRange

func (sp *EMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.EMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*EMAStream) Peek

func (sp *EMAStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*EMAStream) Update

func (sp *EMAStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*EMAStream) Value

func (sp *EMAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type EMAVariation

type EMAVariation int32

EMAVariation selects how the EMA family is seeded; see Core.SetEMAVariation.

const (
	EMAVariationSmaSeed      EMAVariation = 0
	EMAVariationFirstBarSeed EMAVariation = 1
)

The EMAVariation members.

type EMVStream

type EMVStream struct {
	// contains filtered or unexported fields
}

EMVStream is a live EMV over a growing series: EMVStream.Update takes each new closed bar and returns the value Core.EMV computes at that bar over the same series. Open one with Core.EMVOpen or Core.EMVOpenAndFill.

A stream belongs to one goroutine; EMVStream.Clone forks it.

func (*EMVStream) Advance

func (sp *EMVStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*EMVStream) Clone

func (sp *EMVStream) Clone() *EMVStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*EMVStream) OutRange

func (sp *EMVStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.EMV reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*EMVStream) Peek

func (sp *EMVStream) Peek(inHigh, inLow, inVolume float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*EMVStream) Update

func (sp *EMVStream) Update(inHigh, inLow, inVolume float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inVolume) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*EMVStream) Value

func (sp *EMVStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ERIStream

type ERIStream struct {
	// contains filtered or unexported fields
}

ERIStream is a live ERI over a growing series: ERIStream.Update takes each new closed bar and returns the values Core.ERI computes at that bar over the same series. Open one with Core.ERIOpen or Core.ERIOpenAndFill.

A stream belongs to one goroutine; ERIStream.Clone forks it.

func (*ERIStream) Advance

func (sp *ERIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ERIStream) Clone

func (sp *ERIStream) Clone() *ERIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ERIStream) OutRange

func (sp *ERIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ERI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ERIStream) Peek

func (sp *ERIStream) Peek(inHigh, inLow, inClose float64) (float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ERIStream) Update

func (sp *ERIStream) Update(inHigh, inLow, inClose float64) (float64, float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outBullPower and outBearPower. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ERIStream) Value

func (sp *ERIStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type ERStream

type ERStream struct {
	// contains filtered or unexported fields
}

ERStream is a live ER over a growing series: ERStream.Update takes each new closed bar and returns the value Core.ER computes at that bar over the same series. Open one with Core.EROpen or Core.EROpenAndFill.

A stream belongs to one goroutine; ERStream.Clone forks it.

func (*ERStream) Advance

func (sp *ERStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ERStream) Clone

func (sp *ERStream) Clone() *ERStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ERStream) OutRange

func (sp *ERStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ER reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ERStream) Peek

func (sp *ERStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*ERStream) Update

func (sp *ERStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ERStream) Value

func (sp *ERStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type EXPStream

type EXPStream struct {
	// contains filtered or unexported fields
}

EXPStream is a live EXP over a growing series: EXPStream.Update takes each new closed bar and returns the value Core.EXP computes at that bar over the same series. Open one with Core.EXPOpen or Core.EXPOpenAndFill.

A stream belongs to one goroutine; EXPStream.Clone forks it.

func (*EXPStream) Advance

func (sp *EXPStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*EXPStream) Clone

func (sp *EXPStream) Clone() *EXPStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*EXPStream) OutRange

func (sp *EXPStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.EXP reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*EXPStream) Peek

func (sp *EXPStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*EXPStream) Update

func (sp *EXPStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*EXPStream) Value

func (sp *EXPStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type FISHERStream

type FISHERStream struct {
	// contains filtered or unexported fields
}

FISHERStream is a live FISHER over a growing series: FISHERStream.Update takes each new closed bar and returns the values Core.FISHER computes at that bar over the same series. Open one with Core.FISHEROpen or Core.FISHEROpenAndFill.

A stream belongs to one goroutine; FISHERStream.Clone forks it.

func (*FISHERStream) Advance

func (sp *FISHERStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*FISHERStream) Clone

func (sp *FISHERStream) Clone() *FISHERStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*FISHERStream) OutRange

func (sp *FISHERStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.FISHER reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*FISHERStream) Peek

func (sp *FISHERStream) Peek(inHigh, inLow float64) (float64, float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*FISHERStream) Update

func (sp *FISHERStream) Update(inHigh, inLow float64) (float64, float64, error)

Update commits one closed bar (inHigh and inLow) and returns its outputs: outFisher and outTrigger. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*FISHERStream) Value

func (sp *FISHERStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type FLOORStream

type FLOORStream struct {
	// contains filtered or unexported fields
}

FLOORStream is a live FLOOR over a growing series: FLOORStream.Update takes each new closed bar and returns the value Core.FLOOR computes at that bar over the same series. Open one with Core.FLOOROpen or Core.FLOOROpenAndFill.

A stream belongs to one goroutine; FLOORStream.Clone forks it.

func (*FLOORStream) Advance

func (sp *FLOORStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*FLOORStream) Clone

func (sp *FLOORStream) Clone() *FLOORStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*FLOORStream) OutRange

func (sp *FLOORStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.FLOOR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*FLOORStream) Peek

func (sp *FLOORStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*FLOORStream) Update

func (sp *FLOORStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*FLOORStream) Value

func (sp *FLOORStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type FOSCStream

type FOSCStream struct {
	SumX    float64
	SumXY   float64
	SumY    float64
	Divisor float64
	// contains filtered or unexported fields
}

FOSCStream is a live FOSC over a growing series: FOSCStream.Update takes each new closed bar and returns the value Core.FOSC computes at that bar over the same series. Open one with Core.FOSCOpen or Core.FOSCOpenAndFill.

A stream belongs to one goroutine; FOSCStream.Clone forks it.

func (*FOSCStream) Advance

func (sp *FOSCStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*FOSCStream) Clone

func (sp *FOSCStream) Clone() *FOSCStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*FOSCStream) OutRange

func (sp *FOSCStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.FOSC reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*FOSCStream) Peek

func (sp *FOSCStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*FOSCStream) Update

func (sp *FOSCStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*FOSCStream) Value

func (sp *FOSCStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type FRACTALStream

type FRACTALStream struct {
	// contains filtered or unexported fields
}

FRACTALStream is a live FRACTAL over a growing series: FRACTALStream.Update takes each new closed bar and returns the values Core.FRACTAL computes at that bar over the same series. Open one with Core.FRACTALOpen or Core.FRACTALOpenAndFill.

A stream belongs to one goroutine; FRACTALStream.Clone forks it.

func (*FRACTALStream) Advance

func (sp *FRACTALStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*FRACTALStream) Clone

func (sp *FRACTALStream) Clone() *FRACTALStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*FRACTALStream) OutRange

func (sp *FRACTALStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.FRACTAL reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*FRACTALStream) Peek

func (sp *FRACTALStream) Peek(inHigh, inLow float64) (int32, int32, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*FRACTALStream) Update

func (sp *FRACTALStream) Update(inHigh, inLow float64) (int32, int32, error)

Update commits one closed bar (inHigh and inLow) and returns its outputs: outSwingHigh and outSwingLow. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*FRACTALStream) Value

func (sp *FRACTALStream) Value() (int32, int32)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type FRAMAStream

type FRAMAStream struct {
	// contains filtered or unexported fields
}

FRAMAStream is a live FRAMA over a growing series: FRAMAStream.Update takes each new closed bar and returns the value Core.FRAMA computes at that bar over the same series. Open one with Core.FRAMAOpen or Core.FRAMAOpenAndFill.

A stream belongs to one goroutine; FRAMAStream.Clone forks it.

func (*FRAMAStream) Advance

func (sp *FRAMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*FRAMAStream) Clone

func (sp *FRAMAStream) Clone() *FRAMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*FRAMAStream) OutRange

func (sp *FRAMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.FRAMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*FRAMAStream) Peek

func (sp *FRAMAStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*FRAMAStream) Update

func (sp *FRAMAStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*FRAMAStream) Value

func (sp *FRAMAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type FuncUnstId

type FuncUnstId int32

FuncUnstId names a function whose unstable period can be set.

const (
	FuncUnstIdADX          FuncUnstId = 0
	FuncUnstIdATR          FuncUnstId = 2
	FuncUnstIdCMO          FuncUnstId = 3
	FuncUnstIdDX           FuncUnstId = 4
	FuncUnstIdEMA          FuncUnstId = 5
	FuncUnstIdHT_DCPERIOD  FuncUnstId = 6
	FuncUnstIdHT_DCPHASE   FuncUnstId = 7
	FuncUnstIdHT_PHASOR    FuncUnstId = 8
	FuncUnstIdHT_SINE      FuncUnstId = 9
	FuncUnstIdHT_TRENDLINE FuncUnstId = 10
	FuncUnstIdHT_TRENDMODE FuncUnstId = 11
	FuncUnstIdKAMA         FuncUnstId = 13
	FuncUnstIdMAMA         FuncUnstId = 14
	FuncUnstIdMINUS_DI     FuncUnstId = 16
	FuncUnstIdMINUS_DM     FuncUnstId = 17
	FuncUnstIdNATR         FuncUnstId = 18
	FuncUnstIdPLUS_DI      FuncUnstId = 19
	FuncUnstIdPLUS_DM      FuncUnstId = 20
	FuncUnstIdRSI          FuncUnstId = 21
	FuncUnstIdT3           FuncUnstId = 23
	FuncUnstIdRMA          FuncUnstId = 24
	FuncUnstIdHA           FuncUnstId = 25
	FuncUnstIdRVI          FuncUnstId = 26
	FuncUnstIdFRAMA        FuncUnstId = 27
	FuncUnstIdMCGD         FuncUnstId = 28
	FuncUnstIdVIDYA        FuncUnstId = 29
	FuncUnstIdSTC          FuncUnstId = 30
	FuncUnstIdSWAK_GAUSS   FuncUnstId = 31
	FuncUnstIdSWAK_BUTTER  FuncUnstId = 32
	FuncUnstIdSWAK_HP      FuncUnstId = 33
	FuncUnstIdSWAK_2PHP    FuncUnstId = 34
	FuncUnstIdSWAK_BP      FuncUnstId = 35
	FuncUnstIdFISHER       FuncUnstId = 36
	FuncUnstIdSSF          FuncUnstId = 37
	FuncUnstIdALL          FuncUnstId = 65535
)

The FuncUnstId members.

type GATORStream

type GATORStream struct {
	// contains filtered or unexported fields
}

GATORStream is a live GATOR over a growing series: GATORStream.Update takes each new closed bar and returns the values Core.GATOR computes at that bar over the same series. Open one with Core.GATOROpen or Core.GATOROpenAndFill.

A stream belongs to one goroutine; GATORStream.Clone forks it.

func (*GATORStream) Advance

func (sp *GATORStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*GATORStream) Clone

func (sp *GATORStream) Clone() *GATORStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*GATORStream) OutRange

func (sp *GATORStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.GATOR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*GATORStream) Peek

func (sp *GATORStream) Peek(inHigh, inLow float64) (float64, float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*GATORStream) Update

func (sp *GATORStream) Update(inHigh, inLow float64) (float64, float64, error)

Update commits one closed bar (inHigh and inLow) and returns its outputs: outUpper and outLower. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*GATORStream) Value

func (sp *GATORStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type HAStream

type HAStream struct {
	// contains filtered or unexported fields
}

HAStream is a live HA over a growing series: HAStream.Update takes each new closed bar and returns the values Core.HA computes at that bar over the same series. Open one with Core.HAOpen or Core.HAOpenAndFill.

A stream belongs to one goroutine; HAStream.Clone forks it.

func (*HAStream) Advance

func (sp *HAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*HAStream) Clone

func (sp *HAStream) Clone() *HAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*HAStream) OutRange

func (sp *HAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.HA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*HAStream) Peek

func (sp *HAStream) Peek(inOpen, inHigh, inLow, inClose float64) (float64, float64, float64, float64, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*HAStream) Update

func (sp *HAStream) Update(inOpen, inHigh, inLow, inClose float64) (float64, float64, float64, float64, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns its outputs: outHAOpen, outHAHigh, outHALow and outHAClose. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*HAStream) Value

func (sp *HAStream) Value() (float64, float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type HMAStream

type HMAStream struct {
	// contains filtered or unexported fields
}

HMAStream is a live HMA over a growing series: HMAStream.Update takes each new closed bar and returns the value Core.HMA computes at that bar over the same series. Open one with Core.HMAOpen or Core.HMAOpenAndFill.

A stream belongs to one goroutine; HMAStream.Clone forks it.

func (*HMAStream) Advance

func (sp *HMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*HMAStream) Clone

func (sp *HMAStream) Clone() *HMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*HMAStream) OutRange

func (sp *HMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.HMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*HMAStream) Peek

func (sp *HMAStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*HMAStream) Update

func (sp *HMAStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*HMAStream) Value

func (sp *HMAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type HT_DCPERIODStream

type HT_DCPERIODStream struct {
	Q1_Odd  [3]float64
	Q1_Even [3]float64

	Re             float64
	Im             float64
	I1ForOddPrev2  float64
	I1ForOddPrev3  float64
	I1ForEvenPrev2 float64
	I1ForEvenPrev3 float64
	// contains filtered or unexported fields
}

HT_DCPERIODStream is a live HT_DCPERIOD over a growing series: HT_DCPERIODStream.Update takes each new closed bar and returns the value Core.HT_DCPERIOD computes at that bar over the same series. Open one with Core.HT_DCPERIODOpen or Core.HT_DCPERIODOpenAndFill.

A stream belongs to one goroutine; HT_DCPERIODStream.Clone forks it.

func (*HT_DCPERIODStream) Advance

func (sp *HT_DCPERIODStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*HT_DCPERIODStream) Clone

func (sp *HT_DCPERIODStream) Clone() *HT_DCPERIODStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*HT_DCPERIODStream) OutRange

func (sp *HT_DCPERIODStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.HT_DCPERIOD reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*HT_DCPERIODStream) Peek

func (sp *HT_DCPERIODStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*HT_DCPERIODStream) Update

func (sp *HT_DCPERIODStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*HT_DCPERIODStream) Value

func (sp *HT_DCPERIODStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type HT_DCPHASEStream

type HT_DCPHASEStream struct {
	Q1_Odd  [3]float64
	Q1_Even [3]float64

	Re             float64
	Im             float64
	I1ForOddPrev2  float64
	I1ForOddPrev3  float64
	I1ForEvenPrev2 float64
	I1ForEvenPrev3 float64

	DCPhase float64
	// contains filtered or unexported fields
}

HT_DCPHASEStream is a live HT_DCPHASE over a growing series: HT_DCPHASEStream.Update takes each new closed bar and returns the value Core.HT_DCPHASE computes at that bar over the same series. Open one with Core.HT_DCPHASEOpen or Core.HT_DCPHASEOpenAndFill.

A stream belongs to one goroutine; HT_DCPHASEStream.Clone forks it.

func (*HT_DCPHASEStream) Advance

func (sp *HT_DCPHASEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*HT_DCPHASEStream) Clone

func (sp *HT_DCPHASEStream) Clone() *HT_DCPHASEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*HT_DCPHASEStream) OutRange

func (sp *HT_DCPHASEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.HT_DCPHASE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*HT_DCPHASEStream) Peek

func (sp *HT_DCPHASEStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*HT_DCPHASEStream) Update

func (sp *HT_DCPHASEStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*HT_DCPHASEStream) Value

func (sp *HT_DCPHASEStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type HT_PHASORStream

type HT_PHASORStream struct {
	Q1_Odd  [3]float64
	Q1_Even [3]float64

	Re             float64
	Im             float64
	I1ForOddPrev2  float64
	I1ForOddPrev3  float64
	I1ForEvenPrev2 float64
	I1ForEvenPrev3 float64
	// contains filtered or unexported fields
}

HT_PHASORStream is a live HT_PHASOR over a growing series: HT_PHASORStream.Update takes each new closed bar and returns the values Core.HT_PHASOR computes at that bar over the same series. Open one with Core.HT_PHASOROpen or Core.HT_PHASOROpenAndFill.

A stream belongs to one goroutine; HT_PHASORStream.Clone forks it.

func (*HT_PHASORStream) Advance

func (sp *HT_PHASORStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*HT_PHASORStream) Clone

func (sp *HT_PHASORStream) Clone() *HT_PHASORStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*HT_PHASORStream) OutRange

func (sp *HT_PHASORStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.HT_PHASOR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*HT_PHASORStream) Peek

func (sp *HT_PHASORStream) Peek(inReal float64) (float64, float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*HT_PHASORStream) Update

func (sp *HT_PHASORStream) Update(inReal float64) (float64, float64, error)

Update commits the closed bar inReal and returns its outputs: outInPhase and outQuadrature. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*HT_PHASORStream) Value

func (sp *HT_PHASORStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type HT_SINEStream

type HT_SINEStream struct {
	Q1_Odd  [3]float64
	Q1_Even [3]float64

	Re             float64
	Im             float64
	I1ForOddPrev2  float64
	I1ForOddPrev3  float64
	I1ForEvenPrev2 float64
	I1ForEvenPrev3 float64

	DCPhase float64
	// contains filtered or unexported fields
}

HT_SINEStream is a live HT_SINE over a growing series: HT_SINEStream.Update takes each new closed bar and returns the values Core.HT_SINE computes at that bar over the same series. Open one with Core.HT_SINEOpen or Core.HT_SINEOpenAndFill.

A stream belongs to one goroutine; HT_SINEStream.Clone forks it.

func (*HT_SINEStream) Advance

func (sp *HT_SINEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*HT_SINEStream) Clone

func (sp *HT_SINEStream) Clone() *HT_SINEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*HT_SINEStream) OutRange

func (sp *HT_SINEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.HT_SINE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*HT_SINEStream) Peek

func (sp *HT_SINEStream) Peek(inReal float64) (float64, float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*HT_SINEStream) Update

func (sp *HT_SINEStream) Update(inReal float64) (float64, float64, error)

Update commits the closed bar inReal and returns its outputs: outSine and outLeadSine. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*HT_SINEStream) Value

func (sp *HT_SINEStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type HT_TRENDLINEStream

type HT_TRENDLINEStream struct {
	Q1_Odd  [3]float64
	Q1_Even [3]float64

	Re             float64
	Im             float64
	I1ForOddPrev2  float64
	I1ForOddPrev3  float64
	I1ForEvenPrev2 float64
	I1ForEvenPrev3 float64
	// contains filtered or unexported fields
}

HT_TRENDLINEStream is a live HT_TRENDLINE over a growing series: HT_TRENDLINEStream.Update takes each new closed bar and returns the value Core.HT_TRENDLINE computes at that bar over the same series. Open one with Core.HT_TRENDLINEOpen or Core.HT_TRENDLINEOpenAndFill.

A stream belongs to one goroutine; HT_TRENDLINEStream.Clone forks it.

func (*HT_TRENDLINEStream) Advance

func (sp *HT_TRENDLINEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*HT_TRENDLINEStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*HT_TRENDLINEStream) OutRange

func (sp *HT_TRENDLINEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.HT_TRENDLINE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*HT_TRENDLINEStream) Peek

func (sp *HT_TRENDLINEStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*HT_TRENDLINEStream) Update

func (sp *HT_TRENDLINEStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*HT_TRENDLINEStream) Value

func (sp *HT_TRENDLINEStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type HT_TRENDMODEStream

type HT_TRENDMODEStream struct {
	Q1_Odd  [3]float64
	Q1_Even [3]float64

	Re             float64
	Im             float64
	I1ForOddPrev2  float64
	I1ForOddPrev3  float64
	I1ForEvenPrev2 float64
	I1ForEvenPrev3 float64

	DCPhase float64
	// contains filtered or unexported fields
}

HT_TRENDMODEStream is a live HT_TRENDMODE over a growing series: HT_TRENDMODEStream.Update takes each new closed bar and returns the value Core.HT_TRENDMODE computes at that bar over the same series. Open one with Core.HT_TRENDMODEOpen or Core.HT_TRENDMODEOpenAndFill.

A stream belongs to one goroutine; HT_TRENDMODEStream.Clone forks it.

func (*HT_TRENDMODEStream) Advance

func (sp *HT_TRENDMODEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*HT_TRENDMODEStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*HT_TRENDMODEStream) OutRange

func (sp *HT_TRENDMODEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.HT_TRENDMODE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*HT_TRENDMODEStream) Peek

func (sp *HT_TRENDMODEStream) Peek(inReal float64) (int32, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*HT_TRENDMODEStream) Update

func (sp *HT_TRENDMODEStream) Update(inReal float64) (int32, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*HT_TRENDMODEStream) Value

func (sp *HT_TRENDMODEStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type IBSStream

type IBSStream struct {
	// contains filtered or unexported fields
}

IBSStream is a live IBS over a growing series: IBSStream.Update takes each new closed bar and returns the value Core.IBS computes at that bar over the same series. Open one with Core.IBSOpen or Core.IBSOpenAndFill.

A stream belongs to one goroutine; IBSStream.Clone forks it.

func (*IBSStream) Advance

func (sp *IBSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*IBSStream) Clone

func (sp *IBSStream) Clone() *IBSStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*IBSStream) OutRange

func (sp *IBSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.IBS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*IBSStream) Peek

func (sp *IBSStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*IBSStream) Update

func (sp *IBSStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*IBSStream) Value

func (sp *IBSStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ICHIMOKUStream

type ICHIMOKUStream struct {
	// contains filtered or unexported fields
}

ICHIMOKUStream is a live ICHIMOKU over a growing series: ICHIMOKUStream.Update takes each new closed bar and returns the values Core.ICHIMOKU computes at that bar over the same series. Open one with Core.ICHIMOKUOpen or Core.ICHIMOKUOpenAndFill.

A stream belongs to one goroutine; ICHIMOKUStream.Clone forks it.

func (*ICHIMOKUStream) Advance

func (sp *ICHIMOKUStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ICHIMOKUStream) Clone

func (sp *ICHIMOKUStream) Clone() *ICHIMOKUStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ICHIMOKUStream) OutRange

func (sp *ICHIMOKUStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ICHIMOKU reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ICHIMOKUStream) Peek

func (sp *ICHIMOKUStream) Peek(inHigh, inLow float64) (float64, float64, float64, float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ICHIMOKUStream) Update

func (sp *ICHIMOKUStream) Update(inHigh, inLow float64) (float64, float64, float64, float64, error)

Update commits one closed bar (inHigh and inLow) and returns its outputs: outTenkanSen, outKijunSen, outSenkouSpanA and outSenkouSpanB. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ICHIMOKUStream) Value

func (sp *ICHIMOKUStream) Value() (float64, float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type IMIStream

type IMIStream struct {
	// contains filtered or unexported fields
}

IMIStream is a live IMI over a growing series: IMIStream.Update takes each new closed bar and returns the value Core.IMI computes at that bar over the same series. Open one with Core.IMIOpen or Core.IMIOpenAndFill.

A stream belongs to one goroutine; IMIStream.Clone forks it.

func (*IMIStream) Advance

func (sp *IMIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*IMIStream) Clone

func (sp *IMIStream) Clone() *IMIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*IMIStream) OutRange

func (sp *IMIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.IMI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*IMIStream) Peek

func (sp *IMIStream) Peek(inOpen, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inOpen and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*IMIStream) Update

func (sp *IMIStream) Update(inOpen, inClose float64) (float64, error)

Update commits one closed bar (inOpen and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*IMIStream) Value

func (sp *IMIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type KAMAStream

type KAMAStream struct {
	// contains filtered or unexported fields
}

KAMAStream is a live KAMA over a growing series: KAMAStream.Update takes each new closed bar and returns the value Core.KAMA computes at that bar over the same series. Open one with Core.KAMAOpen or Core.KAMAOpenAndFill.

A stream belongs to one goroutine; KAMAStream.Clone forks it.

func (*KAMAStream) Advance

func (sp *KAMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*KAMAStream) Clone

func (sp *KAMAStream) Clone() *KAMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*KAMAStream) OutRange

func (sp *KAMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.KAMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*KAMAStream) Peek

func (sp *KAMAStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*KAMAStream) Update

func (sp *KAMAStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*KAMAStream) Value

func (sp *KAMAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type KCStream

type KCStream struct {
	// contains filtered or unexported fields
}

KCStream is a live KC over a growing series: KCStream.Update takes each new closed bar and returns the values Core.KC computes at that bar over the same series. Open one with Core.KCOpen or Core.KCOpenAndFill.

A stream belongs to one goroutine; KCStream.Clone forks it.

func (*KCStream) Advance

func (sp *KCStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*KCStream) Clone

func (sp *KCStream) Clone() *KCStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*KCStream) OutRange

func (sp *KCStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.KC reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*KCStream) Peek

func (sp *KCStream) Peek(inHigh, inLow, inClose float64) (float64, float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*KCStream) Update

func (sp *KCStream) Update(inHigh, inLow, inClose float64) (float64, float64, float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outRealUpperBand, outRealMiddleBand and outRealLowerBand. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*KCStream) Value

func (sp *KCStream) Value() (float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type KDJStream

type KDJStream struct {
	// contains filtered or unexported fields
}

KDJStream is a live KDJ over a growing series: KDJStream.Update takes each new closed bar and returns the values Core.KDJ computes at that bar over the same series. Open one with Core.KDJOpen or Core.KDJOpenAndFill.

A stream belongs to one goroutine; KDJStream.Clone forks it.

func (*KDJStream) Advance

func (sp *KDJStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*KDJStream) Clone

func (sp *KDJStream) Clone() *KDJStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*KDJStream) OutRange

func (sp *KDJStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.KDJ reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*KDJStream) Peek

func (sp *KDJStream) Peek(inHigh, inLow, inClose float64) (float64, float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*KDJStream) Update

func (sp *KDJStream) Update(inHigh, inLow, inClose float64) (float64, float64, float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outK, outD and outJ. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*KDJStream) Value

func (sp *KDJStream) Value() (float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type KSTEXTStream

type KSTEXTStream struct {
	// contains filtered or unexported fields
}

KSTEXTStream is a live KSTEXT over a growing series: KSTEXTStream.Update takes each new closed bar and returns the values Core.KSTEXT computes at that bar over the same series. Open one with Core.KSTEXTOpen or Core.KSTEXTOpenAndFill.

A stream belongs to one goroutine; KSTEXTStream.Clone forks it.

func (*KSTEXTStream) Advance

func (sp *KSTEXTStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*KSTEXTStream) Clone

func (sp *KSTEXTStream) Clone() *KSTEXTStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*KSTEXTStream) OutRange

func (sp *KSTEXTStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.KSTEXT reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*KSTEXTStream) Peek

func (sp *KSTEXTStream) Peek(inReal float64) (float64, float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*KSTEXTStream) Update

func (sp *KSTEXTStream) Update(inReal float64) (float64, float64, error)

Update commits the closed bar inReal and returns its outputs: outKST and outKSTSignal. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*KSTEXTStream) Value

func (sp *KSTEXTStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type KSTStream

type KSTStream struct {
	// contains filtered or unexported fields
}

KSTStream is a live KST over a growing series: KSTStream.Update takes each new closed bar and returns the values Core.KST computes at that bar over the same series. Open one with Core.KSTOpen or Core.KSTOpenAndFill.

A stream belongs to one goroutine; KSTStream.Clone forks it.

func (*KSTStream) Advance

func (sp *KSTStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*KSTStream) Clone

func (sp *KSTStream) Clone() *KSTStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*KSTStream) OutRange

func (sp *KSTStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.KST reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*KSTStream) Peek

func (sp *KSTStream) Peek(inReal float64) (float64, float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*KSTStream) Update

func (sp *KSTStream) Update(inReal float64) (float64, float64, error)

Update commits the closed bar inReal and returns its outputs: outKST and outKSTSignal. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*KSTStream) Value

func (sp *KSTStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type KURTOSISStream

type KURTOSISStream struct {
	// contains filtered or unexported fields
}

KURTOSISStream is a live KURTOSIS over a growing series: KURTOSISStream.Update takes each new closed bar and returns the value Core.KURTOSIS computes at that bar over the same series. Open one with Core.KURTOSISOpen or Core.KURTOSISOpenAndFill.

A stream belongs to one goroutine; KURTOSISStream.Clone forks it.

func (*KURTOSISStream) Advance

func (sp *KURTOSISStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*KURTOSISStream) Clone

func (sp *KURTOSISStream) Clone() *KURTOSISStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*KURTOSISStream) OutRange

func (sp *KURTOSISStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.KURTOSIS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*KURTOSISStream) Peek

func (sp *KURTOSISStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*KURTOSISStream) Update

func (sp *KURTOSISStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*KURTOSISStream) Value

func (sp *KURTOSISStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type KVOStream

type KVOStream struct {
	// contains filtered or unexported fields
}

KVOStream is a live KVO over a growing series: KVOStream.Update takes each new closed bar and returns the values Core.KVO computes at that bar over the same series. Open one with Core.KVOOpen or Core.KVOOpenAndFill.

A stream belongs to one goroutine; KVOStream.Clone forks it.

func (*KVOStream) Advance

func (sp *KVOStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*KVOStream) Clone

func (sp *KVOStream) Clone() *KVOStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*KVOStream) OutRange

func (sp *KVOStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.KVO reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*KVOStream) Peek

func (sp *KVOStream) Peek(inHigh, inLow, inClose, inVolume float64) (float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow, inClose and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*KVOStream) Update

func (sp *KVOStream) Update(inHigh, inLow, inClose, inVolume float64) (float64, float64, error)

Update commits one closed bar (inHigh, inLow, inClose and inVolume) and returns its outputs: outKVO and outKVOSignal. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*KVOStream) Value

func (sp *KVOStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type LINEARREGStream

type LINEARREGStream struct {
	SumX    float64
	SumXY   float64
	SumY    float64
	Divisor float64
	// contains filtered or unexported fields
}

LINEARREGStream is a live LINEARREG over a growing series: LINEARREGStream.Update takes each new closed bar and returns the value Core.LINEARREG computes at that bar over the same series. Open one with Core.LINEARREGOpen or Core.LINEARREGOpenAndFill.

A stream belongs to one goroutine; LINEARREGStream.Clone forks it.

func (*LINEARREGStream) Advance

func (sp *LINEARREGStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*LINEARREGStream) Clone

func (sp *LINEARREGStream) Clone() *LINEARREGStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*LINEARREGStream) OutRange

func (sp *LINEARREGStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.LINEARREG reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*LINEARREGStream) Peek

func (sp *LINEARREGStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*LINEARREGStream) Update

func (sp *LINEARREGStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*LINEARREGStream) Value

func (sp *LINEARREGStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type LINEARREG_ANGLEStream

type LINEARREG_ANGLEStream struct {
	SumX    float64
	SumXY   float64
	SumY    float64
	Divisor float64
	// contains filtered or unexported fields
}

LINEARREG_ANGLEStream is a live LINEARREG_ANGLE over a growing series: LINEARREG_ANGLEStream.Update takes each new closed bar and returns the value Core.LINEARREG_ANGLE computes at that bar over the same series. Open one with Core.LINEARREG_ANGLEOpen or Core.LINEARREG_ANGLEOpenAndFill.

A stream belongs to one goroutine; LINEARREG_ANGLEStream.Clone forks it.

func (*LINEARREG_ANGLEStream) Advance

func (sp *LINEARREG_ANGLEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*LINEARREG_ANGLEStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*LINEARREG_ANGLEStream) OutRange

func (sp *LINEARREG_ANGLEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.LINEARREG_ANGLE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*LINEARREG_ANGLEStream) Peek

func (sp *LINEARREG_ANGLEStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*LINEARREG_ANGLEStream) Update

func (sp *LINEARREG_ANGLEStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*LINEARREG_ANGLEStream) Value

func (sp *LINEARREG_ANGLEStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type LINEARREG_INTERCEPTStream

type LINEARREG_INTERCEPTStream struct {
	SumX    float64
	SumXY   float64
	SumY    float64
	Divisor float64
	// contains filtered or unexported fields
}

LINEARREG_INTERCEPTStream is a live LINEARREG_INTERCEPT over a growing series: LINEARREG_INTERCEPTStream.Update takes each new closed bar and returns the value Core.LINEARREG_INTERCEPT computes at that bar over the same series. Open one with Core.LINEARREG_INTERCEPTOpen or Core.LINEARREG_INTERCEPTOpenAndFill.

A stream belongs to one goroutine; LINEARREG_INTERCEPTStream.Clone forks it.

func (*LINEARREG_INTERCEPTStream) Advance

func (sp *LINEARREG_INTERCEPTStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*LINEARREG_INTERCEPTStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*LINEARREG_INTERCEPTStream) OutRange

func (sp *LINEARREG_INTERCEPTStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.LINEARREG_INTERCEPT reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*LINEARREG_INTERCEPTStream) Peek

func (sp *LINEARREG_INTERCEPTStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*LINEARREG_INTERCEPTStream) Update

func (sp *LINEARREG_INTERCEPTStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*LINEARREG_INTERCEPTStream) Value

func (sp *LINEARREG_INTERCEPTStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type LINEARREG_SLOPEStream

type LINEARREG_SLOPEStream struct {
	SumX    float64
	SumXY   float64
	SumY    float64
	Divisor float64
	// contains filtered or unexported fields
}

LINEARREG_SLOPEStream is a live LINEARREG_SLOPE over a growing series: LINEARREG_SLOPEStream.Update takes each new closed bar and returns the value Core.LINEARREG_SLOPE computes at that bar over the same series. Open one with Core.LINEARREG_SLOPEOpen or Core.LINEARREG_SLOPEOpenAndFill.

A stream belongs to one goroutine; LINEARREG_SLOPEStream.Clone forks it.

func (*LINEARREG_SLOPEStream) Advance

func (sp *LINEARREG_SLOPEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*LINEARREG_SLOPEStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*LINEARREG_SLOPEStream) OutRange

func (sp *LINEARREG_SLOPEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.LINEARREG_SLOPE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*LINEARREG_SLOPEStream) Peek

func (sp *LINEARREG_SLOPEStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*LINEARREG_SLOPEStream) Update

func (sp *LINEARREG_SLOPEStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*LINEARREG_SLOPEStream) Value

func (sp *LINEARREG_SLOPEStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type LNStream

type LNStream struct {
	// contains filtered or unexported fields
}

LNStream is a live LN over a growing series: LNStream.Update takes each new closed bar and returns the value Core.LN computes at that bar over the same series. Open one with Core.LNOpen or Core.LNOpenAndFill.

A stream belongs to one goroutine; LNStream.Clone forks it.

func (*LNStream) Advance

func (sp *LNStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*LNStream) Clone

func (sp *LNStream) Clone() *LNStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*LNStream) OutRange

func (sp *LNStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.LN reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*LNStream) Peek

func (sp *LNStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*LNStream) Update

func (sp *LNStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*LNStream) Value

func (sp *LNStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type LOG10Stream

type LOG10Stream struct {
	// contains filtered or unexported fields
}

LOG10Stream is a live LOG10 over a growing series: LOG10Stream.Update takes each new closed bar and returns the value Core.LOG10 computes at that bar over the same series. Open one with Core.LOG10Open or Core.LOG10OpenAndFill.

A stream belongs to one goroutine; LOG10Stream.Clone forks it.

func (*LOG10Stream) Advance

func (sp *LOG10Stream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*LOG10Stream) Clone

func (sp *LOG10Stream) Clone() *LOG10Stream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*LOG10Stream) OutRange

func (sp *LOG10Stream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.LOG10 reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*LOG10Stream) Peek

func (sp *LOG10Stream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*LOG10Stream) Update

func (sp *LOG10Stream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*LOG10Stream) Value

func (sp *LOG10Stream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MACDEXTStream

type MACDEXTStream struct {
	// contains filtered or unexported fields
}

MACDEXTStream is a live MACDEXT over a growing series: MACDEXTStream.Update takes each new closed bar and returns the values Core.MACDEXT computes at that bar over the same series. Open one with Core.MACDEXTOpen or Core.MACDEXTOpenAndFill.

A stream belongs to one goroutine; MACDEXTStream.Clone forks it.

func (*MACDEXTStream) Advance

func (sp *MACDEXTStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MACDEXTStream) Clone

func (sp *MACDEXTStream) Clone() *MACDEXTStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MACDEXTStream) OutRange

func (sp *MACDEXTStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MACDEXT reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MACDEXTStream) Peek

func (sp *MACDEXTStream) Peek(inReal float64) (float64, float64, float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MACDEXTStream) Update

func (sp *MACDEXTStream) Update(inReal float64) (float64, float64, float64, error)

Update commits the closed bar inReal and returns its outputs: outMACD, outMACDSignal and outMACDHist. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MACDEXTStream) Value

func (sp *MACDEXTStream) Value() (float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type MACDFIXStream

type MACDFIXStream struct {
	// contains filtered or unexported fields
}

MACDFIXStream is a live MACDFIX over a growing series: MACDFIXStream.Update takes each new closed bar and returns the values Core.MACDFIX computes at that bar over the same series. Open one with Core.MACDFIXOpen or Core.MACDFIXOpenAndFill.

A stream belongs to one goroutine; MACDFIXStream.Clone forks it.

func (*MACDFIXStream) Advance

func (sp *MACDFIXStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MACDFIXStream) Clone

func (sp *MACDFIXStream) Clone() *MACDFIXStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MACDFIXStream) OutRange

func (sp *MACDFIXStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MACDFIX reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MACDFIXStream) Peek

func (sp *MACDFIXStream) Peek(inReal float64) (float64, float64, float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MACDFIXStream) Update

func (sp *MACDFIXStream) Update(inReal float64) (float64, float64, float64, error)

Update commits the closed bar inReal and returns its outputs: outMACD, outMACDSignal and outMACDHist. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MACDFIXStream) Value

func (sp *MACDFIXStream) Value() (float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type MACDStream

type MACDStream struct {
	// contains filtered or unexported fields
}

MACDStream is a live MACD over a growing series: MACDStream.Update takes each new closed bar and returns the values Core.MACD computes at that bar over the same series. Open one with Core.MACDOpen or Core.MACDOpenAndFill.

A stream belongs to one goroutine; MACDStream.Clone forks it.

func (*MACDStream) Advance

func (sp *MACDStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MACDStream) Clone

func (sp *MACDStream) Clone() *MACDStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MACDStream) OutRange

func (sp *MACDStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MACD reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MACDStream) Peek

func (sp *MACDStream) Peek(inReal float64) (float64, float64, float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MACDStream) Update

func (sp *MACDStream) Update(inReal float64) (float64, float64, float64, error)

Update commits the closed bar inReal and returns its outputs: outMACD, outMACDSignal and outMACDHist. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MACDStream) Value

func (sp *MACDStream) Value() (float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type MACDVStream

type MACDVStream struct {
	// contains filtered or unexported fields
}

MACDVStream is a live MACDV over a growing series: MACDVStream.Update takes each new closed bar and returns the values Core.MACDV computes at that bar over the same series. Open one with Core.MACDVOpen or Core.MACDVOpenAndFill.

A stream belongs to one goroutine; MACDVStream.Clone forks it.

func (*MACDVStream) Advance

func (sp *MACDVStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MACDVStream) Clone

func (sp *MACDVStream) Clone() *MACDVStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MACDVStream) OutRange

func (sp *MACDVStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MACDV reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MACDVStream) Peek

func (sp *MACDVStream) Peek(inHigh, inLow, inClose float64) (float64, float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*MACDVStream) Update

func (sp *MACDVStream) Update(inHigh, inLow, inClose float64) (float64, float64, float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outMACDV, outMACDVSignal and outMACDVHist. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MACDVStream) Value

func (sp *MACDVStream) Value() (float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type MAENVStream

type MAENVStream struct {
	// contains filtered or unexported fields
}

MAENVStream is a live MAENV over a growing series: MAENVStream.Update takes each new closed bar and returns the values Core.MAENV computes at that bar over the same series. Open one with Core.MAENVOpen or Core.MAENVOpenAndFill.

A stream belongs to one goroutine; MAENVStream.Clone forks it.

func (*MAENVStream) Advance

func (sp *MAENVStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MAENVStream) Clone

func (sp *MAENVStream) Clone() *MAENVStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MAENVStream) OutRange

func (sp *MAENVStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MAENV reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MAENVStream) Peek

func (sp *MAENVStream) Peek(inReal float64) (float64, float64, float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MAENVStream) Update

func (sp *MAENVStream) Update(inReal float64) (float64, float64, float64, error)

Update commits the closed bar inReal and returns its outputs: outRealUpperBand, outRealMiddleBand and outRealLowerBand. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MAENVStream) Value

func (sp *MAENVStream) Value() (float64, float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type MAMAStream

type MAMAStream struct {
	Q1_Odd  [3]float64
	Q1_Even [3]float64

	Re             float64
	Im             float64
	I1ForOddPrev2  float64
	I1ForOddPrev3  float64
	I1ForEvenPrev2 float64
	I1ForEvenPrev3 float64
	// contains filtered or unexported fields
}

MAMAStream is a live MAMA over a growing series: MAMAStream.Update takes each new closed bar and returns the values Core.MAMA computes at that bar over the same series. Open one with Core.MAMAOpen or Core.MAMAOpenAndFill.

A stream belongs to one goroutine; MAMAStream.Clone forks it.

func (*MAMAStream) Advance

func (sp *MAMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MAMAStream) Clone

func (sp *MAMAStream) Clone() *MAMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MAMAStream) OutRange

func (sp *MAMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MAMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MAMAStream) Peek

func (sp *MAMAStream) Peek(inReal float64) (float64, float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MAMAStream) Update

func (sp *MAMAStream) Update(inReal float64) (float64, float64, error)

Update commits the closed bar inReal and returns its outputs: outMAMA and outFAMA. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MAMAStream) Value

func (sp *MAMAStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type MARKETFIStream

type MARKETFIStream struct {
	// contains filtered or unexported fields
}

MARKETFIStream is a live MARKETFI over a growing series: MARKETFIStream.Update takes each new closed bar and returns the value Core.MARKETFI computes at that bar over the same series. Open one with Core.MARKETFIOpen or Core.MARKETFIOpenAndFill.

A stream belongs to one goroutine; MARKETFIStream.Clone forks it.

func (*MARKETFIStream) Advance

func (sp *MARKETFIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MARKETFIStream) Clone

func (sp *MARKETFIStream) Clone() *MARKETFIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MARKETFIStream) OutRange

func (sp *MARKETFIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MARKETFI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MARKETFIStream) Peek

func (sp *MARKETFIStream) Peek(inHigh, inLow, inVolume float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*MARKETFIStream) Update

func (sp *MARKETFIStream) Update(inHigh, inLow, inVolume float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inVolume) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MARKETFIStream) Value

func (sp *MARKETFIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MASSIStream

type MASSIStream struct {
	// contains filtered or unexported fields
}

MASSIStream is a live MASSI over a growing series: MASSIStream.Update takes each new closed bar and returns the value Core.MASSI computes at that bar over the same series. Open one with Core.MASSIOpen or Core.MASSIOpenAndFill.

A stream belongs to one goroutine; MASSIStream.Clone forks it.

func (*MASSIStream) Advance

func (sp *MASSIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MASSIStream) Clone

func (sp *MASSIStream) Clone() *MASSIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MASSIStream) OutRange

func (sp *MASSIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MASSI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MASSIStream) Peek

func (sp *MASSIStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*MASSIStream) Update

func (sp *MASSIStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MASSIStream) Value

func (sp *MASSIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MAStream

type MAStream struct {
	// contains filtered or unexported fields
}

MAStream is a live MA over a growing series: MAStream.Update takes each new closed bar and returns the value Core.MA computes at that bar over the same series. Open one with Core.MAOpen or Core.MAOpenAndFill.

A stream belongs to one goroutine; MAStream.Clone forks it.

func (*MAStream) Advance

func (sp *MAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MAStream) Clone

func (sp *MAStream) Clone() *MAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MAStream) OutRange

func (sp *MAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MAStream) Peek

func (sp *MAStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MAStream) Update

func (sp *MAStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MAStream) Value

func (sp *MAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MAType

type MAType int32

MAType selects a moving average.

const (
	MATypeSMA      MAType = 0
	MATypeEMA      MAType = 1
	MATypeWMA      MAType = 2
	MATypeDEMA     MAType = 3
	MATypeTEMA     MAType = 4
	MATypeTRIMA    MAType = 5
	MATypeKAMA     MAType = 6
	MATypeMAMA     MAType = 7
	MATypeT3       MAType = 8
	MATypeHMA      MAType = 9
	MATypeDISABLED MAType = 10
	MATypeDEFAULT  MAType = 11
	MATypeZLEMA    MAType = 12
	MATypeRMA      MAType = 13
	MATypeVIDYA    MAType = 14
	MATypeALMA     MAType = 15
	MATypeSSF      MAType = 16
)

The MAType members.

type MAVPStream

type MAVPStream struct {
	// contains filtered or unexported fields
}

MAVPStream is a live MAVP over a growing series: MAVPStream.Update takes each new closed bar and returns the value Core.MAVP computes at that bar over the same series. Open one with Core.MAVPOpen or Core.MAVPOpenAndFill.

A stream belongs to one goroutine; MAVPStream.Clone forks it.

func (*MAVPStream) Advance

func (sp *MAVPStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MAVPStream) Clone

func (sp *MAVPStream) Clone() *MAVPStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MAVPStream) OutRange

func (sp *MAVPStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MAVP reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MAVPStream) Peek

func (sp *MAVPStream) Peek(inReal, inPeriods float64) (float64, error)

Peek returns what Update would return for the bar (inReal and inPeriods), changing nothing. It returns BadParam for a bar value that is not finite.

func (*MAVPStream) Update

func (sp *MAVPStream) Update(inReal, inPeriods float64) (float64, error)

Update commits one closed bar (inReal and inPeriods) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MAVPStream) Value

func (sp *MAVPStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MAXINDEXStream

type MAXINDEXStream struct {
	// contains filtered or unexported fields
}

MAXINDEXStream is a live MAXINDEX over a growing series: MAXINDEXStream.Update takes each new closed bar and returns the value Core.MAXINDEX computes at that bar over the same series. Open one with Core.MAXINDEXOpen or Core.MAXINDEXOpenAndFill.

A stream belongs to one goroutine; MAXINDEXStream.Clone forks it.

func (*MAXINDEXStream) Advance

func (sp *MAXINDEXStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MAXINDEXStream) Clone

func (sp *MAXINDEXStream) Clone() *MAXINDEXStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MAXINDEXStream) OutRange

func (sp *MAXINDEXStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MAXINDEX reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MAXINDEXStream) Peek

func (sp *MAXINDEXStream) Peek(inReal float64) (int32, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MAXINDEXStream) Update

func (sp *MAXINDEXStream) Update(inReal float64) (int32, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MAXINDEXStream) Value

func (sp *MAXINDEXStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type MAXStream

type MAXStream struct {
	// contains filtered or unexported fields
}

MAXStream is a live MAX over a growing series: MAXStream.Update takes each new closed bar and returns the value Core.MAX computes at that bar over the same series. Open one with Core.MAXOpen or Core.MAXOpenAndFill.

A stream belongs to one goroutine; MAXStream.Clone forks it.

func (*MAXStream) Advance

func (sp *MAXStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MAXStream) Clone

func (sp *MAXStream) Clone() *MAXStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MAXStream) OutRange

func (sp *MAXStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MAX reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MAXStream) Peek

func (sp *MAXStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MAXStream) Update

func (sp *MAXStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MAXStream) Value

func (sp *MAXStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MCGDStream

type MCGDStream struct {
	// contains filtered or unexported fields
}

MCGDStream is a live MCGD over a growing series: MCGDStream.Update takes each new closed bar and returns the value Core.MCGD computes at that bar over the same series. Open one with Core.MCGDOpen or Core.MCGDOpenAndFill.

A stream belongs to one goroutine; MCGDStream.Clone forks it.

func (*MCGDStream) Advance

func (sp *MCGDStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MCGDStream) Clone

func (sp *MCGDStream) Clone() *MCGDStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MCGDStream) OutRange

func (sp *MCGDStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MCGD reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MCGDStream) Peek

func (sp *MCGDStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MCGDStream) Update

func (sp *MCGDStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MCGDStream) Value

func (sp *MCGDStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MEDIANStream

type MEDIANStream struct {
	// contains filtered or unexported fields
}

MEDIANStream is a live MEDIAN over a growing series: MEDIANStream.Update takes each new closed bar and returns the value Core.MEDIAN computes at that bar over the same series. Open one with Core.MEDIANOpen or Core.MEDIANOpenAndFill.

A stream belongs to one goroutine; MEDIANStream.Clone forks it.

func (*MEDIANStream) Advance

func (sp *MEDIANStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MEDIANStream) Clone

func (sp *MEDIANStream) Clone() *MEDIANStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MEDIANStream) OutRange

func (sp *MEDIANStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MEDIAN reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MEDIANStream) Peek

func (sp *MEDIANStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MEDIANStream) Update

func (sp *MEDIANStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MEDIANStream) Value

func (sp *MEDIANStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MEDPRICEStream

type MEDPRICEStream struct {
	// contains filtered or unexported fields
}

MEDPRICEStream is a live MEDPRICE over a growing series: MEDPRICEStream.Update takes each new closed bar and returns the value Core.MEDPRICE computes at that bar over the same series. Open one with Core.MEDPRICEOpen or Core.MEDPRICEOpenAndFill.

A stream belongs to one goroutine; MEDPRICEStream.Clone forks it.

func (*MEDPRICEStream) Advance

func (sp *MEDPRICEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MEDPRICEStream) Clone

func (sp *MEDPRICEStream) Clone() *MEDPRICEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MEDPRICEStream) OutRange

func (sp *MEDPRICEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MEDPRICE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MEDPRICEStream) Peek

func (sp *MEDPRICEStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*MEDPRICEStream) Update

func (sp *MEDPRICEStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MEDPRICEStream) Value

func (sp *MEDPRICEStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MFIStream

type MFIStream struct {
	// contains filtered or unexported fields
}

MFIStream is a live MFI over a growing series: MFIStream.Update takes each new closed bar and returns the value Core.MFI computes at that bar over the same series. Open one with Core.MFIOpen or Core.MFIOpenAndFill.

A stream belongs to one goroutine; MFIStream.Clone forks it.

func (*MFIStream) Advance

func (sp *MFIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MFIStream) Clone

func (sp *MFIStream) Clone() *MFIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MFIStream) OutRange

func (sp *MFIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MFI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MFIStream) Peek

func (sp *MFIStream) Peek(inHigh, inLow, inClose, inVolume float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow, inClose and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*MFIStream) Update

func (sp *MFIStream) Update(inHigh, inLow, inClose, inVolume float64) (float64, error)

Update commits one closed bar (inHigh, inLow, inClose and inVolume) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MFIStream) Value

func (sp *MFIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MIDPOINTStream

type MIDPOINTStream struct {
	// contains filtered or unexported fields
}

MIDPOINTStream is a live MIDPOINT over a growing series: MIDPOINTStream.Update takes each new closed bar and returns the value Core.MIDPOINT computes at that bar over the same series. Open one with Core.MIDPOINTOpen or Core.MIDPOINTOpenAndFill.

A stream belongs to one goroutine; MIDPOINTStream.Clone forks it.

func (*MIDPOINTStream) Advance

func (sp *MIDPOINTStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MIDPOINTStream) Clone

func (sp *MIDPOINTStream) Clone() *MIDPOINTStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MIDPOINTStream) OutRange

func (sp *MIDPOINTStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MIDPOINT reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MIDPOINTStream) Peek

func (sp *MIDPOINTStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MIDPOINTStream) Update

func (sp *MIDPOINTStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MIDPOINTStream) Value

func (sp *MIDPOINTStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MIDPRICEStream

type MIDPRICEStream struct {
	// contains filtered or unexported fields
}

MIDPRICEStream is a live MIDPRICE over a growing series: MIDPRICEStream.Update takes each new closed bar and returns the value Core.MIDPRICE computes at that bar over the same series. Open one with Core.MIDPRICEOpen or Core.MIDPRICEOpenAndFill.

A stream belongs to one goroutine; MIDPRICEStream.Clone forks it.

func (*MIDPRICEStream) Advance

func (sp *MIDPRICEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MIDPRICEStream) Clone

func (sp *MIDPRICEStream) Clone() *MIDPRICEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MIDPRICEStream) OutRange

func (sp *MIDPRICEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MIDPRICE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MIDPRICEStream) Peek

func (sp *MIDPRICEStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*MIDPRICEStream) Update

func (sp *MIDPRICEStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MIDPRICEStream) Value

func (sp *MIDPRICEStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MININDEXStream

type MININDEXStream struct {
	// contains filtered or unexported fields
}

MININDEXStream is a live MININDEX over a growing series: MININDEXStream.Update takes each new closed bar and returns the value Core.MININDEX computes at that bar over the same series. Open one with Core.MININDEXOpen or Core.MININDEXOpenAndFill.

A stream belongs to one goroutine; MININDEXStream.Clone forks it.

func (*MININDEXStream) Advance

func (sp *MININDEXStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MININDEXStream) Clone

func (sp *MININDEXStream) Clone() *MININDEXStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MININDEXStream) OutRange

func (sp *MININDEXStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MININDEX reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MININDEXStream) Peek

func (sp *MININDEXStream) Peek(inReal float64) (int32, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MININDEXStream) Update

func (sp *MININDEXStream) Update(inReal float64) (int32, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MININDEXStream) Value

func (sp *MININDEXStream) Value() int32

Value returns the value at the last bar of OutRange; Peek does not change it.

type MINMAXINDEXStream

type MINMAXINDEXStream struct {
	// contains filtered or unexported fields
}

MINMAXINDEXStream is a live MINMAXINDEX over a growing series: MINMAXINDEXStream.Update takes each new closed bar and returns the values Core.MINMAXINDEX computes at that bar over the same series. Open one with Core.MINMAXINDEXOpen or Core.MINMAXINDEXOpenAndFill.

A stream belongs to one goroutine; MINMAXINDEXStream.Clone forks it.

func (*MINMAXINDEXStream) Advance

func (sp *MINMAXINDEXStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MINMAXINDEXStream) Clone

func (sp *MINMAXINDEXStream) Clone() *MINMAXINDEXStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MINMAXINDEXStream) OutRange

func (sp *MINMAXINDEXStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MINMAXINDEX reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MINMAXINDEXStream) Peek

func (sp *MINMAXINDEXStream) Peek(inReal float64) (int32, int32, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MINMAXINDEXStream) Update

func (sp *MINMAXINDEXStream) Update(inReal float64) (int32, int32, error)

Update commits the closed bar inReal and returns its outputs: outMinIdx and outMaxIdx. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MINMAXINDEXStream) Value

func (sp *MINMAXINDEXStream) Value() (int32, int32)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type MINMAXStream

type MINMAXStream struct {
	// contains filtered or unexported fields
}

MINMAXStream is a live MINMAX over a growing series: MINMAXStream.Update takes each new closed bar and returns the values Core.MINMAX computes at that bar over the same series. Open one with Core.MINMAXOpen or Core.MINMAXOpenAndFill.

A stream belongs to one goroutine; MINMAXStream.Clone forks it.

func (*MINMAXStream) Advance

func (sp *MINMAXStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MINMAXStream) Clone

func (sp *MINMAXStream) Clone() *MINMAXStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MINMAXStream) OutRange

func (sp *MINMAXStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MINMAX reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MINMAXStream) Peek

func (sp *MINMAXStream) Peek(inReal float64) (float64, float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MINMAXStream) Update

func (sp *MINMAXStream) Update(inReal float64) (float64, float64, error)

Update commits the closed bar inReal and returns its outputs: outMin and outMax. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MINMAXStream) Value

func (sp *MINMAXStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type MINStream

type MINStream struct {
	// contains filtered or unexported fields
}

MINStream is a live MIN over a growing series: MINStream.Update takes each new closed bar and returns the value Core.MIN computes at that bar over the same series. Open one with Core.MINOpen or Core.MINOpenAndFill.

A stream belongs to one goroutine; MINStream.Clone forks it.

func (*MINStream) Advance

func (sp *MINStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MINStream) Clone

func (sp *MINStream) Clone() *MINStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MINStream) OutRange

func (sp *MINStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MIN reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MINStream) Peek

func (sp *MINStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MINStream) Update

func (sp *MINStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MINStream) Value

func (sp *MINStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MINUS_DIStream

type MINUS_DIStream struct {
	// contains filtered or unexported fields
}

MINUS_DIStream is a live MINUS_DI over a growing series: MINUS_DIStream.Update takes each new closed bar and returns the value Core.MINUS_DI computes at that bar over the same series. Open one with Core.MINUS_DIOpen or Core.MINUS_DIOpenAndFill.

A stream belongs to one goroutine; MINUS_DIStream.Clone forks it.

func (*MINUS_DIStream) Advance

func (sp *MINUS_DIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MINUS_DIStream) Clone

func (sp *MINUS_DIStream) Clone() *MINUS_DIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MINUS_DIStream) OutRange

func (sp *MINUS_DIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MINUS_DI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MINUS_DIStream) Peek

func (sp *MINUS_DIStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*MINUS_DIStream) Update

func (sp *MINUS_DIStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MINUS_DIStream) Value

func (sp *MINUS_DIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MINUS_DMStream

type MINUS_DMStream struct {
	// contains filtered or unexported fields
}

MINUS_DMStream is a live MINUS_DM over a growing series: MINUS_DMStream.Update takes each new closed bar and returns the value Core.MINUS_DM computes at that bar over the same series. Open one with Core.MINUS_DMOpen or Core.MINUS_DMOpenAndFill.

A stream belongs to one goroutine; MINUS_DMStream.Clone forks it.

func (*MINUS_DMStream) Advance

func (sp *MINUS_DMStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MINUS_DMStream) Clone

func (sp *MINUS_DMStream) Clone() *MINUS_DMStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MINUS_DMStream) OutRange

func (sp *MINUS_DMStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MINUS_DM reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MINUS_DMStream) Peek

func (sp *MINUS_DMStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*MINUS_DMStream) Update

func (sp *MINUS_DMStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MINUS_DMStream) Value

func (sp *MINUS_DMStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MOMStream

type MOMStream struct {
	// contains filtered or unexported fields
}

MOMStream is a live MOM over a growing series: MOMStream.Update takes each new closed bar and returns the value Core.MOM computes at that bar over the same series. Open one with Core.MOMOpen or Core.MOMOpenAndFill.

A stream belongs to one goroutine; MOMStream.Clone forks it.

func (*MOMStream) Advance

func (sp *MOMStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MOMStream) Clone

func (sp *MOMStream) Clone() *MOMStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MOMStream) OutRange

func (sp *MOMStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MOM reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MOMStream) Peek

func (sp *MOMStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*MOMStream) Update

func (sp *MOMStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MOMStream) Value

func (sp *MOMStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type MULTStream

type MULTStream struct {
	// contains filtered or unexported fields
}

MULTStream is a live MULT over a growing series: MULTStream.Update takes each new closed bar and returns the value Core.MULT computes at that bar over the same series. Open one with Core.MULTOpen or Core.MULTOpenAndFill.

A stream belongs to one goroutine; MULTStream.Clone forks it.

func (*MULTStream) Advance

func (sp *MULTStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*MULTStream) Clone

func (sp *MULTStream) Clone() *MULTStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*MULTStream) OutRange

func (sp *MULTStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.MULT reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*MULTStream) Peek

func (sp *MULTStream) Peek(inReal0, inReal1 float64) (float64, error)

Peek returns what Update would return for the bar (inReal0 and inReal1), changing nothing. It returns BadParam for a bar value that is not finite.

func (*MULTStream) Update

func (sp *MULTStream) Update(inReal0, inReal1 float64) (float64, error)

Update commits one closed bar (inReal0 and inReal1) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*MULTStream) Value

func (sp *MULTStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type NATRStream

type NATRStream struct {
	// contains filtered or unexported fields
}

NATRStream is a live NATR over a growing series: NATRStream.Update takes each new closed bar and returns the value Core.NATR computes at that bar over the same series. Open one with Core.NATROpen or Core.NATROpenAndFill.

A stream belongs to one goroutine; NATRStream.Clone forks it.

func (*NATRStream) Advance

func (sp *NATRStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*NATRStream) Clone

func (sp *NATRStream) Clone() *NATRStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*NATRStream) OutRange

func (sp *NATRStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.NATR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*NATRStream) Peek

func (sp *NATRStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*NATRStream) Update

func (sp *NATRStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*NATRStream) Value

func (sp *NATRStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type NVIStream

type NVIStream struct {
	// contains filtered or unexported fields
}

NVIStream is a live NVI over a growing series: NVIStream.Update takes each new closed bar and returns the value Core.NVI computes at that bar over the same series. Open one with Core.NVIOpen or Core.NVIOpenAndFill.

A stream belongs to one goroutine; NVIStream.Clone forks it.

func (*NVIStream) Advance

func (sp *NVIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*NVIStream) Clone

func (sp *NVIStream) Clone() *NVIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*NVIStream) OutRange

func (sp *NVIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.NVI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*NVIStream) Peek

func (sp *NVIStream) Peek(inClose, inVolume float64) (float64, error)

Peek returns what Update would return for the bar (inClose and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*NVIStream) Update

func (sp *NVIStream) Update(inClose, inVolume float64) (float64, error)

Update commits one closed bar (inClose and inVolume) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*NVIStream) Value

func (sp *NVIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type OBVStream

type OBVStream struct {
	// contains filtered or unexported fields
}

OBVStream is a live OBV over a growing series: OBVStream.Update takes each new closed bar and returns the value Core.OBV computes at that bar over the same series. Open one with Core.OBVOpen or Core.OBVOpenAndFill.

A stream belongs to one goroutine; OBVStream.Clone forks it.

func (*OBVStream) Advance

func (sp *OBVStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*OBVStream) Clone

func (sp *OBVStream) Clone() *OBVStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*OBVStream) OutRange

func (sp *OBVStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.OBV reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*OBVStream) Peek

func (sp *OBVStream) Peek(inReal, inVolume float64) (float64, error)

Peek returns what Update would return for the bar (inReal and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*OBVStream) Update

func (sp *OBVStream) Update(inReal, inVolume float64) (float64, error)

Update commits one closed bar (inReal and inVolume) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*OBVStream) Value

func (sp *OBVStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type OutRange

type OutRange struct {
	BegIdx    int
	NBElement int
}

OutRange is the range a batch call wrote: BegIdx is the first bar with a value, NBElement how many values were written.

type PERCENTBStream

type PERCENTBStream struct {
	// contains filtered or unexported fields
}

PERCENTBStream is a live PERCENTB over a growing series: PERCENTBStream.Update takes each new closed bar and returns the value Core.PERCENTB computes at that bar over the same series. Open one with Core.PERCENTBOpen or Core.PERCENTBOpenAndFill.

A stream belongs to one goroutine; PERCENTBStream.Clone forks it.

func (*PERCENTBStream) Advance

func (sp *PERCENTBStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*PERCENTBStream) Clone

func (sp *PERCENTBStream) Clone() *PERCENTBStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*PERCENTBStream) OutRange

func (sp *PERCENTBStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.PERCENTB reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*PERCENTBStream) Peek

func (sp *PERCENTBStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*PERCENTBStream) Update

func (sp *PERCENTBStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*PERCENTBStream) Value

func (sp *PERCENTBStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type PERCENTILEStream

type PERCENTILEStream struct {
	// contains filtered or unexported fields
}

PERCENTILEStream is a live PERCENTILE over a growing series: PERCENTILEStream.Update takes each new closed bar and returns the value Core.PERCENTILE computes at that bar over the same series. Open one with Core.PERCENTILEOpen or Core.PERCENTILEOpenAndFill.

A stream belongs to one goroutine; PERCENTILEStream.Clone forks it.

func (*PERCENTILEStream) Advance

func (sp *PERCENTILEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*PERCENTILEStream) Clone

func (sp *PERCENTILEStream) Clone() *PERCENTILEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*PERCENTILEStream) OutRange

func (sp *PERCENTILEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.PERCENTILE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*PERCENTILEStream) Peek

func (sp *PERCENTILEStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*PERCENTILEStream) Update

func (sp *PERCENTILEStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*PERCENTILEStream) Value

func (sp *PERCENTILEStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type PERCENTRANKStream

type PERCENTRANKStream struct {
	// contains filtered or unexported fields
}

PERCENTRANKStream is a live PERCENTRANK over a growing series: PERCENTRANKStream.Update takes each new closed bar and returns the value Core.PERCENTRANK computes at that bar over the same series. Open one with Core.PERCENTRANKOpen or Core.PERCENTRANKOpenAndFill.

A stream belongs to one goroutine; PERCENTRANKStream.Clone forks it.

func (*PERCENTRANKStream) Advance

func (sp *PERCENTRANKStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*PERCENTRANKStream) Clone

func (sp *PERCENTRANKStream) Clone() *PERCENTRANKStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*PERCENTRANKStream) OutRange

func (sp *PERCENTRANKStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.PERCENTRANK reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*PERCENTRANKStream) Peek

func (sp *PERCENTRANKStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*PERCENTRANKStream) Update

func (sp *PERCENTRANKStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*PERCENTRANKStream) Value

func (sp *PERCENTRANKStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type PLUS_DIStream

type PLUS_DIStream struct {
	// contains filtered or unexported fields
}

PLUS_DIStream is a live PLUS_DI over a growing series: PLUS_DIStream.Update takes each new closed bar and returns the value Core.PLUS_DI computes at that bar over the same series. Open one with Core.PLUS_DIOpen or Core.PLUS_DIOpenAndFill.

A stream belongs to one goroutine; PLUS_DIStream.Clone forks it.

func (*PLUS_DIStream) Advance

func (sp *PLUS_DIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*PLUS_DIStream) Clone

func (sp *PLUS_DIStream) Clone() *PLUS_DIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*PLUS_DIStream) OutRange

func (sp *PLUS_DIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.PLUS_DI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*PLUS_DIStream) Peek

func (sp *PLUS_DIStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*PLUS_DIStream) Update

func (sp *PLUS_DIStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*PLUS_DIStream) Value

func (sp *PLUS_DIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type PLUS_DMStream

type PLUS_DMStream struct {
	// contains filtered or unexported fields
}

PLUS_DMStream is a live PLUS_DM over a growing series: PLUS_DMStream.Update takes each new closed bar and returns the value Core.PLUS_DM computes at that bar over the same series. Open one with Core.PLUS_DMOpen or Core.PLUS_DMOpenAndFill.

A stream belongs to one goroutine; PLUS_DMStream.Clone forks it.

func (*PLUS_DMStream) Advance

func (sp *PLUS_DMStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*PLUS_DMStream) Clone

func (sp *PLUS_DMStream) Clone() *PLUS_DMStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*PLUS_DMStream) OutRange

func (sp *PLUS_DMStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.PLUS_DM reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*PLUS_DMStream) Peek

func (sp *PLUS_DMStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*PLUS_DMStream) Update

func (sp *PLUS_DMStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*PLUS_DMStream) Value

func (sp *PLUS_DMStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type PPOStream

type PPOStream struct {
	// contains filtered or unexported fields
}

PPOStream is a live PPO over a growing series: PPOStream.Update takes each new closed bar and returns the value Core.PPO computes at that bar over the same series. Open one with Core.PPOOpen or Core.PPOOpenAndFill.

A stream belongs to one goroutine; PPOStream.Clone forks it.

func (*PPOStream) Advance

func (sp *PPOStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*PPOStream) Clone

func (sp *PPOStream) Clone() *PPOStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*PPOStream) OutRange

func (sp *PPOStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.PPO reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*PPOStream) Peek

func (sp *PPOStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*PPOStream) Update

func (sp *PPOStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*PPOStream) Value

func (sp *PPOStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type PSOStream

type PSOStream struct {
	// contains filtered or unexported fields
}

PSOStream is a live PSO over a growing series: PSOStream.Update takes each new closed bar and returns the value Core.PSO computes at that bar over the same series. Open one with Core.PSOOpen or Core.PSOOpenAndFill.

A stream belongs to one goroutine; PSOStream.Clone forks it.

func (*PSOStream) Advance

func (sp *PSOStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*PSOStream) Clone

func (sp *PSOStream) Clone() *PSOStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*PSOStream) OutRange

func (sp *PSOStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.PSO reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*PSOStream) Peek

func (sp *PSOStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*PSOStream) Update

func (sp *PSOStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*PSOStream) Value

func (sp *PSOStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type PSYStream

type PSYStream struct {
	// contains filtered or unexported fields
}

PSYStream is a live PSY over a growing series: PSYStream.Update takes each new closed bar and returns the value Core.PSY computes at that bar over the same series. Open one with Core.PSYOpen or Core.PSYOpenAndFill.

A stream belongs to one goroutine; PSYStream.Clone forks it.

func (*PSYStream) Advance

func (sp *PSYStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*PSYStream) Clone

func (sp *PSYStream) Clone() *PSYStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*PSYStream) OutRange

func (sp *PSYStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.PSY reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*PSYStream) Peek

func (sp *PSYStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*PSYStream) Update

func (sp *PSYStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*PSYStream) Value

func (sp *PSYStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type PVIStream

type PVIStream struct {
	// contains filtered or unexported fields
}

PVIStream is a live PVI over a growing series: PVIStream.Update takes each new closed bar and returns the value Core.PVI computes at that bar over the same series. Open one with Core.PVIOpen or Core.PVIOpenAndFill.

A stream belongs to one goroutine; PVIStream.Clone forks it.

func (*PVIStream) Advance

func (sp *PVIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*PVIStream) Clone

func (sp *PVIStream) Clone() *PVIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*PVIStream) OutRange

func (sp *PVIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.PVI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*PVIStream) Peek

func (sp *PVIStream) Peek(inClose, inVolume float64) (float64, error)

Peek returns what Update would return for the bar (inClose and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*PVIStream) Update

func (sp *PVIStream) Update(inClose, inVolume float64) (float64, error)

Update commits one closed bar (inClose and inVolume) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*PVIStream) Value

func (sp *PVIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type PVOStream

type PVOStream struct {
	// contains filtered or unexported fields
}

PVOStream is a live PVO over a growing series: PVOStream.Update takes each new closed bar and returns the value Core.PVO computes at that bar over the same series. Open one with Core.PVOOpen or Core.PVOOpenAndFill.

A stream belongs to one goroutine; PVOStream.Clone forks it.

func (*PVOStream) Advance

func (sp *PVOStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*PVOStream) Clone

func (sp *PVOStream) Clone() *PVOStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*PVOStream) OutRange

func (sp *PVOStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.PVO reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*PVOStream) Peek

func (sp *PVOStream) Peek(inVolume float64) (float64, error)

Peek returns what Update would return for the bar inVolume, changing nothing. It returns BadParam for a bar value that is not finite.

func (*PVOStream) Update

func (sp *PVOStream) Update(inVolume float64) (float64, error)

Update commits the closed bar inVolume and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*PVOStream) Value

func (sp *PVOStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type PVTStream

type PVTStream struct {
	// contains filtered or unexported fields
}

PVTStream is a live PVT over a growing series: PVTStream.Update takes each new closed bar and returns the value Core.PVT computes at that bar over the same series. Open one with Core.PVTOpen or Core.PVTOpenAndFill.

A stream belongs to one goroutine; PVTStream.Clone forks it.

func (*PVTStream) Advance

func (sp *PVTStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*PVTStream) Clone

func (sp *PVTStream) Clone() *PVTStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*PVTStream) OutRange

func (sp *PVTStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.PVT reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*PVTStream) Peek

func (sp *PVTStream) Peek(inClose, inVolume float64) (float64, error)

Peek returns what Update would return for the bar (inClose and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*PVTStream) Update

func (sp *PVTStream) Update(inClose, inVolume float64) (float64, error)

Update commits one closed bar (inClose and inVolume) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*PVTStream) Value

func (sp *PVTStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type QSTICKStream

type QSTICKStream struct {
	// contains filtered or unexported fields
}

QSTICKStream is a live QSTICK over a growing series: QSTICKStream.Update takes each new closed bar and returns the value Core.QSTICK computes at that bar over the same series. Open one with Core.QSTICKOpen or Core.QSTICKOpenAndFill.

A stream belongs to one goroutine; QSTICKStream.Clone forks it.

func (*QSTICKStream) Advance

func (sp *QSTICKStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*QSTICKStream) Clone

func (sp *QSTICKStream) Clone() *QSTICKStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*QSTICKStream) OutRange

func (sp *QSTICKStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.QSTICK reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*QSTICKStream) Peek

func (sp *QSTICKStream) Peek(inOpen, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inOpen and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*QSTICKStream) Update

func (sp *QSTICKStream) Update(inOpen, inClose float64) (float64, error)

Update commits one closed bar (inOpen and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*QSTICKStream) Value

func (sp *QSTICKStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type RMAStream

type RMAStream struct {
	// contains filtered or unexported fields
}

RMAStream is a live RMA over a growing series: RMAStream.Update takes each new closed bar and returns the value Core.RMA computes at that bar over the same series. Open one with Core.RMAOpen or Core.RMAOpenAndFill.

A stream belongs to one goroutine; RMAStream.Clone forks it.

func (*RMAStream) Advance

func (sp *RMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*RMAStream) Clone

func (sp *RMAStream) Clone() *RMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*RMAStream) OutRange

func (sp *RMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.RMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*RMAStream) Peek

func (sp *RMAStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*RMAStream) Update

func (sp *RMAStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*RMAStream) Value

func (sp *RMAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ROCPStream

type ROCPStream struct {
	// contains filtered or unexported fields
}

ROCPStream is a live ROCP over a growing series: ROCPStream.Update takes each new closed bar and returns the value Core.ROCP computes at that bar over the same series. Open one with Core.ROCPOpen or Core.ROCPOpenAndFill.

A stream belongs to one goroutine; ROCPStream.Clone forks it.

func (*ROCPStream) Advance

func (sp *ROCPStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ROCPStream) Clone

func (sp *ROCPStream) Clone() *ROCPStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ROCPStream) OutRange

func (sp *ROCPStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ROCP reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ROCPStream) Peek

func (sp *ROCPStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*ROCPStream) Update

func (sp *ROCPStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ROCPStream) Value

func (sp *ROCPStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ROCR100Stream

type ROCR100Stream struct {
	// contains filtered or unexported fields
}

ROCR100Stream is a live ROCR100 over a growing series: ROCR100Stream.Update takes each new closed bar and returns the value Core.ROCR100 computes at that bar over the same series. Open one with Core.ROCR100Open or Core.ROCR100OpenAndFill.

A stream belongs to one goroutine; ROCR100Stream.Clone forks it.

func (*ROCR100Stream) Advance

func (sp *ROCR100Stream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ROCR100Stream) Clone

func (sp *ROCR100Stream) Clone() *ROCR100Stream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ROCR100Stream) OutRange

func (sp *ROCR100Stream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ROCR100 reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ROCR100Stream) Peek

func (sp *ROCR100Stream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*ROCR100Stream) Update

func (sp *ROCR100Stream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ROCR100Stream) Value

func (sp *ROCR100Stream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ROCRStream

type ROCRStream struct {
	// contains filtered or unexported fields
}

ROCRStream is a live ROCR over a growing series: ROCRStream.Update takes each new closed bar and returns the value Core.ROCR computes at that bar over the same series. Open one with Core.ROCROpen or Core.ROCROpenAndFill.

A stream belongs to one goroutine; ROCRStream.Clone forks it.

func (*ROCRStream) Advance

func (sp *ROCRStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ROCRStream) Clone

func (sp *ROCRStream) Clone() *ROCRStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ROCRStream) OutRange

func (sp *ROCRStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ROCR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ROCRStream) Peek

func (sp *ROCRStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*ROCRStream) Update

func (sp *ROCRStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ROCRStream) Value

func (sp *ROCRStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ROCStream

type ROCStream struct {
	// contains filtered or unexported fields
}

ROCStream is a live ROC over a growing series: ROCStream.Update takes each new closed bar and returns the value Core.ROC computes at that bar over the same series. Open one with Core.ROCOpen or Core.ROCOpenAndFill.

A stream belongs to one goroutine; ROCStream.Clone forks it.

func (*ROCStream) Advance

func (sp *ROCStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ROCStream) Clone

func (sp *ROCStream) Clone() *ROCStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ROCStream) OutRange

func (sp *ROCStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ROC reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ROCStream) Peek

func (sp *ROCStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*ROCStream) Update

func (sp *ROCStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ROCStream) Value

func (sp *ROCStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ROGERSSATCHELLStream

type ROGERSSATCHELLStream struct {
	// contains filtered or unexported fields
}

ROGERSSATCHELLStream is a live ROGERSSATCHELL over a growing series: ROGERSSATCHELLStream.Update takes each new closed bar and returns the value Core.ROGERSSATCHELL computes at that bar over the same series. Open one with Core.ROGERSSATCHELLOpen or Core.ROGERSSATCHELLOpenAndFill.

A stream belongs to one goroutine; ROGERSSATCHELLStream.Clone forks it.

func (*ROGERSSATCHELLStream) Advance

func (sp *ROGERSSATCHELLStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ROGERSSATCHELLStream) Clone

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ROGERSSATCHELLStream) OutRange

func (sp *ROGERSSATCHELLStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ROGERSSATCHELL reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ROGERSSATCHELLStream) Peek

func (sp *ROGERSSATCHELLStream) Peek(inOpen, inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ROGERSSATCHELLStream) Update

func (sp *ROGERSSATCHELLStream) Update(inOpen, inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ROGERSSATCHELLStream) Value

func (sp *ROGERSSATCHELLStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type RSIStream

type RSIStream struct {
	// contains filtered or unexported fields
}

RSIStream is a live RSI over a growing series: RSIStream.Update takes each new closed bar and returns the value Core.RSI computes at that bar over the same series. Open one with Core.RSIOpen or Core.RSIOpenAndFill.

A stream belongs to one goroutine; RSIStream.Clone forks it.

func (*RSIStream) Advance

func (sp *RSIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*RSIStream) Clone

func (sp *RSIStream) Clone() *RSIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*RSIStream) OutRange

func (sp *RSIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.RSI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*RSIStream) Peek

func (sp *RSIStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*RSIStream) Update

func (sp *RSIStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*RSIStream) Value

func (sp *RSIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type RVIRStream

type RVIRStream struct {
	// contains filtered or unexported fields
}

RVIRStream is a live RVIR over a growing series: RVIRStream.Update takes each new closed bar and returns the value Core.RVIR computes at that bar over the same series. Open one with Core.RVIROpen or Core.RVIROpenAndFill.

A stream belongs to one goroutine; RVIRStream.Clone forks it.

func (*RVIRStream) Advance

func (sp *RVIRStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*RVIRStream) Clone

func (sp *RVIRStream) Clone() *RVIRStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*RVIRStream) OutRange

func (sp *RVIRStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.RVIR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*RVIRStream) Peek

func (sp *RVIRStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*RVIRStream) Update

func (sp *RVIRStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*RVIRStream) Value

func (sp *RVIRStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type RVIStream

type RVIStream struct {
	// contains filtered or unexported fields
}

RVIStream is a live RVI over a growing series: RVIStream.Update takes each new closed bar and returns the value Core.RVI computes at that bar over the same series. Open one with Core.RVIOpen or Core.RVIOpenAndFill.

A stream belongs to one goroutine; RVIStream.Clone forks it.

func (*RVIStream) Advance

func (sp *RVIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*RVIStream) Clone

func (sp *RVIStream) Clone() *RVIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*RVIStream) OutRange

func (sp *RVIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.RVI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*RVIStream) Peek

func (sp *RVIStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*RVIStream) Update

func (sp *RVIStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*RVIStream) Value

func (sp *RVIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type RVOLStream

type RVOLStream struct {
	// contains filtered or unexported fields
}

RVOLStream is a live RVOL over a growing series: RVOLStream.Update takes each new closed bar and returns the value Core.RVOL computes at that bar over the same series. Open one with Core.RVOLOpen or Core.RVOLOpenAndFill.

A stream belongs to one goroutine; RVOLStream.Clone forks it.

func (*RVOLStream) Advance

func (sp *RVOLStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*RVOLStream) Clone

func (sp *RVOLStream) Clone() *RVOLStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*RVOLStream) OutRange

func (sp *RVOLStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.RVOL reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*RVOLStream) Peek

func (sp *RVOLStream) Peek(inVolume float64) (float64, error)

Peek returns what Update would return for the bar inVolume, changing nothing. It returns BadParam for a bar value that is not finite.

func (*RVOLStream) Update

func (sp *RVOLStream) Update(inVolume float64) (float64, error)

Update commits the closed bar inVolume and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*RVOLStream) Value

func (sp *RVOLStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type RangeType

type RangeType int32

RangeType is how a candle range is measured; C's order.

const (
	RangeTypeRealBody RangeType = 0
	RangeTypeHighLow  RangeType = 1
	RangeTypeShadows  RangeType = 2
)

The RangeType members.

type RetCode

type RetCode int32

RetCode is the status of a call, numbered as C's TA_RetCode. A failed call returns it as its error; a successful one returns a nil error.

const (
	Success                RetCode = 0
	LibNotInitialize       RetCode = 1
	BadParam               RetCode = 2
	AllocErr               RetCode = 3
	GroupNotFound          RetCode = 4
	FuncNotFound           RetCode = 5
	InvalidHandle          RetCode = 6
	InvalidParamHolder     RetCode = 7
	InvalidParamHolderType RetCode = 8
	InvalidParamFunction   RetCode = 9
	InputNotAllInitialize  RetCode = 10
	OutputNotAllInitialize RetCode = 11
	OutOfRangeStartIndex   RetCode = 12
	OutOfRangeEndIndex     RetCode = 13
	InvalidListType        RetCode = 14
	BadObject              RetCode = 15
	NotSupported           RetCode = 16
	InsufficientHistory    RetCode = 17
	InternalError          RetCode = 5000
	UnknownErr             RetCode = 0xFFFF
)

The RetCode values, C's TA_RetCode set.

func (RetCode) Error

func (r RetCode) Error() string

Error returns C's enumerator spelling of the code.

type SAREXTStream

type SAREXTStream struct {
	// contains filtered or unexported fields
}

SAREXTStream is a live SAREXT over a growing series: SAREXTStream.Update takes each new closed bar and returns the value Core.SAREXT computes at that bar over the same series. Open one with Core.SAREXTOpen or Core.SAREXTOpenAndFill.

A stream belongs to one goroutine; SAREXTStream.Clone forks it.

func (*SAREXTStream) Advance

func (sp *SAREXTStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SAREXTStream) Clone

func (sp *SAREXTStream) Clone() *SAREXTStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SAREXTStream) OutRange

func (sp *SAREXTStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SAREXT reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SAREXTStream) Peek

func (sp *SAREXTStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*SAREXTStream) Update

func (sp *SAREXTStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SAREXTStream) Value

func (sp *SAREXTStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SARStream

type SARStream struct {
	// contains filtered or unexported fields
}

SARStream is a live SAR over a growing series: SARStream.Update takes each new closed bar and returns the value Core.SAR computes at that bar over the same series. Open one with Core.SAROpen or Core.SAROpenAndFill.

A stream belongs to one goroutine; SARStream.Clone forks it.

func (*SARStream) Advance

func (sp *SARStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SARStream) Clone

func (sp *SARStream) Clone() *SARStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SARStream) OutRange

func (sp *SARStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SAR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SARStream) Peek

func (sp *SARStream) Peek(inHigh, inLow float64) (float64, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*SARStream) Update

func (sp *SARStream) Update(inHigh, inLow float64) (float64, error)

Update commits one closed bar (inHigh and inLow) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SARStream) Value

func (sp *SARStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SHARPEStream

type SHARPEStream struct {
	// contains filtered or unexported fields
}

SHARPEStream is a live SHARPE over a growing series: SHARPEStream.Update takes each new closed bar and returns the value Core.SHARPE computes at that bar over the same series. Open one with Core.SHARPEOpen or Core.SHARPEOpenAndFill.

A stream belongs to one goroutine; SHARPEStream.Clone forks it.

func (*SHARPEStream) Advance

func (sp *SHARPEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SHARPEStream) Clone

func (sp *SHARPEStream) Clone() *SHARPEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SHARPEStream) OutRange

func (sp *SHARPEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SHARPE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SHARPEStream) Peek

func (sp *SHARPEStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SHARPEStream) Update

func (sp *SHARPEStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SHARPEStream) Value

func (sp *SHARPEStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SINHStream

type SINHStream struct {
	// contains filtered or unexported fields
}

SINHStream is a live SINH over a growing series: SINHStream.Update takes each new closed bar and returns the value Core.SINH computes at that bar over the same series. Open one with Core.SINHOpen or Core.SINHOpenAndFill.

A stream belongs to one goroutine; SINHStream.Clone forks it.

func (*SINHStream) Advance

func (sp *SINHStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SINHStream) Clone

func (sp *SINHStream) Clone() *SINHStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SINHStream) OutRange

func (sp *SINHStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SINH reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SINHStream) Peek

func (sp *SINHStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SINHStream) Update

func (sp *SINHStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SINHStream) Value

func (sp *SINHStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SINStream

type SINStream struct {
	// contains filtered or unexported fields
}

SINStream is a live SIN over a growing series: SINStream.Update takes each new closed bar and returns the value Core.SIN computes at that bar over the same series. Open one with Core.SINOpen or Core.SINOpenAndFill.

A stream belongs to one goroutine; SINStream.Clone forks it.

func (*SINStream) Advance

func (sp *SINStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SINStream) Clone

func (sp *SINStream) Clone() *SINStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SINStream) OutRange

func (sp *SINStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SIN reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SINStream) Peek

func (sp *SINStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SINStream) Update

func (sp *SINStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SINStream) Value

func (sp *SINStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SIStream

type SIStream struct {
	// contains filtered or unexported fields
}

SIStream is a live SI over a growing series: SIStream.Update takes each new closed bar and returns the value Core.SI computes at that bar over the same series. Open one with Core.SIOpen or Core.SIOpenAndFill.

A stream belongs to one goroutine; SIStream.Clone forks it.

func (*SIStream) Advance

func (sp *SIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SIStream) Clone

func (sp *SIStream) Clone() *SIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SIStream) OutRange

func (sp *SIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SIStream) Peek

func (sp *SIStream) Peek(inOpen, inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inOpen, inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*SIStream) Update

func (sp *SIStream) Update(inOpen, inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inOpen, inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SIStream) Value

func (sp *SIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SKEWStream

type SKEWStream struct {
	// contains filtered or unexported fields
}

SKEWStream is a live SKEW over a growing series: SKEWStream.Update takes each new closed bar and returns the value Core.SKEW computes at that bar over the same series. Open one with Core.SKEWOpen or Core.SKEWOpenAndFill.

A stream belongs to one goroutine; SKEWStream.Clone forks it.

func (*SKEWStream) Advance

func (sp *SKEWStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SKEWStream) Clone

func (sp *SKEWStream) Clone() *SKEWStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SKEWStream) OutRange

func (sp *SKEWStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SKEW reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SKEWStream) Peek

func (sp *SKEWStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SKEWStream) Update

func (sp *SKEWStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SKEWStream) Value

func (sp *SKEWStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SMAStream

type SMAStream struct {
	// contains filtered or unexported fields
}

SMAStream is a live SMA over a growing series: SMAStream.Update takes each new closed bar and returns the value Core.SMA computes at that bar over the same series. Open one with Core.SMAOpen or Core.SMAOpenAndFill.

A stream belongs to one goroutine; SMAStream.Clone forks it.

func (*SMAStream) Advance

func (sp *SMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SMAStream) Clone

func (sp *SMAStream) Clone() *SMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SMAStream) OutRange

func (sp *SMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SMAStream) Peek

func (sp *SMAStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SMAStream) Update

func (sp *SMAStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SMAStream) Value

func (sp *SMAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SMIStream

type SMIStream struct {
	// contains filtered or unexported fields
}

SMIStream is a live SMI over a growing series: SMIStream.Update takes each new closed bar and returns the values Core.SMI computes at that bar over the same series. Open one with Core.SMIOpen or Core.SMIOpenAndFill.

A stream belongs to one goroutine; SMIStream.Clone forks it.

func (*SMIStream) Advance

func (sp *SMIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SMIStream) Clone

func (sp *SMIStream) Clone() *SMIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SMIStream) OutRange

func (sp *SMIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SMI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SMIStream) Peek

func (sp *SMIStream) Peek(inHigh, inLow, inClose float64) (float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*SMIStream) Update

func (sp *SMIStream) Update(inHigh, inLow, inClose float64) (float64, float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outSMI and outSMISignal. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SMIStream) Value

func (sp *SMIStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type SORTINOStream

type SORTINOStream struct {
	// contains filtered or unexported fields
}

SORTINOStream is a live SORTINO over a growing series: SORTINOStream.Update takes each new closed bar and returns the value Core.SORTINO computes at that bar over the same series. Open one with Core.SORTINOOpen or Core.SORTINOOpenAndFill.

A stream belongs to one goroutine; SORTINOStream.Clone forks it.

func (*SORTINOStream) Advance

func (sp *SORTINOStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SORTINOStream) Clone

func (sp *SORTINOStream) Clone() *SORTINOStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SORTINOStream) OutRange

func (sp *SORTINOStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SORTINO reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SORTINOStream) Peek

func (sp *SORTINOStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SORTINOStream) Update

func (sp *SORTINOStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SORTINOStream) Value

func (sp *SORTINOStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SQRTStream

type SQRTStream struct {
	// contains filtered or unexported fields
}

SQRTStream is a live SQRT over a growing series: SQRTStream.Update takes each new closed bar and returns the value Core.SQRT computes at that bar over the same series. Open one with Core.SQRTOpen or Core.SQRTOpenAndFill.

A stream belongs to one goroutine; SQRTStream.Clone forks it.

func (*SQRTStream) Advance

func (sp *SQRTStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SQRTStream) Clone

func (sp *SQRTStream) Clone() *SQRTStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SQRTStream) OutRange

func (sp *SQRTStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SQRT reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SQRTStream) Peek

func (sp *SQRTStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SQRTStream) Update

func (sp *SQRTStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SQRTStream) Value

func (sp *SQRTStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SQZMOMStream

type SQZMOMStream struct {
	// contains filtered or unexported fields
}

SQZMOMStream is a live SQZMOM over a growing series: SQZMOMStream.Update takes each new closed bar and returns the values Core.SQZMOM computes at that bar over the same series. Open one with Core.SQZMOMOpen or Core.SQZMOMOpenAndFill.

A stream belongs to one goroutine; SQZMOMStream.Clone forks it.

func (*SQZMOMStream) Advance

func (sp *SQZMOMStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SQZMOMStream) Clone

func (sp *SQZMOMStream) Clone() *SQZMOMStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SQZMOMStream) OutRange

func (sp *SQZMOMStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SQZMOM reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SQZMOMStream) Peek

func (sp *SQZMOMStream) Peek(inHigh, inLow, inClose float64) (float64, int32, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*SQZMOMStream) Update

func (sp *SQZMOMStream) Update(inHigh, inLow, inClose float64) (float64, int32, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outMomentum and outSqueeze. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SQZMOMStream) Value

func (sp *SQZMOMStream) Value() (float64, int32)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type SSFStream

type SSFStream struct {
	// contains filtered or unexported fields
}

SSFStream is a live SSF over a growing series: SSFStream.Update takes each new closed bar and returns the value Core.SSF computes at that bar over the same series. Open one with Core.SSFOpen or Core.SSFOpenAndFill.

A stream belongs to one goroutine; SSFStream.Clone forks it.

func (*SSFStream) Advance

func (sp *SSFStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SSFStream) Clone

func (sp *SSFStream) Clone() *SSFStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SSFStream) OutRange

func (sp *SSFStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SSF reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SSFStream) Peek

func (sp *SSFStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SSFStream) Update

func (sp *SSFStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SSFStream) Value

func (sp *SSFStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type STCStream

type STCStream struct {
	// contains filtered or unexported fields
}

STCStream is a live STC over a growing series: STCStream.Update takes each new closed bar and returns the value Core.STC computes at that bar over the same series. Open one with Core.STCOpen or Core.STCOpenAndFill.

A stream belongs to one goroutine; STCStream.Clone forks it.

func (*STCStream) Advance

func (sp *STCStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*STCStream) Clone

func (sp *STCStream) Clone() *STCStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*STCStream) OutRange

func (sp *STCStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.STC reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*STCStream) Peek

func (sp *STCStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*STCStream) Update

func (sp *STCStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*STCStream) Value

func (sp *STCStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type STDDEVStream

type STDDEVStream struct {
	// contains filtered or unexported fields
}

STDDEVStream is a live STDDEV over a growing series: STDDEVStream.Update takes each new closed bar and returns the value Core.STDDEV computes at that bar over the same series. Open one with Core.STDDEVOpen or Core.STDDEVOpenAndFill.

A stream belongs to one goroutine; STDDEVStream.Clone forks it.

func (*STDDEVStream) Advance

func (sp *STDDEVStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*STDDEVStream) Clone

func (sp *STDDEVStream) Clone() *STDDEVStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*STDDEVStream) OutRange

func (sp *STDDEVStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.STDDEV reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*STDDEVStream) Peek

func (sp *STDDEVStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*STDDEVStream) Update

func (sp *STDDEVStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*STDDEVStream) Value

func (sp *STDDEVStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type STOCHFStream

type STOCHFStream struct {
	// contains filtered or unexported fields
}

STOCHFStream is a live STOCHF over a growing series: STOCHFStream.Update takes each new closed bar and returns the values Core.STOCHF computes at that bar over the same series. Open one with Core.STOCHFOpen or Core.STOCHFOpenAndFill.

A stream belongs to one goroutine; STOCHFStream.Clone forks it.

func (*STOCHFStream) Advance

func (sp *STOCHFStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*STOCHFStream) Clone

func (sp *STOCHFStream) Clone() *STOCHFStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*STOCHFStream) OutRange

func (sp *STOCHFStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.STOCHF reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*STOCHFStream) Peek

func (sp *STOCHFStream) Peek(inHigh, inLow, inClose float64) (float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*STOCHFStream) Update

func (sp *STOCHFStream) Update(inHigh, inLow, inClose float64) (float64, float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outFastK and outFastD. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*STOCHFStream) Value

func (sp *STOCHFStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type STOCHRSIStream

type STOCHRSIStream struct {
	// contains filtered or unexported fields
}

STOCHRSIStream is a live STOCHRSI over a growing series: STOCHRSIStream.Update takes each new closed bar and returns the values Core.STOCHRSI computes at that bar over the same series. Open one with Core.STOCHRSIOpen or Core.STOCHRSIOpenAndFill.

A stream belongs to one goroutine; STOCHRSIStream.Clone forks it.

func (*STOCHRSIStream) Advance

func (sp *STOCHRSIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*STOCHRSIStream) Clone

func (sp *STOCHRSIStream) Clone() *STOCHRSIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*STOCHRSIStream) OutRange

func (sp *STOCHRSIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.STOCHRSI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*STOCHRSIStream) Peek

func (sp *STOCHRSIStream) Peek(inReal float64) (float64, float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*STOCHRSIStream) Update

func (sp *STOCHRSIStream) Update(inReal float64) (float64, float64, error)

Update commits the closed bar inReal and returns its outputs: outFastK and outFastD. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*STOCHRSIStream) Value

func (sp *STOCHRSIStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type STOCHStream

type STOCHStream struct {
	// contains filtered or unexported fields
}

STOCHStream is a live STOCH over a growing series: STOCHStream.Update takes each new closed bar and returns the values Core.STOCH computes at that bar over the same series. Open one with Core.STOCHOpen or Core.STOCHOpenAndFill.

A stream belongs to one goroutine; STOCHStream.Clone forks it.

func (*STOCHStream) Advance

func (sp *STOCHStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*STOCHStream) Clone

func (sp *STOCHStream) Clone() *STOCHStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*STOCHStream) OutRange

func (sp *STOCHStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.STOCH reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*STOCHStream) Peek

func (sp *STOCHStream) Peek(inHigh, inLow, inClose float64) (float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*STOCHStream) Update

func (sp *STOCHStream) Update(inHigh, inLow, inClose float64) (float64, float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outSlowK and outSlowD. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*STOCHStream) Value

func (sp *STOCHStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type SUBStream

type SUBStream struct {
	// contains filtered or unexported fields
}

SUBStream is a live SUB over a growing series: SUBStream.Update takes each new closed bar and returns the value Core.SUB computes at that bar over the same series. Open one with Core.SUBOpen or Core.SUBOpenAndFill.

A stream belongs to one goroutine; SUBStream.Clone forks it.

func (*SUBStream) Advance

func (sp *SUBStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SUBStream) Clone

func (sp *SUBStream) Clone() *SUBStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SUBStream) OutRange

func (sp *SUBStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SUB reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SUBStream) Peek

func (sp *SUBStream) Peek(inReal0, inReal1 float64) (float64, error)

Peek returns what Update would return for the bar (inReal0 and inReal1), changing nothing. It returns BadParam for a bar value that is not finite.

func (*SUBStream) Update

func (sp *SUBStream) Update(inReal0, inReal1 float64) (float64, error)

Update commits one closed bar (inReal0 and inReal1) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SUBStream) Value

func (sp *SUBStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SUMStream

type SUMStream struct {
	// contains filtered or unexported fields
}

SUMStream is a live SUM over a growing series: SUMStream.Update takes each new closed bar and returns the value Core.SUM computes at that bar over the same series. Open one with Core.SUMOpen or Core.SUMOpenAndFill.

A stream belongs to one goroutine; SUMStream.Clone forks it.

func (*SUMStream) Advance

func (sp *SUMStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SUMStream) Clone

func (sp *SUMStream) Clone() *SUMStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SUMStream) OutRange

func (sp *SUMStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SUM reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SUMStream) Peek

func (sp *SUMStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SUMStream) Update

func (sp *SUMStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SUMStream) Value

func (sp *SUMStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SUPERTRENDStream

type SUPERTRENDStream struct {
	// contains filtered or unexported fields
}

SUPERTRENDStream is a live SUPERTREND over a growing series: SUPERTRENDStream.Update takes each new closed bar and returns the values Core.SUPERTREND computes at that bar over the same series. Open one with Core.SUPERTRENDOpen or Core.SUPERTRENDOpenAndFill.

A stream belongs to one goroutine; SUPERTRENDStream.Clone forks it.

func (*SUPERTRENDStream) Advance

func (sp *SUPERTRENDStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SUPERTRENDStream) Clone

func (sp *SUPERTRENDStream) Clone() *SUPERTRENDStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SUPERTRENDStream) OutRange

func (sp *SUPERTRENDStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SUPERTREND reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SUPERTRENDStream) Peek

func (sp *SUPERTRENDStream) Peek(inHigh, inLow, inClose float64) (float64, int32, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*SUPERTRENDStream) Update

func (sp *SUPERTRENDStream) Update(inHigh, inLow, inClose float64) (float64, int32, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outSupertrend and outTrend. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SUPERTRENDStream) Value

func (sp *SUPERTRENDStream) Value() (float64, int32)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type SWAK_2PHPStream

type SWAK_2PHPStream struct {
	// contains filtered or unexported fields
}

SWAK_2PHPStream is a live SWAK_2PHP over a growing series: SWAK_2PHPStream.Update takes each new closed bar and returns the value Core.SWAK_2PHP computes at that bar over the same series. Open one with Core.SWAK_2PHPOpen or Core.SWAK_2PHPOpenAndFill.

A stream belongs to one goroutine; SWAK_2PHPStream.Clone forks it.

func (*SWAK_2PHPStream) Advance

func (sp *SWAK_2PHPStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SWAK_2PHPStream) Clone

func (sp *SWAK_2PHPStream) Clone() *SWAK_2PHPStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SWAK_2PHPStream) OutRange

func (sp *SWAK_2PHPStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SWAK_2PHP reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SWAK_2PHPStream) Peek

func (sp *SWAK_2PHPStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SWAK_2PHPStream) Update

func (sp *SWAK_2PHPStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SWAK_2PHPStream) Value

func (sp *SWAK_2PHPStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SWAK_BPStream

type SWAK_BPStream struct {
	// contains filtered or unexported fields
}

SWAK_BPStream is a live SWAK_BP over a growing series: SWAK_BPStream.Update takes each new closed bar and returns the value Core.SWAK_BP computes at that bar over the same series. Open one with Core.SWAK_BPOpen or Core.SWAK_BPOpenAndFill.

A stream belongs to one goroutine; SWAK_BPStream.Clone forks it.

func (*SWAK_BPStream) Advance

func (sp *SWAK_BPStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SWAK_BPStream) Clone

func (sp *SWAK_BPStream) Clone() *SWAK_BPStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SWAK_BPStream) OutRange

func (sp *SWAK_BPStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SWAK_BP reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SWAK_BPStream) Peek

func (sp *SWAK_BPStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SWAK_BPStream) Update

func (sp *SWAK_BPStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SWAK_BPStream) Value

func (sp *SWAK_BPStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SWAK_BUTTERStream

type SWAK_BUTTERStream struct {
	// contains filtered or unexported fields
}

SWAK_BUTTERStream is a live SWAK_BUTTER over a growing series: SWAK_BUTTERStream.Update takes each new closed bar and returns the value Core.SWAK_BUTTER computes at that bar over the same series. Open one with Core.SWAK_BUTTEROpen or Core.SWAK_BUTTEROpenAndFill.

A stream belongs to one goroutine; SWAK_BUTTERStream.Clone forks it.

func (*SWAK_BUTTERStream) Advance

func (sp *SWAK_BUTTERStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SWAK_BUTTERStream) Clone

func (sp *SWAK_BUTTERStream) Clone() *SWAK_BUTTERStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SWAK_BUTTERStream) OutRange

func (sp *SWAK_BUTTERStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SWAK_BUTTER reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SWAK_BUTTERStream) Peek

func (sp *SWAK_BUTTERStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SWAK_BUTTERStream) Update

func (sp *SWAK_BUTTERStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SWAK_BUTTERStream) Value

func (sp *SWAK_BUTTERStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SWAK_GAUSSStream

type SWAK_GAUSSStream struct {
	// contains filtered or unexported fields
}

SWAK_GAUSSStream is a live SWAK_GAUSS over a growing series: SWAK_GAUSSStream.Update takes each new closed bar and returns the value Core.SWAK_GAUSS computes at that bar over the same series. Open one with Core.SWAK_GAUSSOpen or Core.SWAK_GAUSSOpenAndFill.

A stream belongs to one goroutine; SWAK_GAUSSStream.Clone forks it.

func (*SWAK_GAUSSStream) Advance

func (sp *SWAK_GAUSSStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SWAK_GAUSSStream) Clone

func (sp *SWAK_GAUSSStream) Clone() *SWAK_GAUSSStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SWAK_GAUSSStream) OutRange

func (sp *SWAK_GAUSSStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SWAK_GAUSS reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SWAK_GAUSSStream) Peek

func (sp *SWAK_GAUSSStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SWAK_GAUSSStream) Update

func (sp *SWAK_GAUSSStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SWAK_GAUSSStream) Value

func (sp *SWAK_GAUSSStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type SWAK_HPStream

type SWAK_HPStream struct {
	// contains filtered or unexported fields
}

SWAK_HPStream is a live SWAK_HP over a growing series: SWAK_HPStream.Update takes each new closed bar and returns the value Core.SWAK_HP computes at that bar over the same series. Open one with Core.SWAK_HPOpen or Core.SWAK_HPOpenAndFill.

A stream belongs to one goroutine; SWAK_HPStream.Clone forks it.

func (*SWAK_HPStream) Advance

func (sp *SWAK_HPStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*SWAK_HPStream) Clone

func (sp *SWAK_HPStream) Clone() *SWAK_HPStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*SWAK_HPStream) OutRange

func (sp *SWAK_HPStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.SWAK_HP reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*SWAK_HPStream) Peek

func (sp *SWAK_HPStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*SWAK_HPStream) Update

func (sp *SWAK_HPStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*SWAK_HPStream) Value

func (sp *SWAK_HPStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type T3Stream

type T3Stream struct {
	// contains filtered or unexported fields
}

T3Stream is a live T3 over a growing series: T3Stream.Update takes each new closed bar and returns the value Core.T3 computes at that bar over the same series. Open one with Core.T3Open or Core.T3OpenAndFill.

A stream belongs to one goroutine; T3Stream.Clone forks it.

func (*T3Stream) Advance

func (sp *T3Stream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*T3Stream) Clone

func (sp *T3Stream) Clone() *T3Stream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*T3Stream) OutRange

func (sp *T3Stream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.T3 reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*T3Stream) Peek

func (sp *T3Stream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*T3Stream) Update

func (sp *T3Stream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*T3Stream) Value

func (sp *T3Stream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type TANHStream

type TANHStream struct {
	// contains filtered or unexported fields
}

TANHStream is a live TANH over a growing series: TANHStream.Update takes each new closed bar and returns the value Core.TANH computes at that bar over the same series. Open one with Core.TANHOpen or Core.TANHOpenAndFill.

A stream belongs to one goroutine; TANHStream.Clone forks it.

func (*TANHStream) Advance

func (sp *TANHStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*TANHStream) Clone

func (sp *TANHStream) Clone() *TANHStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*TANHStream) OutRange

func (sp *TANHStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.TANH reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*TANHStream) Peek

func (sp *TANHStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*TANHStream) Update

func (sp *TANHStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*TANHStream) Value

func (sp *TANHStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type TANStream

type TANStream struct {
	// contains filtered or unexported fields
}

TANStream is a live TAN over a growing series: TANStream.Update takes each new closed bar and returns the value Core.TAN computes at that bar over the same series. Open one with Core.TANOpen or Core.TANOpenAndFill.

A stream belongs to one goroutine; TANStream.Clone forks it.

func (*TANStream) Advance

func (sp *TANStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*TANStream) Clone

func (sp *TANStream) Clone() *TANStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*TANStream) OutRange

func (sp *TANStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.TAN reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*TANStream) Peek

func (sp *TANStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*TANStream) Update

func (sp *TANStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*TANStream) Value

func (sp *TANStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type TEMAStream

type TEMAStream struct {
	// contains filtered or unexported fields
}

TEMAStream is a live TEMA over a growing series: TEMAStream.Update takes each new closed bar and returns the value Core.TEMA computes at that bar over the same series. Open one with Core.TEMAOpen or Core.TEMAOpenAndFill.

A stream belongs to one goroutine; TEMAStream.Clone forks it.

func (*TEMAStream) Advance

func (sp *TEMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*TEMAStream) Clone

func (sp *TEMAStream) Clone() *TEMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*TEMAStream) OutRange

func (sp *TEMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.TEMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*TEMAStream) Peek

func (sp *TEMAStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*TEMAStream) Update

func (sp *TEMAStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*TEMAStream) Value

func (sp *TEMAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type TRANGEStream

type TRANGEStream struct {
	// contains filtered or unexported fields
}

TRANGEStream is a live TRANGE over a growing series: TRANGEStream.Update takes each new closed bar and returns the value Core.TRANGE computes at that bar over the same series. Open one with Core.TRANGEOpen or Core.TRANGEOpenAndFill.

A stream belongs to one goroutine; TRANGEStream.Clone forks it.

func (*TRANGEStream) Advance

func (sp *TRANGEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*TRANGEStream) Clone

func (sp *TRANGEStream) Clone() *TRANGEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*TRANGEStream) OutRange

func (sp *TRANGEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.TRANGE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*TRANGEStream) Peek

func (sp *TRANGEStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*TRANGEStream) Update

func (sp *TRANGEStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*TRANGEStream) Value

func (sp *TRANGEStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type TRIMAStream

type TRIMAStream struct {
	// contains filtered or unexported fields
}

TRIMAStream is a live TRIMA over a growing series: TRIMAStream.Update takes each new closed bar and returns the value Core.TRIMA computes at that bar over the same series. Open one with Core.TRIMAOpen or Core.TRIMAOpenAndFill.

A stream belongs to one goroutine; TRIMAStream.Clone forks it.

func (*TRIMAStream) Advance

func (sp *TRIMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*TRIMAStream) Clone

func (sp *TRIMAStream) Clone() *TRIMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*TRIMAStream) OutRange

func (sp *TRIMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.TRIMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*TRIMAStream) Peek

func (sp *TRIMAStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*TRIMAStream) Update

func (sp *TRIMAStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*TRIMAStream) Value

func (sp *TRIMAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type TRIXStream

type TRIXStream struct {
	// contains filtered or unexported fields
}

TRIXStream is a live TRIX over a growing series: TRIXStream.Update takes each new closed bar and returns the value Core.TRIX computes at that bar over the same series. Open one with Core.TRIXOpen or Core.TRIXOpenAndFill.

A stream belongs to one goroutine; TRIXStream.Clone forks it.

func (*TRIXStream) Advance

func (sp *TRIXStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*TRIXStream) Clone

func (sp *TRIXStream) Clone() *TRIXStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*TRIXStream) OutRange

func (sp *TRIXStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.TRIX reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*TRIXStream) Peek

func (sp *TRIXStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*TRIXStream) Update

func (sp *TRIXStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*TRIXStream) Value

func (sp *TRIXStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type TSFStream

type TSFStream struct {
	SumX    float64
	SumXY   float64
	SumY    float64
	Divisor float64
	// contains filtered or unexported fields
}

TSFStream is a live TSF over a growing series: TSFStream.Update takes each new closed bar and returns the value Core.TSF computes at that bar over the same series. Open one with Core.TSFOpen or Core.TSFOpenAndFill.

A stream belongs to one goroutine; TSFStream.Clone forks it.

func (*TSFStream) Advance

func (sp *TSFStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*TSFStream) Clone

func (sp *TSFStream) Clone() *TSFStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*TSFStream) OutRange

func (sp *TSFStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.TSF reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*TSFStream) Peek

func (sp *TSFStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*TSFStream) Update

func (sp *TSFStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*TSFStream) Value

func (sp *TSFStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type TSIStream

type TSIStream struct {
	// contains filtered or unexported fields
}

TSIStream is a live TSI over a growing series: TSIStream.Update takes each new closed bar and returns the value Core.TSI computes at that bar over the same series. Open one with Core.TSIOpen or Core.TSIOpenAndFill.

A stream belongs to one goroutine; TSIStream.Clone forks it.

func (*TSIStream) Advance

func (sp *TSIStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*TSIStream) Clone

func (sp *TSIStream) Clone() *TSIStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*TSIStream) OutRange

func (sp *TSIStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.TSI reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*TSIStream) Peek

func (sp *TSIStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*TSIStream) Update

func (sp *TSIStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*TSIStream) Value

func (sp *TSIStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type TYPPRICEStream

type TYPPRICEStream struct {
	// contains filtered or unexported fields
}

TYPPRICEStream is a live TYPPRICE over a growing series: TYPPRICEStream.Update takes each new closed bar and returns the value Core.TYPPRICE computes at that bar over the same series. Open one with Core.TYPPRICEOpen or Core.TYPPRICEOpenAndFill.

A stream belongs to one goroutine; TYPPRICEStream.Clone forks it.

func (*TYPPRICEStream) Advance

func (sp *TYPPRICEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*TYPPRICEStream) Clone

func (sp *TYPPRICEStream) Clone() *TYPPRICEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*TYPPRICEStream) OutRange

func (sp *TYPPRICEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.TYPPRICE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*TYPPRICEStream) Peek

func (sp *TYPPRICEStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*TYPPRICEStream) Update

func (sp *TYPPRICEStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*TYPPRICEStream) Value

func (sp *TYPPRICEStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ULCERStream

type ULCERStream struct {
	// contains filtered or unexported fields
}

ULCERStream is a live ULCER over a growing series: ULCERStream.Update takes each new closed bar and returns the value Core.ULCER computes at that bar over the same series. Open one with Core.ULCEROpen or Core.ULCEROpenAndFill.

A stream belongs to one goroutine; ULCERStream.Clone forks it.

func (*ULCERStream) Advance

func (sp *ULCERStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ULCERStream) Clone

func (sp *ULCERStream) Clone() *ULCERStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ULCERStream) OutRange

func (sp *ULCERStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ULCER reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ULCERStream) Peek

func (sp *ULCERStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*ULCERStream) Update

func (sp *ULCERStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ULCERStream) Value

func (sp *ULCERStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ULCER_ROLLStream

type ULCER_ROLLStream struct {
	// contains filtered or unexported fields
}

ULCER_ROLLStream is a live ULCER_ROLL over a growing series: ULCER_ROLLStream.Update takes each new closed bar and returns the value Core.ULCER_ROLL computes at that bar over the same series. Open one with Core.ULCER_ROLLOpen or Core.ULCER_ROLLOpenAndFill.

A stream belongs to one goroutine; ULCER_ROLLStream.Clone forks it.

func (*ULCER_ROLLStream) Advance

func (sp *ULCER_ROLLStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ULCER_ROLLStream) Clone

func (sp *ULCER_ROLLStream) Clone() *ULCER_ROLLStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ULCER_ROLLStream) OutRange

func (sp *ULCER_ROLLStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ULCER_ROLL reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ULCER_ROLLStream) Peek

func (sp *ULCER_ROLLStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*ULCER_ROLLStream) Update

func (sp *ULCER_ROLLStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ULCER_ROLLStream) Value

func (sp *ULCER_ROLLStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ULTOSCStream

type ULTOSCStream struct {
	// contains filtered or unexported fields
}

ULTOSCStream is a live ULTOSC over a growing series: ULTOSCStream.Update takes each new closed bar and returns the value Core.ULTOSC computes at that bar over the same series. Open one with Core.ULTOSCOpen or Core.ULTOSCOpenAndFill.

A stream belongs to one goroutine; ULTOSCStream.Clone forks it.

func (*ULTOSCStream) Advance

func (sp *ULTOSCStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ULTOSCStream) Clone

func (sp *ULTOSCStream) Clone() *ULTOSCStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ULTOSCStream) OutRange

func (sp *ULTOSCStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ULTOSC reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ULTOSCStream) Peek

func (sp *ULTOSCStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ULTOSCStream) Update

func (sp *ULTOSCStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ULTOSCStream) Value

func (sp *ULTOSCStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type VARStream

type VARStream struct {
	// contains filtered or unexported fields
}

VARStream is a live VAR over a growing series: VARStream.Update takes each new closed bar and returns the value Core.VAR computes at that bar over the same series. Open one with Core.VAROpen or Core.VAROpenAndFill.

A stream belongs to one goroutine; VARStream.Clone forks it.

func (*VARStream) Advance

func (sp *VARStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*VARStream) Clone

func (sp *VARStream) Clone() *VARStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*VARStream) OutRange

func (sp *VARStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.VAR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*VARStream) Peek

func (sp *VARStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*VARStream) Update

func (sp *VARStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*VARStream) Value

func (sp *VARStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type VHFStream

type VHFStream struct {
	// contains filtered or unexported fields
}

VHFStream is a live VHF over a growing series: VHFStream.Update takes each new closed bar and returns the value Core.VHF computes at that bar over the same series. Open one with Core.VHFOpen or Core.VHFOpenAndFill.

A stream belongs to one goroutine; VHFStream.Clone forks it.

func (*VHFStream) Advance

func (sp *VHFStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*VHFStream) Clone

func (sp *VHFStream) Clone() *VHFStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*VHFStream) OutRange

func (sp *VHFStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.VHF reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*VHFStream) Peek

func (sp *VHFStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*VHFStream) Update

func (sp *VHFStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*VHFStream) Value

func (sp *VHFStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type VIDYAStream

type VIDYAStream struct {
	// contains filtered or unexported fields
}

VIDYAStream is a live VIDYA over a growing series: VIDYAStream.Update takes each new closed bar and returns the value Core.VIDYA computes at that bar over the same series. Open one with Core.VIDYAOpen or Core.VIDYAOpenAndFill.

A stream belongs to one goroutine; VIDYAStream.Clone forks it.

func (*VIDYAStream) Advance

func (sp *VIDYAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*VIDYAStream) Clone

func (sp *VIDYAStream) Clone() *VIDYAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*VIDYAStream) OutRange

func (sp *VIDYAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.VIDYA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*VIDYAStream) Peek

func (sp *VIDYAStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*VIDYAStream) Update

func (sp *VIDYAStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*VIDYAStream) Value

func (sp *VIDYAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type VORTEXStream

type VORTEXStream struct {
	// contains filtered or unexported fields
}

VORTEXStream is a live VORTEX over a growing series: VORTEXStream.Update takes each new closed bar and returns the values Core.VORTEX computes at that bar over the same series. Open one with Core.VORTEXOpen or Core.VORTEXOpenAndFill.

A stream belongs to one goroutine; VORTEXStream.Clone forks it.

func (*VORTEXStream) Advance

func (sp *VORTEXStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*VORTEXStream) Clone

func (sp *VORTEXStream) Clone() *VORTEXStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*VORTEXStream) OutRange

func (sp *VORTEXStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.VORTEX reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*VORTEXStream) Peek

func (sp *VORTEXStream) Peek(inHigh, inLow, inClose float64) (float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*VORTEXStream) Update

func (sp *VORTEXStream) Update(inHigh, inLow, inClose float64) (float64, float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outPlusVI and outMinusVI. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*VORTEXStream) Value

func (sp *VORTEXStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type VWAPStream

type VWAPStream struct {
	// contains filtered or unexported fields
}

VWAPStream is a live VWAP over a growing series: VWAPStream.Update takes each new closed bar and returns the value Core.VWAP computes at that bar over the same series. Open one with Core.VWAPOpen or Core.VWAPOpenAndFill.

A stream belongs to one goroutine; VWAPStream.Clone forks it.

func (*VWAPStream) Advance

func (sp *VWAPStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*VWAPStream) Clone

func (sp *VWAPStream) Clone() *VWAPStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*VWAPStream) OutRange

func (sp *VWAPStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.VWAP reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*VWAPStream) Peek

func (sp *VWAPStream) Peek(inHigh, inLow, inClose, inVolume float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow, inClose and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*VWAPStream) Update

func (sp *VWAPStream) Update(inHigh, inLow, inClose, inVolume float64) (float64, error)

Update commits one closed bar (inHigh, inLow, inClose and inVolume) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*VWAPStream) Value

func (sp *VWAPStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type VWMAStream

type VWMAStream struct {
	// contains filtered or unexported fields
}

VWMAStream is a live VWMA over a growing series: VWMAStream.Update takes each new closed bar and returns the value Core.VWMA computes at that bar over the same series. Open one with Core.VWMAOpen or Core.VWMAOpenAndFill.

A stream belongs to one goroutine; VWMAStream.Clone forks it.

func (*VWMAStream) Advance

func (sp *VWMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*VWMAStream) Clone

func (sp *VWMAStream) Clone() *VWMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*VWMAStream) OutRange

func (sp *VWMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.VWMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*VWMAStream) Peek

func (sp *VWMAStream) Peek(inReal, inVolume float64) (float64, error)

Peek returns what Update would return for the bar (inReal and inVolume), changing nothing. It returns BadParam for a bar value that is not finite.

func (*VWMAStream) Update

func (sp *VWMAStream) Update(inReal, inVolume float64) (float64, error)

Update commits one closed bar (inReal and inVolume) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*VWMAStream) Value

func (sp *VWMAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type WADStream

type WADStream struct {
	// contains filtered or unexported fields
}

WADStream is a live WAD over a growing series: WADStream.Update takes each new closed bar and returns the value Core.WAD computes at that bar over the same series. Open one with Core.WADOpen or Core.WADOpenAndFill.

A stream belongs to one goroutine; WADStream.Clone forks it.

func (*WADStream) Advance

func (sp *WADStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*WADStream) Clone

func (sp *WADStream) Clone() *WADStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*WADStream) OutRange

func (sp *WADStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.WAD reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*WADStream) Peek

func (sp *WADStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*WADStream) Update

func (sp *WADStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*WADStream) Value

func (sp *WADStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type WAVETRENDStream

type WAVETRENDStream struct {
	// contains filtered or unexported fields
}

WAVETRENDStream is a live WAVETREND over a growing series: WAVETRENDStream.Update takes each new closed bar and returns the values Core.WAVETREND computes at that bar over the same series. Open one with Core.WAVETRENDOpen or Core.WAVETRENDOpenAndFill.

A stream belongs to one goroutine; WAVETRENDStream.Clone forks it.

func (*WAVETRENDStream) Advance

func (sp *WAVETRENDStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*WAVETRENDStream) Clone

func (sp *WAVETRENDStream) Clone() *WAVETRENDStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*WAVETRENDStream) OutRange

func (sp *WAVETRENDStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.WAVETREND reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*WAVETRENDStream) Peek

func (sp *WAVETRENDStream) Peek(inHigh, inLow, inClose float64) (float64, float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*WAVETRENDStream) Update

func (sp *WAVETRENDStream) Update(inHigh, inLow, inClose float64) (float64, float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns its outputs: outWT1 and outWT2. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*WAVETRENDStream) Value

func (sp *WAVETRENDStream) Value() (float64, float64)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type WCLPRICEStream

type WCLPRICEStream struct {
	// contains filtered or unexported fields
}

WCLPRICEStream is a live WCLPRICE over a growing series: WCLPRICEStream.Update takes each new closed bar and returns the value Core.WCLPRICE computes at that bar over the same series. Open one with Core.WCLPRICEOpen or Core.WCLPRICEOpenAndFill.

A stream belongs to one goroutine; WCLPRICEStream.Clone forks it.

func (*WCLPRICEStream) Advance

func (sp *WCLPRICEStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*WCLPRICEStream) Clone

func (sp *WCLPRICEStream) Clone() *WCLPRICEStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*WCLPRICEStream) OutRange

func (sp *WCLPRICEStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.WCLPRICE reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*WCLPRICEStream) Peek

func (sp *WCLPRICEStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*WCLPRICEStream) Update

func (sp *WCLPRICEStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*WCLPRICEStream) Value

func (sp *WCLPRICEStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type WILLRStream

type WILLRStream struct {
	// contains filtered or unexported fields
}

WILLRStream is a live WILLR over a growing series: WILLRStream.Update takes each new closed bar and returns the value Core.WILLR computes at that bar over the same series. Open one with Core.WILLROpen or Core.WILLROpenAndFill.

A stream belongs to one goroutine; WILLRStream.Clone forks it.

func (*WILLRStream) Advance

func (sp *WILLRStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*WILLRStream) Clone

func (sp *WILLRStream) Clone() *WILLRStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*WILLRStream) OutRange

func (sp *WILLRStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.WILLR reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*WILLRStream) Peek

func (sp *WILLRStream) Peek(inHigh, inLow, inClose float64) (float64, error)

Peek returns what Update would return for the bar (inHigh, inLow and inClose), changing nothing. It returns BadParam for a bar value that is not finite.

func (*WILLRStream) Update

func (sp *WILLRStream) Update(inHigh, inLow, inClose float64) (float64, error)

Update commits one closed bar (inHigh, inLow and inClose) and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*WILLRStream) Value

func (sp *WILLRStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type WMAStream

type WMAStream struct {
	// contains filtered or unexported fields
}

WMAStream is a live WMA over a growing series: WMAStream.Update takes each new closed bar and returns the value Core.WMA computes at that bar over the same series. Open one with Core.WMAOpen or Core.WMAOpenAndFill.

A stream belongs to one goroutine; WMAStream.Clone forks it.

func (*WMAStream) Advance

func (sp *WMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*WMAStream) Clone

func (sp *WMAStream) Clone() *WMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*WMAStream) OutRange

func (sp *WMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.WMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*WMAStream) Peek

func (sp *WMAStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*WMAStream) Update

func (sp *WMAStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*WMAStream) Value

func (sp *WMAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

type ZIGZAGStream

type ZIGZAGStream struct {
	// contains filtered or unexported fields
}

ZIGZAGStream is a live ZIGZAG over a growing series: ZIGZAGStream.Update takes each new closed bar and returns the values Core.ZIGZAG computes at that bar over the same series. Open one with Core.ZIGZAGOpen or Core.ZIGZAGOpenAndFill.

A stream belongs to one goroutine; ZIGZAGStream.Clone forks it.

func (*ZIGZAGStream) Advance

func (sp *ZIGZAGStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ZIGZAGStream) Clone

func (sp *ZIGZAGStream) Clone() *ZIGZAGStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ZIGZAGStream) OutRange

func (sp *ZIGZAGStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ZIGZAG reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ZIGZAGStream) Peek

func (sp *ZIGZAGStream) Peek(inHigh, inLow float64) (float64, int32, int32, error)

Peek returns what Update would return for the bar (inHigh and inLow), changing nothing. It returns BadParam for a bar value that is not finite.

func (*ZIGZAGStream) Update

func (sp *ZIGZAGStream) Update(inHigh, inLow float64) (float64, int32, int32, error)

Update commits one closed bar (inHigh and inLow) and returns its outputs: outZigZag, outTrend and outPivotIdx. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ZIGZAGStream) Value

func (sp *ZIGZAGStream) Value() (float64, int32, int32)

Value returns the outputs at the last bar of OutRange, in Update's order; Peek does not change them.

type ZLEMAStream

type ZLEMAStream struct {
	// contains filtered or unexported fields
}

ZLEMAStream is a live ZLEMA over a growing series: ZLEMAStream.Update takes each new closed bar and returns the value Core.ZLEMA computes at that bar over the same series. Open one with Core.ZLEMAOpen or Core.ZLEMAOpenAndFill.

A stream belongs to one goroutine; ZLEMAStream.Clone forks it.

func (*ZLEMAStream) Advance

func (sp *ZLEMAStream) Advance() error

Advance counts one bar the stream was not fed: OutRange grows by one and Value keeps its previous answer. It returns OutOfRangeEndIndex once OutRange reaches bar IndexMax.

func (*ZLEMAStream) Clone

func (sp *ZLEMAStream) Clone() *ZLEMAStream

Clone returns an independent copy of the stream at the same bar: the two evolve separately and share only the Core.

func (*ZLEMAStream) OutRange

func (sp *ZLEMAStream) OutRange() OutRange

OutRange returns the bars the stream has a value for, as Core.ZLEMA reports them over the same bars; each Update and each Advance adds one to NBElement.

func (*ZLEMAStream) Peek

func (sp *ZLEMAStream) Peek(inReal float64) (float64, error)

Peek returns what Update would return for the bar inReal, changing nothing. It returns BadParam for a bar value that is not finite.

func (*ZLEMAStream) Update

func (sp *ZLEMAStream) Update(inReal float64) (float64, error)

Update commits the closed bar inReal and returns the new value. It returns BadParam for a bar value that is not finite and OutOfRangeEndIndex once OutRange reaches bar IndexMax, both before anything changes.

func (*ZLEMAStream) Value

func (sp *ZLEMAStream) Value() float64

Value returns the value at the last bar of OutRange; Peek does not change it.

Source Files

Directories

Path Synopsis
Package abstract describes every TA-Lib function at run time and calls one chosen by name: the Go form of TA-Lib's Abstract API.
Package abstract describes every TA-Lib function at run time and calls one chosen by name: the Go form of TA-Lib's Abstract API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL