[SHARE] Simple RSI BULL/BEAR strategy
(02-06-2018, 10:03 PM)0mathew0 Wrote: Tommie,

your strategy is very good, i like it. I developed a similar approach before (which switches 4 different RSI thresholds based on ADX trend recognition). Yours is simpler and much better than my strat was.

Quick question: Is there any way to skip long sma initialization? It hurts to wait around 7 days (at 15min candles and sma lenght 800) to recognize the right trend (as a safe workaround i adapted the strategy to wait until long sma != undefined and use BEAR RSI settings till then).

Thanks again for sharing.


4 different values seems intriguing and fun but a bit excessive. I though of doing a variant of this that is more complex and identifies more sort of trends (sideways 'slighly bear' and sideways 'slighly bull') but everything i've tried has ended being more complex with little to no benefit. I like to really keep things as simple as possible. Doing something else might also result in overfitting of data (basically one creates something that *ONLY* works under certain specific conditions, something that backtests great but then falls apart since one cannot backtest the future). The user susitronix has written a mod using ROC (Rate of Change) in order to detect "more bull" and "less bull", maybe you could try that as well.

As i understand it Gekko should download X candles needed when initializing if not backtesting. No? Else, if backtesting, just get more data?


The strategy already uses BULL if there is no trend since this specific line:
if( maFast < maSlow )

Will be FALSE if 'maSlow' is null (maFast will be over/higher then maSlow since it is null) and thus the BULL settings will be used (which defaults to 80 high and 60 low).

if one would want to change that (reverse it) simply do:
if( maFast < maSlow || !maSlow )

Which basically mean: if maFast is under maSlow --OR-- maSlow is null/undefined the condition is met so do the stuff for this condition (which in this case would be 'BEAR').

If one want to really do something more one could do something like this @ init: function()

this.settings.NOTREND_high = 60;
this.settings.NOTREND_low = 40;

Above could also be added to the TOML-file if one wanted.

...and @ check: function()

if( !maSlow ){
  rsi = ind.BEAR_RSI.result.result; // re-use bear rsi settings
  if( rsi > this.settings.NOTREND_RSI_high ) this.short();
  else if( rsi < this.settings.NOTREND_RSI_low ) this.long();
  if(this.debug) this.lowHigh( rsi, 'notrend' );
  return; // force exit

else if( maFast < maSlow ){
  // regular stuff

else {
  // regular stuff

Do also note that if you set the correct Warmup period this will not be a problem since a trend will be detected when the amount of candles needed is at or over the warmup period.
It is thus only a problem if you don't got enough data.

Messages In This Thread
Werkkrew Stoploss - by susitronix - 02-02-2018, 09:39 PM
Removed post - by susitronix - 02-03-2018, 06:49 PM
RE: [SHARE] Simple RSI BULL/BEAR strategy - by tommiehansen - 02-07-2018, 10:56 PM
@Gryphon Confirmation - by mvangoor - 03-22-2019, 11:59 PM
for 3 months - by ankasem - 02-18-2018, 05:30 PM

Forum Jump:

Users browsing this thread: