EMA tradingview to Gekko
#1
Hello,
How to translate tradingview Pinscript :
Code:
a = ema(b, c)


To Js for Gekko in a strategy


I found this in documentation :

Code:
method.init = function() {
 var weight = 10;

 // add the indicator to the strategy
 this.addIndicator('myema', 'EMA', weight);
}

method.check = function() {
 // use indicator results
 var ema = this.indicators.myema.result;

 // do something with macdiff
}

do I have to write 
Code:
method.init = function() {
 var b = 10;
    var c = 10;

 // add the indicator to the strategy
 this.addIndicator('myema', 'EMA', b, c);
}

thanks for your help.

Heart
  Reply
#2
(10-14-2018, 07:37 PM)mikealkeal Wrote: Hello,
How to translate tradingview Pinscript :
Code:
a = ema(b, c)


To Js for Gekko in a strategy


I found this in documentation :

Code:
method.init = function() {
 var weight = 10;

 // add the indicator to the strategy
 this.addIndicator('myema', 'EMA', weight);
}

method.check = function() {
 // use indicator results
 var ema = this.indicators.myema.result;

 // do something with macdiff
}

do I have to write 
Code:
method.init = function() {
 var b = 10;
   var c = 10;

 // add the indicator to the strategy
 this.addIndicator('myema', 'EMA', b, c);
}

thanks for your help.

Heart


In Pinescript you have these params:

ema(source, length) → series


For calculation in gekko you only need one param, the source (candles) is supplied by the gekko core so you need only one param in gekko, the length.
  Reply
#3
thanks mark.sch

is it possible to change the source of Gekko?

if not, does it work with tablib?
For example

method.init = function() {
var Settings = {
Close: 10,
optInTimePeriod: 10
}

this.addTalibIndicator('myema', 'ema', Settings);
  Reply


Forum Jump:


Users browsing this thread: