Hello all, this is the latest version of my reversion bars strategy on GBPUSD, it has been optimized and its running better, also i have backtested on 100000. If anyone want to kindly backtest this strategy on 200000 bars, be my guest and please share the results =D =D Thanks and good trading
defparam cumulateorders = false
MyEMA = ExponentialAverage[36](close)
nbar = 4
//Volatility Filter://
//FDI (fractal dimension index)
N = 33
once fdi=undefined
if barindex >= n-1 then
diff=0
length = 0
pdiff = 0
hh=0
ll=0
FDI=0
HH = highest[N](close)
LL = lowest[N](close)
for Period = 1 to N-1 do
if (HH - LL) > 0 then
diff = (customclose[Period] - LL) / (HH - LL)
if Period > 1 then
length = length + SQRT(SQUARE(diff - pdiff) + (1 / SQUARE(N)))
endif
pdiff = diff
endif
next
if length > 0 then
FDI = 1 + (LOG(length) + LOG(2)) / LOG(2 * (N))
else
FDI = 0
endif
endif
positionsize = 1
C4 = MyEMA CROSSES OVER CLOSE
C3 = BARINDEX - TRADEINDEX = NBAR
C5 = close CROSSES UNDER MyEMA
//Enter long positions
IF not longonmarket and open > close[1] and C4 and FDI<1.5 THEN
BUY positionsize LOT AT MARKET nextbaropen
ENDIF
//Exit long positions
If LongOnMarket AND C3 THEN
SELL AT MARKET
endif
//Enter short positions
IF NOT ShortOnMarket AND open < close[1] and C5 and FDI<1.5 THEN
SELLSHORT positionsize LOT AT MARKET nextbaropen
ENDIF
// Exit short positions
IF ShortOnMarket AND C3 THEN
EXITSHORT AT MARKET
endif
//Stops
//set stop $loss 60
Hi David, thank you for your post into the library. I moved it here because I think you should first make a robustness test with the new WF tool.
As you can see in my attached pictures, I backtested the strategy with and without the tick mode. It is obviously overfitted and that’s why I think you should use the Walk Foward tool to see how and when the strategy should be re-optimized in order to be more confident about the way the strategy could perform in the future. You can read the Walk Forward FAQ in this blog article.
Thanks Nicolas,
I’ll put some more work on it and perform a non-anchored WF to the system. However, WF results not always have the last word when it comes to real performance.
Anyway, many thanks for your advice and i’ll post it again with better and reliable results.
Best Regards,
The WF analysis will tell you if the strategy is robust: it will use optimized variables values into ‘real’ trading periods (Out Of Sample periods) in the past to see if the strategy performed as good as in the optimized period (the In-Sample one).
Nicolas,
Yes, i know that is a superb tool, i have been using it since last year and i like it very much, i did not use it in this particular strategy.
One question though, from which % in an X period do you consider “suspicious” or “out of range”, for example: >90 % or >120% ?
Thanks
This is a very good question! and there is not an easy answer. I think it depends of the market behavior, a big WFE could be due to a gap or a sudden crash of the market in the good direction, so in this case this is not so very important as long as one WFE isn’t larger than 50% of the overall profit of the backtest. Of course, we also don’t want a lot of high WFE (+150, +200%+++), because the strategy we have developed was not designed to achieve these kind of huge results!
Because the WF tool only give result of the most profitable strategy, it introduces a bias in the test and that’s why we must make a deep analysis of the WFE and why they are good or not..