Fork me on GitHub

TA-lib indicators #

When writing your own strategy you can use all indicators offered by the TA-lib library. Gekko will pass the correct market data to TA-lib and you only have to provide the optIn configurable parameters.

Install #

Bash on Windows, OSX or Linux #

Open your terminal. Then:

cd ~/gekko
npm install talib

Example #

If you want to use the MACD indicator from TA-lib, you need to register it in your strategy like so:

method.init = function() {
  var customMACDSettings = {
    optInFastPeriod: 10,
    optInSlowPeriod: 21,
    optInSignalPeriod: 9
  }

  // add the indicator to the strategy
  this.addTalibIndicator('mymacd', 'macd', customMACDSettings);
}

method.check = function() {
  // use indicator results
  var result = this.talibIndicators.mymacd.result;
  var macddiff = result['outMACD'] - result['outMACDSignal'];

  // do something with macdiff
}

TA-lib Indicators #

Here is a list of all supported indicators, click on them to see the required parameters.

API #

accbands #

Required parameters:

ad #

Required parameters:

adosc #

Required parameters:

adx #

Required parameters:

adxr #

Required parameters:

apo #

Required parameters:

aroon #

Required parameters:

aroonosc #

Required parameters:

atr #

Required parameters:

avgprice #

Required parameters:

bbands #

Required parameters:

bop #

This indicator does not require any parameters.

cci #

Required parameters:

cmo #

Required parameters:

dema #

Required parameters:

dx #

Required parameters:

ema #

Required parameters:

ht_dcperiod #

This indicator does not require any parameters.

ht_dcphase #

This indicator does not require any parameters.

ht_phasor #

This indicator does not require any parameters.

ht_sine #

This indicator does not require any parameters.

ht_trendline #

This indicator does not require any parameters.

ht_trendmode #

This indicator does not require any parameters.

imi #

Required parameters:

kama #

Required parameters:

linearreg #

Required parameters:

linearreg_angle #

Required parameters:

linearreg_intercept #

Required parameters:

linearreg_slope #

Required parameters:

ma #

Required parameters:

macd #

Required parameters:

macdext #

Required parameters:

macdfix #

Required parameters:

mama #

Required parameters:

mavp #

Required parameters:

max #

Required parameters:

maxindex #

Required parameters:

medprice #

Required parameters:

mfi #

Required parameters:

midpoint #

Required parameters:

midprice #

Required parameters:

min #

Required parameters:

minindex #

Required parameters:

minmax #

Required parameters:

minmaxindex #

Required parameters:

minus_di #

Required parameters:

minus_dm #

Required parameters:

mom #

Required parameters:

natr #

Required parameters:

obv #

This indicator does not require any parameters.

plus_di #

Required parameters:

plus_dm #

Required parameters:

ppo #

Required parameters:

roc #

Required parameters:

rocp #

Required parameters:

rocr #

Required parameters:

rocr100 #

Required parameters:

rsi #

Required parameters:

sar #

Required parameters:

sarext #

Required parameters:

sma #

Required parameters:

stddev #

Required parameters:

stoch #

Required parameters:

stochf #

Required parameters:

stochrsi #

Required parameters:

t3 #

Required parameters:

tema #

Required parameters:

trange #

Required parameters:

trima #

Required parameters:

trix #

Required parameters:

tsf #

Required parameters:

typprice #

Required parameters:

ultosc #

Required parameters:

variance #

Required parameters:

wclprice #

Required parameters:

willr #

Required parameters:

wma #

Required parameters: