02-07-2018, 10:56 PM
(This post was last modified: 02-07-2018, 11:21 PM by tommiehansen.)
(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.
BR,
Mathias
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()
// NO IDEA / NO TREND
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
}
// BEAR
else if( maFast < maSlow ){
// regular stuff
}
// BULL
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.