Gekko Forum
I'm new here at Gekko - Problems - Printable Version

+- Gekko Forum (https://forum.gekko.wizb.it)
+-- Forum: Gekko (https://forum.gekko.wizb.it/forum-13.html)
+--- Forum: Strategy Development (https://forum.gekko.wizb.it/forum-12.html)
+--- Thread: I'm new here at Gekko - Problems (/thread-57823.html)



I'm new here at Gekko - Problems - informaster - 01-11-2019

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;