The right way to use native trailing stop loss
#1
Hello guys.

I am trying to adapt the native traling stop loss into some open source neural net based strategies, but the same problem described at https://steemit.com/gekko/@crypto49er/ge...esn-t-work happens. I mean, when the stop loss is triggered, the conditions to buy are satisfied, and the strategy advice to buy again.

In order to avoid that, I am trying to figure out how to put an extra condition, using timeout or any other kind of logic, in order to avoid the strategy to buy again.

The problem is that I am not able to find how to register my code to be notified when the trigger loss got triggered.

Can someone please provide me some sample code for this?

The strategy I am trying to adapt right now is this one https://github.com/zschro/gekko-neuralnet

Currently, my go long advice is defined as follows:




      if ('buy' !== this.prevAction && signal === false  && meanAlpha > this.settings.threshold_buy )
      {

        log.debug("");
        log.debug("**** Buy - Predicted variation: ",meanAlpha);
        if (!this.settings.stoploss_enabled) {
          return this.advice('long');
        } else {
          return this.advice({
            direction: 'long',
            trigger: {
              type: 'trailingStop',
              trailPercentage: this.settings.stoploss_trailPercentage
            }
          });
        }
      }

Thank you
  Reply


Messages In This Thread
The right way to use native trailing stop loss - by douglascrp - 11-28-2018, 03:50 PM

Forum Jump:


Users browsing this thread: