I'm new here at Gekko - Problems
#1
I made a strategy where every time they cross the middle, buy or sell.

I'm working with binance ...

What is certain is that theft opens but then closes soon.

Can someone explain what I'm doing wrong?

Code:
/ GTR
var strat = {};

// Prepare everything our strat needs
strat.init = function() {
 this.name = 'GTR';
 this.trend = 'none';

 this.requiredHistory = this.tradingAdvisor.historySize;


 this.addTulipIndicator('slow', 'ema', {
   optInTimePeriod: this.settings.slow
 });

 this.addTulipIndicator('fast', 'ema', {
   optInTimePeriod: this.settings.fast
 });


}

// What happens on every new candle?
strat.update = function(candle) {

}

strat.log = function(candle) {
 // nothing!
}


strat.check = function(candle) {

 const ema1 = this.tulipIndicators.slow.result.result;
 const ema2 = this.tulipIndicators.fast.result.result;
 var   priceclose = candle.close;
 //console.dir(ema1)


   if (ema1 > ema2){
       this.trend = 'Compra';
       this.advice('long');

       console.dir(this.trend)
   }

   if (ema1 < ema2){
     this.trend = 'Venda';
     this.advice('short');

     console.dir(this.trend)
   }    


}

module.exports = strat;


Attached Files
.jpg   Screenshot_1.jpg (Size: 169.61 KB / Downloads: 9)
  Reply


Messages In This Thread
I'm new here at Gekko - Problems - by informaster - 01-11-2019, 02:15 PM

Forum Jump:


Users browsing this thread: