ta

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

README

ta-lib-cgo

Go bindings for TA-Lib that embed the C source directly — no system library installation required. Users need only go get. A working CGO environment is the only requirement, works out of the box with typical Go toolchain installations.

Note: The maintainers of TA-Lib have graciously accepted this project under the official TA-Lib GitHub organization. The import path has changed to github.com/TA-Lib/ta-lib-cgo and this is the canonical location going forward.

Quick start

import ta "github.com/TA-Lib/ta-lib-cgo"

// SMA over 10 prices with a 3-bar period.
prices := []float64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
result := ta.Sma(prices, 3, nil)
// result: [NaN, NaN, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]

// MACD.
macd, signal, hist := ta.Macd(prices, 12, 26, 9, nil, nil, nil)

outBuf pattern

Pass a slice as the last argument(s) to reuse an existing buffer and avoid allocation:

buf := make([]float64, 0, 1000) // allocate once

for _, batch := range batches {
    result := ta.Sma(batch, 20, buf) // reuses buf if cap >= len(batch)
    process(result)
    buf = result // keep the buffer for next iteration
}

If outBuf is nil or its capacity is less than the input length, a new slice is allocated.

Lookback and NaN padding

All output slices have the same length as the input. The first Lookback positions are filled with NaN (the "warmup" period where insufficient data exists for a valid output).

lb := ta.SmaLookback(3) // returns 2
// The first 2 values of Sma(..., 3, nil) will be NaN.

Use lookback functions to sub-slice into valid data:

result := ta.Sma(prices, 20, nil)
lb := ta.SmaLookback(20)
validResult := result[lb:] // only valid (non-NaN) values

Platform support

Requires CGO. Tested on macOS, Linux, and Windows 11 (MSYS2/GCC).

Windows setup (MSYS2)
  1. Download and install MSYS2.
  2. From the MSYS2 terminal, install GCC and Go:
    pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-go
    
  3. Use your project as normal — go build and go test work out of the box.

Or feel free to try using other C compilers, untested but might work just fine.

Rationale

Existing Go TA-Lib approaches have significant trade-offs:

  • Pure-Go reimplementations diverge from the reference C implementation and require ongoing maintenance to stay in sync. Any upstream bug fix or edge-case change must be manually ported.
  • System-library wrappers require TA-Lib to be pre-installed (apt install, brew install, etc.), complicating builds, CI, and distribution — especially across macOS and Linux.

This library takes a different approach: the TA-Lib C source is embedded directly as an amalgamation file (talib_amalgamation.c), committed to the repository. CGO compiles it as part of the normal go build. Algorithm correctness is guaranteed by the upstream C implementation, and you get a single go get with no external dependencies.

The API is designed for high-frequency and batch processing workloads. Callers control output allocation via the outBuf parameter pattern — buffers can be reused across calls to eliminate allocations in tight loops.

Tests

A sensible set of tests are included, some of them generated. The objective with the test suite is to provide some decent coverage that provides some proof this thing actually works, while not introducing a significant maintenance burden of trying to exhaustively prove what TA-Lib already implements and handles.

Maintenance - Updating TA-Lib

If you wish to do work on this wrapper library or update it, you can:

  • Edit the version tag in the //go:generate directive in talib.go as needed.
  • Run go generate from the repository root.
  • Run go test -v -count=1 ./... to make sure it's all working
  • Commit include/, talib_amalgamation.c, and *_gen.go files.

The go generate step requires additional tooling including CMake and uv. It will download the TA-Lib source and (re)generate the various function wrappers and test code. Python (handled via uv) is used to generate sample outputs using it's own TA-Lib bindings which we then verify in Go tests.

Note that it's always possible some structural change in a new TA-Lib version will require the generator code to be updated. YMMV.

Versioning

This module uses its own semver sequence independent of TA-Lib's version numbering. The embedded TA-Lib version is available at runtime via the TALibVersion constant and is the single source of truth in the //go:generate directive in talib.go. (The reasoning: mirroring TA-Lib versions (e.g. v0.6.4) leaves no room for Go-side fixes without inventing non-standard version suffixes.)

To release a new version:

  1. Edit the version in the //go:generate line in talib.go:
    //go:generate go run ./cmd/gen v0.7.0
    
  2. Run codegen and tests:
    go generate
    go test -v -count=1 ./...
    
  3. Commit all regenerated files (include/, talib_amalgamation.c, *_gen.go).
  4. Tag a new minor version noting the TA-Lib bump:
    git tag -a v0.2.0 -m "Update to TA-Lib v0.7.0"
    git push origin v0.2.0
    

Repository structure

ta-lib-cgo
│
│   # Hand-written, committed once
├── talib.go                  CGO directives, init(), buffer/pointer helpers
├── errors.go                 TALibError type, retCodeMessage()
│
│   # Generated by cmd/gen — committed, do not edit by hand
├── talib_amalgamation.c      All TA-Lib .c files concatenated into one
├── errors_gen.go             retCodeMessages map (from ta_retcode.csv)
├── functions_gen.go          Go wrapper for every TA-Lib indicator
├── lookback_gen.go           XxxLookback() companion for every indicator
├── version_gen.go            TALibVersion constant
│
│   # Test files
├── talib_test.go             Shape/invariant/behavior tests (no fixtures needed)
├── golden_test.go            Fixture-based tests; skips if testdata/ missing
│
│   # Committed headers (populated by cmd/gen)
├── include/
│   ├── ta_libc.h             Public TA-Lib headers
│   ├── ta_func.h
│   ├── ta_common.h
│   ├── ta_defs.h
│   ├── ta_abstract.h
│   ├── ta_config.h           Generated by cmake during go generate
│   └── *.h                   Internal headers copied from src/ subdirectories
│
│   # Committed test fixtures (generated by scripts/gen_fixtures.py)
├── testdata/
│   ├── input.csv             Synthetic OHLCV input (200 bars, fixed seed)
│   └── expected/
│       ├── sma_10.csv        Expected outputs from Python ta-lib reference
│       ├── macd_12_26_9.csv
│       └── atr_14.csv
│
│   # Code generation tool
└── cmd/
    └── gen/
        └── main.go           Clones TA-Lib, runs cmake, builds amalgamation,
                              generates *_gen.go files; invoked via go generate

    # Python fixture generator and benchmarks (require uv)
└── scripts/
    ├── gen_fixtures.py       Generates testdata/ using Python ta-lib as an
    │                         independent reference; invoked via go generate
    └── bench.py              Python benchmark counterpart for perf comparison

Performance

Since both this library and Python's ta-lib package wrap the same C code, per-call performance should be equivalent. This was verified on Apple M1 Max with SMA, MACD, and ATR at 1k and 100k bars — Go with buffer reuse and Python were within noise of each other at every size. At 100k bars both are purely measuring the C library.

To reproduce:

# Go
go test -bench=. -benchmem -benchtime=3s -run='^$'

# Python (requires uv)
uv run ./scripts/bench.py

Documentation

Index

Constants

View Source
const TALibVersion = "0.6.4"

TALibVersion is the version of the TA-Lib C library embedded in this module.

Variables

This section is empty.

Functions

func Accbands

func Accbands(high []float64, low []float64, closePrice []float64, timePeriod int, upperBandBuf []float64, middleBandBuf []float64, lowerBandBuf []float64) (outRealUpperBand []float64, outRealMiddleBand []float64, outRealLowerBand []float64)

Accbands - Acceleration Bands

Input = High, Low, Close

Output = double, double, double

Parameters:

  • timePeriod (2 to 100000): Number of period

func AccbandsLookback

func AccbandsLookback(timePeriod int) int

AccbandsLookback returns the number of input values consumed before the first valid output.

func Acos

func Acos(in []float64, realBuf []float64) (outReal []float64)

Acos - Vector Trigonometric ACos

Input = double

Output = double

func AcosLookback

func AcosLookback() int

AcosLookback returns the number of input values consumed before the first valid output.

func Ad(high []float64, low []float64, closePrice []float64, volume []float64, realBuf []float64) (outReal []float64)

Ad - Chaikin A/D Line

Input = High, Low, Close, Volume

Output = double

func AdLookback

func AdLookback() int

AdLookback returns the number of input values consumed before the first valid output.

func Add

func Add(in0 []float64, in1 []float64, realBuf []float64) (outReal []float64)

Add - Vector Arithmetic Add

Input = double, double

Output = double

func AddLookback

func AddLookback() int

AddLookback returns the number of input values consumed before the first valid output.

func Adosc

func Adosc(high []float64, low []float64, closePrice []float64, volume []float64, fastPeriod int, slowPeriod int, realBuf []float64) (outReal []float64)

Adosc - Chaikin A/D Oscillator

Input = High, Low, Close, Volume

Output = double

Parameters:

  • fastPeriod (2 to 100000): Number of period for the fast MA
  • slowPeriod (2 to 100000): Number of period for the slow MA

func AdoscLookback

func AdoscLookback(fastPeriod int, slowPeriod int) int

AdoscLookback returns the number of input values consumed before the first valid output.

func Adx

func Adx(high []float64, low []float64, closePrice []float64, timePeriod int, realBuf []float64) (outReal []float64)

Adx - Average Directional Movement Index

Input = High, Low, Close

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func AdxLookback

func AdxLookback(timePeriod int) int

AdxLookback returns the number of input values consumed before the first valid output.

func Adxr

func Adxr(high []float64, low []float64, closePrice []float64, timePeriod int, realBuf []float64) (outReal []float64)

Adxr - Average Directional Movement Index Rating

Input = High, Low, Close

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func AdxrLookback

func AdxrLookback(timePeriod int) int

AdxrLookback returns the number of input values consumed before the first valid output.

func Apo

func Apo(in []float64, fastPeriod int, slowPeriod int, mAType int, realBuf []float64) (outReal []float64)

Apo - Absolute Price Oscillator

Input = double

Output = double

Parameters:

  • fastPeriod (2 to 100000): Number of period for the fast MA
  • slowPeriod (2 to 100000): Number of period for the slow MA
  • mAType: Type of Moving Average

func ApoLookback

func ApoLookback(fastPeriod int, slowPeriod int, mAType int) int

ApoLookback returns the number of input values consumed before the first valid output.

func Aroon

func Aroon(high []float64, low []float64, timePeriod int, aroonDownBuf []float64, aroonUpBuf []float64) (outAroonDown []float64, outAroonUp []float64)

Aroon - Aroon

Input = High, Low

Output = double, double

Parameters:

  • timePeriod (2 to 100000): Number of period

func AroonLookback

func AroonLookback(timePeriod int) int

AroonLookback returns the number of input values consumed before the first valid output.

func Aroonosc

func Aroonosc(high []float64, low []float64, timePeriod int, realBuf []float64) (outReal []float64)

Aroonosc - Aroon Oscillator

Input = High, Low

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func AroonoscLookback

func AroonoscLookback(timePeriod int) int

AroonoscLookback returns the number of input values consumed before the first valid output.

func Asin

func Asin(in []float64, realBuf []float64) (outReal []float64)

Asin - Vector Trigonometric ASin

Input = double

Output = double

func AsinLookback

func AsinLookback() int

AsinLookback returns the number of input values consumed before the first valid output.

func Atan

func Atan(in []float64, realBuf []float64) (outReal []float64)

Atan - Vector Trigonometric ATan

Input = double

Output = double

func AtanLookback

func AtanLookback() int

AtanLookback returns the number of input values consumed before the first valid output.

func Atr

func Atr(high []float64, low []float64, closePrice []float64, timePeriod int, realBuf []float64) (outReal []float64)

Atr - Average True Range

Input = High, Low, Close

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func AtrLookback

func AtrLookback(timePeriod int) int

AtrLookback returns the number of input values consumed before the first valid output.

func Avgdev

func Avgdev(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Avgdev - Average Deviation

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func AvgdevLookback

func AvgdevLookback(timePeriod int) int

AvgdevLookback returns the number of input values consumed before the first valid output.

func Avgprice

func Avgprice(open []float64, high []float64, low []float64, closePrice []float64, realBuf []float64) (outReal []float64)

Avgprice - Average Price

Input = Open, High, Low, Close

Output = double

func AvgpriceLookback

func AvgpriceLookback() int

AvgpriceLookback returns the number of input values consumed before the first valid output.

func Bbands

func Bbands(in []float64, timePeriod int, nbDevUp float64, nbDevDn float64, mAType int, upperBandBuf []float64, middleBandBuf []float64, lowerBandBuf []float64) (outRealUpperBand []float64, outRealMiddleBand []float64, outRealLowerBand []float64)

Bbands - Bollinger Bands

Input = double

Output = double, double, double

Parameters:

  • timePeriod (2 to 100000): Number of period
  • nbDevUp (TA_REAL_MIN to TA_REAL_MAX): Deviation multiplier for upper band
  • nbDevDn (TA_REAL_MIN to TA_REAL_MAX): Deviation multiplier for lower band
  • mAType: Type of Moving Average

func BbandsLookback

func BbandsLookback(timePeriod int, nbDevUp float64, nbDevDn float64, mAType int) int

BbandsLookback returns the number of input values consumed before the first valid output.

func Beta

func Beta(in0 []float64, in1 []float64, timePeriod int, realBuf []float64) (outReal []float64)

Beta - Beta

Input = double, double

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func BetaLookback

func BetaLookback(timePeriod int) int

BetaLookback returns the number of input values consumed before the first valid output.

func Bop

func Bop(open []float64, high []float64, low []float64, closePrice []float64, realBuf []float64) (outReal []float64)

Bop - Balance Of Power

Input = Open, High, Low, Close

Output = double

func BopLookback

func BopLookback() int

BopLookback returns the number of input values consumed before the first valid output.

func Cci

func Cci(high []float64, low []float64, closePrice []float64, timePeriod int, realBuf []float64) (outReal []float64)

Cci - Commodity Channel Index

Input = High, Low, Close

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func CciLookback

func CciLookback(timePeriod int) int

CciLookback returns the number of input values consumed before the first valid output.

func Cdl2crows

func Cdl2crows(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdl2crows - Two Crows

Input = Open, High, Low, Close

Output = int

func Cdl2crowsLookback

func Cdl2crowsLookback() int

Cdl2crowsLookback returns the number of input values consumed before the first valid output.

func Cdl3blackcrows

func Cdl3blackcrows(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdl3blackcrows - Three Black Crows

Input = Open, High, Low, Close

Output = int

func Cdl3blackcrowsLookback

func Cdl3blackcrowsLookback() int

Cdl3blackcrowsLookback returns the number of input values consumed before the first valid output.

func Cdl3inside

func Cdl3inside(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdl3inside - Three Inside Up/Down

Input = Open, High, Low, Close

Output = int

func Cdl3insideLookback

func Cdl3insideLookback() int

Cdl3insideLookback returns the number of input values consumed before the first valid output.

func Cdl3linestrike

func Cdl3linestrike(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdl3linestrike - Three-Line Strike

Input = Open, High, Low, Close

Output = int

func Cdl3linestrikeLookback

func Cdl3linestrikeLookback() int

Cdl3linestrikeLookback returns the number of input values consumed before the first valid output.

func Cdl3outside

func Cdl3outside(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdl3outside - Three Outside Up/Down

Input = Open, High, Low, Close

Output = int

func Cdl3outsideLookback

func Cdl3outsideLookback() int

Cdl3outsideLookback returns the number of input values consumed before the first valid output.

func Cdl3starsinsouth

func Cdl3starsinsouth(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdl3starsinsouth - Three Stars In The South

Input = Open, High, Low, Close

Output = int

func Cdl3starsinsouthLookback

func Cdl3starsinsouthLookback() int

Cdl3starsinsouthLookback returns the number of input values consumed before the first valid output.

func Cdl3whitesoldiers

func Cdl3whitesoldiers(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdl3whitesoldiers - Three Advancing White Soldiers

Input = Open, High, Low, Close

Output = int

func Cdl3whitesoldiersLookback

func Cdl3whitesoldiersLookback() int

Cdl3whitesoldiersLookback returns the number of input values consumed before the first valid output.

func Cdlabandonedbaby

func Cdlabandonedbaby(open []float64, high []float64, low []float64, closePrice []float64, penetration float64, integerBuf []int32) (outInteger []int32)

Cdlabandonedbaby - Abandoned Baby

Input = Open, High, Low, Close

Output = int

Parameters:

  • penetration (0 to TA_REAL_MAX): Percentage of penetration of a candle within another candle

func CdlabandonedbabyLookback

func CdlabandonedbabyLookback(penetration float64) int

CdlabandonedbabyLookback returns the number of input values consumed before the first valid output.

func Cdladvanceblock

func Cdladvanceblock(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdladvanceblock - Advance Block

Input = Open, High, Low, Close

Output = int

func CdladvanceblockLookback

func CdladvanceblockLookback() int

CdladvanceblockLookback returns the number of input values consumed before the first valid output.

func Cdlbelthold

func Cdlbelthold(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlbelthold - Belt-hold

Input = Open, High, Low, Close

Output = int

func CdlbeltholdLookback

func CdlbeltholdLookback() int

CdlbeltholdLookback returns the number of input values consumed before the first valid output.

func Cdlbreakaway

func Cdlbreakaway(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlbreakaway - Breakaway

Input = Open, High, Low, Close

Output = int

func CdlbreakawayLookback

func CdlbreakawayLookback() int

CdlbreakawayLookback returns the number of input values consumed before the first valid output.

func Cdlclosingmarubozu

func Cdlclosingmarubozu(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlclosingmarubozu - Closing Marubozu

Input = Open, High, Low, Close

Output = int

func CdlclosingmarubozuLookback

func CdlclosingmarubozuLookback() int

CdlclosingmarubozuLookback returns the number of input values consumed before the first valid output.

func Cdlconcealbabyswall

func Cdlconcealbabyswall(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlconcealbabyswall - Concealing Baby Swallow

Input = Open, High, Low, Close

Output = int

func CdlconcealbabyswallLookback

func CdlconcealbabyswallLookback() int

CdlconcealbabyswallLookback returns the number of input values consumed before the first valid output.

func Cdlcounterattack

func Cdlcounterattack(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlcounterattack - Counterattack

Input = Open, High, Low, Close

Output = int

func CdlcounterattackLookback

func CdlcounterattackLookback() int

CdlcounterattackLookback returns the number of input values consumed before the first valid output.

func Cdldarkcloudcover

func Cdldarkcloudcover(open []float64, high []float64, low []float64, closePrice []float64, penetration float64, integerBuf []int32) (outInteger []int32)

Cdldarkcloudcover - Dark Cloud Cover

Input = Open, High, Low, Close

Output = int

Parameters:

  • penetration (0 to TA_REAL_MAX): Percentage of penetration of a candle within another candle

func CdldarkcloudcoverLookback

func CdldarkcloudcoverLookback(penetration float64) int

CdldarkcloudcoverLookback returns the number of input values consumed before the first valid output.

func Cdldoji

func Cdldoji(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdldoji - Doji

Input = Open, High, Low, Close

Output = int

func CdldojiLookback

func CdldojiLookback() int

CdldojiLookback returns the number of input values consumed before the first valid output.

func Cdldojistar

func Cdldojistar(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdldojistar - Doji Star

Input = Open, High, Low, Close

Output = int

func CdldojistarLookback

func CdldojistarLookback() int

CdldojistarLookback returns the number of input values consumed before the first valid output.

func Cdldragonflydoji

func Cdldragonflydoji(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdldragonflydoji - Dragonfly Doji

Input = Open, High, Low, Close

Output = int

func CdldragonflydojiLookback

func CdldragonflydojiLookback() int

CdldragonflydojiLookback returns the number of input values consumed before the first valid output.

func Cdlengulfing

func Cdlengulfing(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlengulfing - Engulfing Pattern

Input = Open, High, Low, Close

Output = int

func CdlengulfingLookback

func CdlengulfingLookback() int

CdlengulfingLookback returns the number of input values consumed before the first valid output.

func Cdleveningdojistar

func Cdleveningdojistar(open []float64, high []float64, low []float64, closePrice []float64, penetration float64, integerBuf []int32) (outInteger []int32)

Cdleveningdojistar - Evening Doji Star

Input = Open, High, Low, Close

Output = int

Parameters:

  • penetration (0 to TA_REAL_MAX): Percentage of penetration of a candle within another candle

func CdleveningdojistarLookback

func CdleveningdojistarLookback(penetration float64) int

CdleveningdojistarLookback returns the number of input values consumed before the first valid output.

func Cdleveningstar

func Cdleveningstar(open []float64, high []float64, low []float64, closePrice []float64, penetration float64, integerBuf []int32) (outInteger []int32)

Cdleveningstar - Evening Star

Input = Open, High, Low, Close

Output = int

Parameters:

  • penetration (0 to TA_REAL_MAX): Percentage of penetration of a candle within another candle

func CdleveningstarLookback

func CdleveningstarLookback(penetration float64) int

CdleveningstarLookback returns the number of input values consumed before the first valid output.

func Cdlgapsidesidewhite

func Cdlgapsidesidewhite(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlgapsidesidewhite - Up/Down-gap side-by-side white lines

Input = Open, High, Low, Close

Output = int

func CdlgapsidesidewhiteLookback

func CdlgapsidesidewhiteLookback() int

CdlgapsidesidewhiteLookback returns the number of input values consumed before the first valid output.

func Cdlgravestonedoji

func Cdlgravestonedoji(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlgravestonedoji - Gravestone Doji

Input = Open, High, Low, Close

Output = int

func CdlgravestonedojiLookback

func CdlgravestonedojiLookback() int

CdlgravestonedojiLookback returns the number of input values consumed before the first valid output.

func Cdlhammer

func Cdlhammer(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlhammer - Hammer

Input = Open, High, Low, Close

Output = int

func CdlhammerLookback

func CdlhammerLookback() int

CdlhammerLookback returns the number of input values consumed before the first valid output.

func Cdlhangingman

func Cdlhangingman(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlhangingman - Hanging Man

Input = Open, High, Low, Close

Output = int

func CdlhangingmanLookback

func CdlhangingmanLookback() int

CdlhangingmanLookback returns the number of input values consumed before the first valid output.

func Cdlharami

func Cdlharami(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlharami - Harami Pattern

Input = Open, High, Low, Close

Output = int

func CdlharamiLookback

func CdlharamiLookback() int

CdlharamiLookback returns the number of input values consumed before the first valid output.

func Cdlharamicross

func Cdlharamicross(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlharamicross - Harami Cross Pattern

Input = Open, High, Low, Close

Output = int

func CdlharamicrossLookback

func CdlharamicrossLookback() int

CdlharamicrossLookback returns the number of input values consumed before the first valid output.

func Cdlhighwave

func Cdlhighwave(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlhighwave - High-Wave Candle

Input = Open, High, Low, Close

Output = int

func CdlhighwaveLookback

func CdlhighwaveLookback() int

CdlhighwaveLookback returns the number of input values consumed before the first valid output.

func Cdlhikkake

func Cdlhikkake(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlhikkake - Hikkake Pattern

Input = Open, High, Low, Close

Output = int

func CdlhikkakeLookback

func CdlhikkakeLookback() int

CdlhikkakeLookback returns the number of input values consumed before the first valid output.

func Cdlhikkakemod

func Cdlhikkakemod(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlhikkakemod - Modified Hikkake Pattern

Input = Open, High, Low, Close

Output = int

func CdlhikkakemodLookback

func CdlhikkakemodLookback() int

CdlhikkakemodLookback returns the number of input values consumed before the first valid output.

func Cdlhomingpigeon

func Cdlhomingpigeon(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlhomingpigeon - Homing Pigeon

Input = Open, High, Low, Close

Output = int

func CdlhomingpigeonLookback

func CdlhomingpigeonLookback() int

CdlhomingpigeonLookback returns the number of input values consumed before the first valid output.

func Cdlidentical3crows

func Cdlidentical3crows(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlidentical3crows - Identical Three Crows

Input = Open, High, Low, Close

Output = int

func Cdlidentical3crowsLookback

func Cdlidentical3crowsLookback() int

Cdlidentical3crowsLookback returns the number of input values consumed before the first valid output.

func Cdlinneck

func Cdlinneck(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlinneck - In-Neck Pattern

Input = Open, High, Low, Close

Output = int

func CdlinneckLookback

func CdlinneckLookback() int

CdlinneckLookback returns the number of input values consumed before the first valid output.

func Cdlinvertedhammer

func Cdlinvertedhammer(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlinvertedhammer - Inverted Hammer

Input = Open, High, Low, Close

Output = int

func CdlinvertedhammerLookback

func CdlinvertedhammerLookback() int

CdlinvertedhammerLookback returns the number of input values consumed before the first valid output.

func Cdlkicking

func Cdlkicking(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlkicking - Kicking

Input = Open, High, Low, Close

Output = int

func CdlkickingLookback

func CdlkickingLookback() int

CdlkickingLookback returns the number of input values consumed before the first valid output.

func Cdlkickingbylength

func Cdlkickingbylength(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlkickingbylength - Kicking - bull/bear determined by the longer marubozu

Input = Open, High, Low, Close

Output = int

func CdlkickingbylengthLookback

func CdlkickingbylengthLookback() int

CdlkickingbylengthLookback returns the number of input values consumed before the first valid output.

func Cdlladderbottom

func Cdlladderbottom(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlladderbottom - Ladder Bottom

Input = Open, High, Low, Close

Output = int

func CdlladderbottomLookback

func CdlladderbottomLookback() int

CdlladderbottomLookback returns the number of input values consumed before the first valid output.

func Cdllongleggeddoji

func Cdllongleggeddoji(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdllongleggeddoji - Long Legged Doji

Input = Open, High, Low, Close

Output = int

func CdllongleggeddojiLookback

func CdllongleggeddojiLookback() int

CdllongleggeddojiLookback returns the number of input values consumed before the first valid output.

func Cdllongline

func Cdllongline(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdllongline - Long Line Candle

Input = Open, High, Low, Close

Output = int

func CdllonglineLookback

func CdllonglineLookback() int

CdllonglineLookback returns the number of input values consumed before the first valid output.

func Cdlmarubozu

func Cdlmarubozu(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlmarubozu - Marubozu

Input = Open, High, Low, Close

Output = int

func CdlmarubozuLookback

func CdlmarubozuLookback() int

CdlmarubozuLookback returns the number of input values consumed before the first valid output.

func Cdlmatchinglow

func Cdlmatchinglow(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlmatchinglow - Matching Low

Input = Open, High, Low, Close

Output = int

func CdlmatchinglowLookback

func CdlmatchinglowLookback() int

CdlmatchinglowLookback returns the number of input values consumed before the first valid output.

func Cdlmathold

func Cdlmathold(open []float64, high []float64, low []float64, closePrice []float64, penetration float64, integerBuf []int32) (outInteger []int32)

Cdlmathold - Mat Hold

Input = Open, High, Low, Close

Output = int

Parameters:

  • penetration (0 to TA_REAL_MAX): Percentage of penetration of a candle within another candle

func CdlmatholdLookback

func CdlmatholdLookback(penetration float64) int

CdlmatholdLookback returns the number of input values consumed before the first valid output.

func Cdlmorningdojistar

func Cdlmorningdojistar(open []float64, high []float64, low []float64, closePrice []float64, penetration float64, integerBuf []int32) (outInteger []int32)

Cdlmorningdojistar - Morning Doji Star

Input = Open, High, Low, Close

Output = int

Parameters:

  • penetration (0 to TA_REAL_MAX): Percentage of penetration of a candle within another candle

func CdlmorningdojistarLookback

func CdlmorningdojistarLookback(penetration float64) int

CdlmorningdojistarLookback returns the number of input values consumed before the first valid output.

func Cdlmorningstar

func Cdlmorningstar(open []float64, high []float64, low []float64, closePrice []float64, penetration float64, integerBuf []int32) (outInteger []int32)

Cdlmorningstar - Morning Star

Input = Open, High, Low, Close

Output = int

Parameters:

  • penetration (0 to TA_REAL_MAX): Percentage of penetration of a candle within another candle

func CdlmorningstarLookback

func CdlmorningstarLookback(penetration float64) int

CdlmorningstarLookback returns the number of input values consumed before the first valid output.

func Cdlonneck

func Cdlonneck(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlonneck - On-Neck Pattern

Input = Open, High, Low, Close

Output = int

func CdlonneckLookback

func CdlonneckLookback() int

CdlonneckLookback returns the number of input values consumed before the first valid output.

func Cdlpiercing

func Cdlpiercing(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlpiercing - Piercing Pattern

Input = Open, High, Low, Close

Output = int

func CdlpiercingLookback

func CdlpiercingLookback() int

CdlpiercingLookback returns the number of input values consumed before the first valid output.

func Cdlrickshawman

func Cdlrickshawman(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlrickshawman - Rickshaw Man

Input = Open, High, Low, Close

Output = int

func CdlrickshawmanLookback

func CdlrickshawmanLookback() int

CdlrickshawmanLookback returns the number of input values consumed before the first valid output.

func Cdlrisefall3methods

func Cdlrisefall3methods(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlrisefall3methods - Rising/Falling Three Methods

Input = Open, High, Low, Close

Output = int

func Cdlrisefall3methodsLookback

func Cdlrisefall3methodsLookback() int

Cdlrisefall3methodsLookback returns the number of input values consumed before the first valid output.

func Cdlseparatinglines

func Cdlseparatinglines(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlseparatinglines - Separating Lines

Input = Open, High, Low, Close

Output = int

func CdlseparatinglinesLookback

func CdlseparatinglinesLookback() int

CdlseparatinglinesLookback returns the number of input values consumed before the first valid output.

func Cdlshootingstar

func Cdlshootingstar(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlshootingstar - Shooting Star

Input = Open, High, Low, Close

Output = int

func CdlshootingstarLookback

func CdlshootingstarLookback() int

CdlshootingstarLookback returns the number of input values consumed before the first valid output.

func Cdlshortline

func Cdlshortline(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlshortline - Short Line Candle

Input = Open, High, Low, Close

Output = int

func CdlshortlineLookback

func CdlshortlineLookback() int

CdlshortlineLookback returns the number of input values consumed before the first valid output.

func Cdlspinningtop

func Cdlspinningtop(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlspinningtop - Spinning Top

Input = Open, High, Low, Close

Output = int

func CdlspinningtopLookback

func CdlspinningtopLookback() int

CdlspinningtopLookback returns the number of input values consumed before the first valid output.

func Cdlstalledpattern

func Cdlstalledpattern(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlstalledpattern - Stalled Pattern

Input = Open, High, Low, Close

Output = int

func CdlstalledpatternLookback

func CdlstalledpatternLookback() int

CdlstalledpatternLookback returns the number of input values consumed before the first valid output.

func Cdlsticksandwich

func Cdlsticksandwich(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlsticksandwich - Stick Sandwich

Input = Open, High, Low, Close

Output = int

func CdlsticksandwichLookback

func CdlsticksandwichLookback() int

CdlsticksandwichLookback returns the number of input values consumed before the first valid output.

func Cdltakuri

func Cdltakuri(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdltakuri - Takuri (Dragonfly Doji with very long lower shadow)

Input = Open, High, Low, Close

Output = int

func CdltakuriLookback

func CdltakuriLookback() int

CdltakuriLookback returns the number of input values consumed before the first valid output.

func Cdltasukigap

func Cdltasukigap(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdltasukigap - Tasuki Gap

Input = Open, High, Low, Close

Output = int

func CdltasukigapLookback

func CdltasukigapLookback() int

CdltasukigapLookback returns the number of input values consumed before the first valid output.

func Cdlthrusting

func Cdlthrusting(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlthrusting - Thrusting Pattern

Input = Open, High, Low, Close

Output = int

func CdlthrustingLookback

func CdlthrustingLookback() int

CdlthrustingLookback returns the number of input values consumed before the first valid output.

func Cdltristar

func Cdltristar(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdltristar - Tristar Pattern

Input = Open, High, Low, Close

Output = int

func CdltristarLookback

func CdltristarLookback() int

CdltristarLookback returns the number of input values consumed before the first valid output.

func Cdlunique3river

func Cdlunique3river(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlunique3river - Unique 3 River

Input = Open, High, Low, Close

Output = int

func Cdlunique3riverLookback

func Cdlunique3riverLookback() int

Cdlunique3riverLookback returns the number of input values consumed before the first valid output.

func Cdlupsidegap2crows

func Cdlupsidegap2crows(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlupsidegap2crows - Upside Gap Two Crows

Input = Open, High, Low, Close

Output = int

func Cdlupsidegap2crowsLookback

func Cdlupsidegap2crowsLookback() int

Cdlupsidegap2crowsLookback returns the number of input values consumed before the first valid output.

func Cdlxsidegap3methods

func Cdlxsidegap3methods(open []float64, high []float64, low []float64, closePrice []float64, integerBuf []int32) (outInteger []int32)

Cdlxsidegap3methods - Upside/Downside Gap Three Methods

Input = Open, High, Low, Close

Output = int

func Cdlxsidegap3methodsLookback

func Cdlxsidegap3methodsLookback() int

Cdlxsidegap3methodsLookback returns the number of input values consumed before the first valid output.

func Ceil

func Ceil(in []float64, realBuf []float64) (outReal []float64)

Ceil - Vector Ceil

Input = double

Output = double

func CeilLookback

func CeilLookback() int

CeilLookback returns the number of input values consumed before the first valid output.

func Cmo

func Cmo(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Cmo - Chande Momentum Oscillator

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func CmoLookback

func CmoLookback(timePeriod int) int

CmoLookback returns the number of input values consumed before the first valid output.

func Correl

func Correl(in0 []float64, in1 []float64, timePeriod int, realBuf []float64) (outReal []float64)

Correl - Pearson's Correlation Coefficient (r)

Input = double, double

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func CorrelLookback

func CorrelLookback(timePeriod int) int

CorrelLookback returns the number of input values consumed before the first valid output.

func Cos

func Cos(in []float64, realBuf []float64) (outReal []float64)

Cos - Vector Trigonometric Cos

Input = double

Output = double

func CosLookback

func CosLookback() int

CosLookback returns the number of input values consumed before the first valid output.

func Cosh

func Cosh(in []float64, realBuf []float64) (outReal []float64)

Cosh - Vector Trigonometric Cosh

Input = double

Output = double

func CoshLookback

func CoshLookback() int

CoshLookback returns the number of input values consumed before the first valid output.

func Dema

func Dema(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Dema - Double Exponential Moving Average

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func DemaLookback

func DemaLookback(timePeriod int) int

DemaLookback returns the number of input values consumed before the first valid output.

func Div

func Div(in0 []float64, in1 []float64, realBuf []float64) (outReal []float64)

Div - Vector Arithmetic Div

Input = double, double

Output = double

func DivLookback

func DivLookback() int

DivLookback returns the number of input values consumed before the first valid output.

func Dx

func Dx(high []float64, low []float64, closePrice []float64, timePeriod int, realBuf []float64) (outReal []float64)

Dx - Directional Movement Index

Input = High, Low, Close

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func DxLookback

func DxLookback(timePeriod int) int

DxLookback returns the number of input values consumed before the first valid output.

func Ema

func Ema(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Ema - Exponential Moving Average

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func EmaLookback

func EmaLookback(timePeriod int) int

EmaLookback returns the number of input values consumed before the first valid output.

func Exp

func Exp(in []float64, realBuf []float64) (outReal []float64)

Exp - Vector Arithmetic Exp

Input = double

Output = double

func ExpLookback

func ExpLookback() int

ExpLookback returns the number of input values consumed before the first valid output.

func Floor

func Floor(in []float64, realBuf []float64) (outReal []float64)

Floor - Vector Floor

Input = double

Output = double

func FloorLookback

func FloorLookback() int

FloorLookback returns the number of input values consumed before the first valid output.

func HtDcperiod

func HtDcperiod(in []float64, realBuf []float64) (outReal []float64)

HtDcperiod - Hilbert Transform - Dominant Cycle Period

Input = double

Output = double

func HtDcperiodLookback

func HtDcperiodLookback() int

HtDcperiodLookback returns the number of input values consumed before the first valid output.

func HtDcphase

func HtDcphase(in []float64, realBuf []float64) (outReal []float64)

HtDcphase - Hilbert Transform - Dominant Cycle Phase

Input = double

Output = double

func HtDcphaseLookback

func HtDcphaseLookback() int

HtDcphaseLookback returns the number of input values consumed before the first valid output.

func HtPhasor

func HtPhasor(in []float64, inPhaseBuf []float64, quadratureBuf []float64) (outInPhase []float64, outQuadrature []float64)

HtPhasor - Hilbert Transform - Phasor Components

Input = double

Output = double, double

func HtPhasorLookback

func HtPhasorLookback() int

HtPhasorLookback returns the number of input values consumed before the first valid output.

func HtSine

func HtSine(in []float64, sineBuf []float64, leadSineBuf []float64) (outSine []float64, outLeadSine []float64)

HtSine - Hilbert Transform - SineWave

Input = double

Output = double, double

func HtSineLookback

func HtSineLookback() int

HtSineLookback returns the number of input values consumed before the first valid output.

func HtTrendline

func HtTrendline(in []float64, realBuf []float64) (outReal []float64)

HtTrendline - Hilbert Transform - Instantaneous Trendline

Input = double

Output = double

func HtTrendlineLookback

func HtTrendlineLookback() int

HtTrendlineLookback returns the number of input values consumed before the first valid output.

func HtTrendmode

func HtTrendmode(in []float64, integerBuf []int32) (outInteger []int32)

HtTrendmode - Hilbert Transform - Trend vs Cycle Mode

Input = double

Output = int

func HtTrendmodeLookback

func HtTrendmodeLookback() int

HtTrendmodeLookback returns the number of input values consumed before the first valid output.

func Imi

func Imi(open []float64, closePrice []float64, timePeriod int, realBuf []float64) (outReal []float64)

Imi - Intraday Momentum Index

Input = Open, Close

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func ImiLookback

func ImiLookback(timePeriod int) int

ImiLookback returns the number of input values consumed before the first valid output.

func Kama

func Kama(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Kama - Kaufman Adaptive Moving Average

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func KamaLookback

func KamaLookback(timePeriod int) int

KamaLookback returns the number of input values consumed before the first valid output.

func Linearreg

func Linearreg(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Linearreg - Linear Regression

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func LinearregAngle

func LinearregAngle(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

LinearregAngle - Linear Regression Angle

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func LinearregAngleLookback

func LinearregAngleLookback(timePeriod int) int

LinearregAngleLookback returns the number of input values consumed before the first valid output.

func LinearregIntercept

func LinearregIntercept(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

LinearregIntercept - Linear Regression Intercept

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func LinearregInterceptLookback

func LinearregInterceptLookback(timePeriod int) int

LinearregInterceptLookback returns the number of input values consumed before the first valid output.

func LinearregLookback

func LinearregLookback(timePeriod int) int

LinearregLookback returns the number of input values consumed before the first valid output.

func LinearregSlope

func LinearregSlope(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

LinearregSlope - Linear Regression Slope

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func LinearregSlopeLookback

func LinearregSlopeLookback(timePeriod int) int

LinearregSlopeLookback returns the number of input values consumed before the first valid output.

func Ln

func Ln(in []float64, realBuf []float64) (outReal []float64)

Ln - Vector Log Natural

Input = double

Output = double

func LnLookback

func LnLookback() int

LnLookback returns the number of input values consumed before the first valid output.

func Log10

func Log10(in []float64, realBuf []float64) (outReal []float64)

Log10 - Vector Log10

Input = double

Output = double

func Log10Lookback

func Log10Lookback() int

Log10Lookback returns the number of input values consumed before the first valid output.

func Ma

func Ma(in []float64, timePeriod int, mAType int, realBuf []float64) (outReal []float64)

Ma - Moving average

Input = double

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period
  • mAType: Type of Moving Average

func MaLookback

func MaLookback(timePeriod int, mAType int) int

MaLookback returns the number of input values consumed before the first valid output.

func Macd

func Macd(in []float64, fastPeriod int, slowPeriod int, signalPeriod int, macdBuf []float64, macdSignalBuf []float64, macdHistBuf []float64) (outMACD []float64, outMACDSignal []float64, outMACDHist []float64)

Macd - Moving Average Convergence/Divergence

Input = double

Output = double, double, double

Parameters:

  • fastPeriod (2 to 100000): Number of period for the fast MA
  • slowPeriod (2 to 100000): Number of period for the slow MA
  • signalPeriod (1 to 100000): Smoothing for the signal line (nb of period)

func MacdLookback

func MacdLookback(fastPeriod int, slowPeriod int, signalPeriod int) int

MacdLookback returns the number of input values consumed before the first valid output.

func Macdext

func Macdext(in []float64, fastPeriod int, fastMAType int, slowPeriod int, slowMAType int, signalPeriod int, signalMAType int, macdBuf []float64, macdSignalBuf []float64, macdHistBuf []float64) (outMACD []float64, outMACDSignal []float64, outMACDHist []float64)

Macdext - MACD with controllable MA type

Input = double

Output = double, double, double

Parameters:

  • fastPeriod (2 to 100000): Number of period for the fast MA
  • fastMAType: Type of Moving Average for fast MA
  • slowPeriod (2 to 100000): Number of period for the slow MA
  • slowMAType: Type of Moving Average for slow MA
  • signalPeriod (1 to 100000): Smoothing for the signal line (nb of period)
  • signalMAType: Type of Moving Average for signal line

func MacdextLookback

func MacdextLookback(fastPeriod int, fastMAType int, slowPeriod int, slowMAType int, signalPeriod int, signalMAType int) int

MacdextLookback returns the number of input values consumed before the first valid output.

func Macdfix

func Macdfix(in []float64, signalPeriod int, macdBuf []float64, macdSignalBuf []float64, macdHistBuf []float64) (outMACD []float64, outMACDSignal []float64, outMACDHist []float64)

Macdfix - Moving Average Convergence/Divergence Fix 12/26

Input = double

Output = double, double, double

Parameters:

  • signalPeriod (1 to 100000): Smoothing for the signal line (nb of period)

func MacdfixLookback

func MacdfixLookback(signalPeriod int) int

MacdfixLookback returns the number of input values consumed before the first valid output.

func Mama

func Mama(in []float64, fastLimit float64, slowLimit float64, mamaBuf []float64, famaBuf []float64) (outMAMA []float64, outFAMA []float64)

Mama - MESA Adaptive Moving Average

Input = double

Output = double, double

Parameters:

  • fastLimit (0.01 to 0.99): Upper limit use in the adaptive algorithm
  • slowLimit (0.01 to 0.99): Lower limit use in the adaptive algorithm

func MamaLookback

func MamaLookback(fastLimit float64, slowLimit float64) int

MamaLookback returns the number of input values consumed before the first valid output.

func Mavp

func Mavp(in []float64, periods []float64, minPeriod int, maxPeriod int, mAType int, realBuf []float64) (outReal []float64)

Mavp - Moving average with variable period

Input = double, double

Output = double

Parameters:

  • minPeriod (2 to 100000): Value less than minimum will be changed to Minimum period
  • maxPeriod (2 to 100000): Value higher than maximum will be changed to Maximum period
  • mAType: Type of Moving Average

func MavpLookback

func MavpLookback(minPeriod int, maxPeriod int, mAType int) int

MavpLookback returns the number of input values consumed before the first valid output.

func Max

func Max(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Max - Highest value over a specified period

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func MaxLookback

func MaxLookback(timePeriod int) int

MaxLookback returns the number of input values consumed before the first valid output.

func Maxindex

func Maxindex(in []float64, timePeriod int, integerBuf []int32) (outInteger []int32)

Maxindex - Index of highest value over a specified period

Input = double

Output = int

Parameters:

  • timePeriod (2 to 100000): Number of period

func MaxindexLookback

func MaxindexLookback(timePeriod int) int

MaxindexLookback returns the number of input values consumed before the first valid output.

func Medprice

func Medprice(high []float64, low []float64, realBuf []float64) (outReal []float64)

Medprice - Median Price

Input = High, Low

Output = double

func MedpriceLookback

func MedpriceLookback() int

MedpriceLookback returns the number of input values consumed before the first valid output.

func Mfi

func Mfi(high []float64, low []float64, closePrice []float64, volume []float64, timePeriod int, realBuf []float64) (outReal []float64)

Mfi - Money Flow Index

Input = High, Low, Close, Volume

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func MfiLookback

func MfiLookback(timePeriod int) int

MfiLookback returns the number of input values consumed before the first valid output.

func Midpoint

func Midpoint(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Midpoint - MidPoint over period

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func MidpointLookback

func MidpointLookback(timePeriod int) int

MidpointLookback returns the number of input values consumed before the first valid output.

func Midprice

func Midprice(high []float64, low []float64, timePeriod int, realBuf []float64) (outReal []float64)

Midprice - Midpoint Price over period

Input = High, Low

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func MidpriceLookback

func MidpriceLookback(timePeriod int) int

MidpriceLookback returns the number of input values consumed before the first valid output.

func Min

func Min(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Min - Lowest value over a specified period

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func MinLookback

func MinLookback(timePeriod int) int

MinLookback returns the number of input values consumed before the first valid output.

func Minindex

func Minindex(in []float64, timePeriod int, integerBuf []int32) (outInteger []int32)

Minindex - Index of lowest value over a specified period

Input = double

Output = int

Parameters:

  • timePeriod (2 to 100000): Number of period

func MinindexLookback

func MinindexLookback(timePeriod int) int

MinindexLookback returns the number of input values consumed before the first valid output.

func Minmax

func Minmax(in []float64, timePeriod int, minBuf []float64, maxBuf []float64) (outMin []float64, outMax []float64)

Minmax - Lowest and highest values over a specified period

Input = double

Output = double, double

Parameters:

  • timePeriod (2 to 100000): Number of period

func MinmaxLookback

func MinmaxLookback(timePeriod int) int

MinmaxLookback returns the number of input values consumed before the first valid output.

func Minmaxindex

func Minmaxindex(in []float64, timePeriod int, minIdxBuf []int32, maxIdxBuf []int32) (outMinIdx []int32, outMaxIdx []int32)

Minmaxindex - Indexes of lowest and highest values over a specified period

Input = double

Output = int, int

Parameters:

  • timePeriod (2 to 100000): Number of period

func MinmaxindexLookback

func MinmaxindexLookback(timePeriod int) int

MinmaxindexLookback returns the number of input values consumed before the first valid output.

func MinusDi

func MinusDi(high []float64, low []float64, closePrice []float64, timePeriod int, realBuf []float64) (outReal []float64)

MinusDi - Minus Directional Indicator

Input = High, Low, Close

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func MinusDiLookback

func MinusDiLookback(timePeriod int) int

MinusDiLookback returns the number of input values consumed before the first valid output.

func MinusDm

func MinusDm(high []float64, low []float64, timePeriod int, realBuf []float64) (outReal []float64)

MinusDm - Minus Directional Movement

Input = High, Low

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func MinusDmLookback

func MinusDmLookback(timePeriod int) int

MinusDmLookback returns the number of input values consumed before the first valid output.

func Mom

func Mom(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Mom - Momentum

Input = double

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func MomLookback

func MomLookback(timePeriod int) int

MomLookback returns the number of input values consumed before the first valid output.

func Mult

func Mult(in0 []float64, in1 []float64, realBuf []float64) (outReal []float64)

Mult - Vector Arithmetic Mult

Input = double, double

Output = double

func MultLookback

func MultLookback() int

MultLookback returns the number of input values consumed before the first valid output.

func Natr

func Natr(high []float64, low []float64, closePrice []float64, timePeriod int, realBuf []float64) (outReal []float64)

Natr - Normalized Average True Range

Input = High, Low, Close

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func NatrLookback

func NatrLookback(timePeriod int) int

NatrLookback returns the number of input values consumed before the first valid output.

func Obv

func Obv(in []float64, volume []float64, realBuf []float64) (outReal []float64)

Obv - On Balance Volume

Input = double, Volume

Output = double

func ObvLookback

func ObvLookback() int

ObvLookback returns the number of input values consumed before the first valid output.

func PlusDi

func PlusDi(high []float64, low []float64, closePrice []float64, timePeriod int, realBuf []float64) (outReal []float64)

PlusDi - Plus Directional Indicator

Input = High, Low, Close

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func PlusDiLookback

func PlusDiLookback(timePeriod int) int

PlusDiLookback returns the number of input values consumed before the first valid output.

func PlusDm

func PlusDm(high []float64, low []float64, timePeriod int, realBuf []float64) (outReal []float64)

PlusDm - Plus Directional Movement

Input = High, Low

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func PlusDmLookback

func PlusDmLookback(timePeriod int) int

PlusDmLookback returns the number of input values consumed before the first valid output.

func Ppo

func Ppo(in []float64, fastPeriod int, slowPeriod int, mAType int, realBuf []float64) (outReal []float64)

Ppo - Percentage Price Oscillator

Input = double

Output = double

Parameters:

  • fastPeriod (2 to 100000): Number of period for the fast MA
  • slowPeriod (2 to 100000): Number of period for the slow MA
  • mAType: Type of Moving Average

func PpoLookback

func PpoLookback(fastPeriod int, slowPeriod int, mAType int) int

PpoLookback returns the number of input values consumed before the first valid output.

func Roc

func Roc(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Roc - Rate of change : ((price/prevPrice)-1)*100

Input = double

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func RocLookback

func RocLookback(timePeriod int) int

RocLookback returns the number of input values consumed before the first valid output.

func Rocp

func Rocp(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Rocp - Rate of change Percentage: (price-prevPrice)/prevPrice

Input = double

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func RocpLookback

func RocpLookback(timePeriod int) int

RocpLookback returns the number of input values consumed before the first valid output.

func Rocr

func Rocr(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Rocr - Rate of change ratio: (price/prevPrice)

Input = double

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func Rocr100

func Rocr100(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Rocr100 - Rate of change ratio 100 scale: (price/prevPrice)*100

Input = double

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func Rocr100Lookback

func Rocr100Lookback(timePeriod int) int

Rocr100Lookback returns the number of input values consumed before the first valid output.

func RocrLookback

func RocrLookback(timePeriod int) int

RocrLookback returns the number of input values consumed before the first valid output.

func Rsi

func Rsi(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Rsi - Relative Strength Index

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func RsiLookback

func RsiLookback(timePeriod int) int

RsiLookback returns the number of input values consumed before the first valid output.

func Sar

func Sar(high []float64, low []float64, acceleration float64, maximum float64, realBuf []float64) (outReal []float64)

Sar - Parabolic SAR

Input = High, Low

Output = double

Parameters:

  • acceleration (0 to TA_REAL_MAX): Acceleration Factor used up to the Maximum value
  • maximum (0 to TA_REAL_MAX): Acceleration Factor Maximum value

func SarLookback

func SarLookback(acceleration float64, maximum float64) int

SarLookback returns the number of input values consumed before the first valid output.

func Sarext

func Sarext(high []float64, low []float64, startValue float64, offsetOnReverse float64, accelerationInitLong float64, accelerationLong float64, accelerationMaxLong float64, accelerationInitShort float64, accelerationShort float64, accelerationMaxShort float64, realBuf []float64) (outReal []float64)

Sarext - Parabolic SAR - Extended

Input = High, Low

Output = double

Parameters:

  • startValue (TA_REAL_MIN to TA_REAL_MAX): Start value and direction. 0 for Auto, >0 for Long, <0 for Short
  • offsetOnReverse (0 to TA_REAL_MAX): Percent offset added/removed to initial stop on short/long reversal
  • accelerationInitLong (0 to TA_REAL_MAX): Acceleration Factor initial value for the Long direction
  • accelerationLong (0 to TA_REAL_MAX): Acceleration Factor for the Long direction
  • accelerationMaxLong (0 to TA_REAL_MAX): Acceleration Factor maximum value for the Long direction
  • accelerationInitShort (0 to TA_REAL_MAX): Acceleration Factor initial value for the Short direction
  • accelerationShort (0 to TA_REAL_MAX): Acceleration Factor for the Short direction
  • accelerationMaxShort (0 to TA_REAL_MAX): Acceleration Factor maximum value for the Short direction

func SarextLookback

func SarextLookback(startValue float64, offsetOnReverse float64, accelerationInitLong float64, accelerationLong float64, accelerationMaxLong float64, accelerationInitShort float64, accelerationShort float64, accelerationMaxShort float64) int

SarextLookback returns the number of input values consumed before the first valid output.

func Sin

func Sin(in []float64, realBuf []float64) (outReal []float64)

Sin - Vector Trigonometric Sin

Input = double

Output = double

func SinLookback

func SinLookback() int

SinLookback returns the number of input values consumed before the first valid output.

func Sinh

func Sinh(in []float64, realBuf []float64) (outReal []float64)

Sinh - Vector Trigonometric Sinh

Input = double

Output = double

func SinhLookback

func SinhLookback() int

SinhLookback returns the number of input values consumed before the first valid output.

func Sma

func Sma(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Sma - Simple Moving Average

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func SmaLookback

func SmaLookback(timePeriod int) int

SmaLookback returns the number of input values consumed before the first valid output.

func Sqrt

func Sqrt(in []float64, realBuf []float64) (outReal []float64)

Sqrt - Vector Square Root

Input = double

Output = double

func SqrtLookback

func SqrtLookback() int

SqrtLookback returns the number of input values consumed before the first valid output.

func Stddev

func Stddev(in []float64, timePeriod int, nbDev float64, realBuf []float64) (outReal []float64)

Stddev - Standard Deviation

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period
  • nbDev (TA_REAL_MIN to TA_REAL_MAX): Nb of deviations

func StddevLookback

func StddevLookback(timePeriod int, nbDev float64) int

StddevLookback returns the number of input values consumed before the first valid output.

func Stoch

func Stoch(high []float64, low []float64, closePrice []float64, fastK_Period int, slowK_Period int, slowK_MAType int, slowD_Period int, slowD_MAType int, slowKBuf []float64, slowDBuf []float64) (outSlowK []float64, outSlowD []float64)

Stoch - Stochastic

Input = High, Low, Close

Output = double, double

Parameters:

  • fastK_Period (1 to 100000): Time period for building the Fast-K line
  • slowK_Period (1 to 100000): Smoothing for making the Slow-K line. Usually set to 3
  • slowK_MAType: Type of Moving Average for Slow-K
  • slowD_Period (1 to 100000): Smoothing for making the Slow-D line
  • slowD_MAType: Type of Moving Average for Slow-D

func StochLookback

func StochLookback(fastK_Period int, slowK_Period int, slowK_MAType int, slowD_Period int, slowD_MAType int) int

StochLookback returns the number of input values consumed before the first valid output.

func Stochf

func Stochf(high []float64, low []float64, closePrice []float64, fastK_Period int, fastD_Period int, fastD_MAType int, fastKBuf []float64, fastDBuf []float64) (outFastK []float64, outFastD []float64)

Stochf - Stochastic Fast

Input = High, Low, Close

Output = double, double

Parameters:

  • fastK_Period (1 to 100000): Time period for building the Fast-K line
  • fastD_Period (1 to 100000): Smoothing for making the Fast-D line. Usually set to 3
  • fastD_MAType: Type of Moving Average for Fast-D

func StochfLookback

func StochfLookback(fastK_Period int, fastD_Period int, fastD_MAType int) int

StochfLookback returns the number of input values consumed before the first valid output.

func Stochrsi

func Stochrsi(in []float64, timePeriod int, fastK_Period int, fastD_Period int, fastD_MAType int, fastKBuf []float64, fastDBuf []float64) (outFastK []float64, outFastD []float64)

Stochrsi - Stochastic Relative Strength Index

Input = double

Output = double, double

Parameters:

  • timePeriod (2 to 100000): Number of period
  • fastK_Period (1 to 100000): Time period for building the Fast-K line
  • fastD_Period (1 to 100000): Smoothing for making the Fast-D line. Usually set to 3
  • fastD_MAType: Type of Moving Average for Fast-D

func StochrsiLookback

func StochrsiLookback(timePeriod int, fastK_Period int, fastD_Period int, fastD_MAType int) int

StochrsiLookback returns the number of input values consumed before the first valid output.

func Sub

func Sub(in0 []float64, in1 []float64, realBuf []float64) (outReal []float64)

Sub - Vector Arithmetic Subtraction

Input = double, double

Output = double

func SubLookback

func SubLookback() int

SubLookback returns the number of input values consumed before the first valid output.

func Sum

func Sum(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Sum - Summation

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func SumLookback

func SumLookback(timePeriod int) int

SumLookback returns the number of input values consumed before the first valid output.

func T3

func T3(in []float64, timePeriod int, vFactor float64, realBuf []float64) (outReal []float64)

T3 - Triple Exponential Moving Average (T3)

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period
  • vFactor (0 to 1): Volume Factor

func T3Lookback

func T3Lookback(timePeriod int, vFactor float64) int

T3Lookback returns the number of input values consumed before the first valid output.

func Tan

func Tan(in []float64, realBuf []float64) (outReal []float64)

Tan - Vector Trigonometric Tan

Input = double

Output = double

func TanLookback

func TanLookback() int

TanLookback returns the number of input values consumed before the first valid output.

func Tanh

func Tanh(in []float64, realBuf []float64) (outReal []float64)

Tanh - Vector Trigonometric Tanh

Input = double

Output = double

func TanhLookback

func TanhLookback() int

TanhLookback returns the number of input values consumed before the first valid output.

func Tema

func Tema(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Tema - Triple Exponential Moving Average

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func TemaLookback

func TemaLookback(timePeriod int) int

TemaLookback returns the number of input values consumed before the first valid output.

func Trange

func Trange(high []float64, low []float64, closePrice []float64, realBuf []float64) (outReal []float64)

Trange - True Range

Input = High, Low, Close

Output = double

func TrangeLookback

func TrangeLookback() int

TrangeLookback returns the number of input values consumed before the first valid output.

func Trima

func Trima(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Trima - Triangular Moving Average

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func TrimaLookback

func TrimaLookback(timePeriod int) int

TrimaLookback returns the number of input values consumed before the first valid output.

func Trix

func Trix(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Trix - 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA

Input = double

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period

func TrixLookback

func TrixLookback(timePeriod int) int

TrixLookback returns the number of input values consumed before the first valid output.

func Tsf

func Tsf(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Tsf - Time Series Forecast

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func TsfLookback

func TsfLookback(timePeriod int) int

TsfLookback returns the number of input values consumed before the first valid output.

func Typprice

func Typprice(high []float64, low []float64, closePrice []float64, realBuf []float64) (outReal []float64)

Typprice - Typical Price

Input = High, Low, Close

Output = double

func TyppriceLookback

func TyppriceLookback() int

TyppriceLookback returns the number of input values consumed before the first valid output.

func Ultosc

func Ultosc(high []float64, low []float64, closePrice []float64, timePeriod1 int, timePeriod2 int, timePeriod3 int, realBuf []float64) (outReal []float64)

Ultosc - Ultimate Oscillator

Input = High, Low, Close

Output = double

Parameters:

  • timePeriod1 (1 to 100000): Number of bars for 1st period.
  • timePeriod2 (1 to 100000): Number of bars fro 2nd period
  • timePeriod3 (1 to 100000): Number of bars for 3rd period

func UltoscLookback

func UltoscLookback(timePeriod1 int, timePeriod2 int, timePeriod3 int) int

UltoscLookback returns the number of input values consumed before the first valid output.

func Var

func Var(in []float64, timePeriod int, nbDev float64, realBuf []float64) (outReal []float64)

Var - Variance

Input = double

Output = double

Parameters:

  • timePeriod (1 to 100000): Number of period
  • nbDev (TA_REAL_MIN to TA_REAL_MAX): Nb of deviations

func VarLookback

func VarLookback(timePeriod int, nbDev float64) int

VarLookback returns the number of input values consumed before the first valid output.

func Wclprice

func Wclprice(high []float64, low []float64, closePrice []float64, realBuf []float64) (outReal []float64)

Wclprice - Weighted Close Price

Input = High, Low, Close

Output = double

func WclpriceLookback

func WclpriceLookback() int

WclpriceLookback returns the number of input values consumed before the first valid output.

func Willr

func Willr(high []float64, low []float64, closePrice []float64, timePeriod int, realBuf []float64) (outReal []float64)

Willr - Williams' %R

Input = High, Low, Close

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func WillrLookback

func WillrLookback(timePeriod int) int

WillrLookback returns the number of input values consumed before the first valid output.

func Wma

func Wma(in []float64, timePeriod int, realBuf []float64) (outReal []float64)

Wma - Weighted Moving Average

Input = double

Output = double

Parameters:

  • timePeriod (2 to 100000): Number of period

func WmaLookback

func WmaLookback(timePeriod int) int

WmaLookback returns the number of input values consumed before the first valid output.

Types

type TALibError

type TALibError struct {
	RetCode int
	Message string
}

TALibError is the panic value for all TA-Lib failures. Callers can recover() and type-assert to *TALibError to inspect the code.

func (*TALibError) Error

func (e *TALibError) Error() string

Directories

Path Synopsis
cmd
gen command
cmd/gen clones the TA-Lib repository at a pinned version, builds the amalgamation C file, copies headers, and generates Go wrapper source files.
cmd/gen clones the TA-Lib repository at a pinned version, builds the amalgamation C file, copies headers, and generates Go wrapper source files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL