I think MA is OK in big trending markets such as SP500 just to ensure that you are not buying when markets are crashing. I too have been working on CumRSI2 strategies and they work fine in trending indexes if you avoid going short but hopeless in Forex markets. I was also working on Fractal strategies but your breakout strategy beat me too it and was better than anything I’d created already! Definitely worth sticking with.
On the subject of tick data – I have given up developing systems on Demo as the data is so different to Live data that it makes the whole thing pointless.
Ale: I just got trades with -5000$ …On the mini contract. Very strange, I’ll check tomorrow 😉
Ale: Saw now it’s not the same. His is dfb, cannot see or use that one.
ALEModerator
Master
YES OZZ it’s different
that’s could be an overfitting… too many variable are pointed.
@ vonasi, many thanks for posting your strategy. Did you test with tick by tick on ? All the trades are zero bar trades otherwise, which is why they are showing an unrealistically steady profit curve.
@ ozz87 You may get different results if you are using a spreadbet account rather than CFD. If you divide the position size by a further 1,000 then you should get trades. But like I mentioned above, the results are not valid as the backtest looks to have been conducted without tick by tick turned on.
Manel – Yes tick by tick was on. I only get ten zero bar trades out of 75 bets. I am on an IG spread bet account. System running on DFB.
ALE – not sure why you think that there are too many variables leading to overfitting. There are only really four variables. One for takeprofit, one for fixed stoploss and one for the trailing stoploss. The fourth is the cp period for the fractal levels which I feel is the biggest variable and which has the biggest effect on results. TakeProfit is set to always be higher than stoploss as is desirable in most strategies. The stoploss is set to hopefully only get hit if a trade goes immediately the wrong way. The trailing stoploss is set at a level whereby it hopefully kicks in early enough to lock in some profit.
The Donchian Channel stop seems to make no difference with the settings as they are so I guess it could be deleted.
Just noticed that my first screenshot of results was with no spread! So have attached new one with 0.9 spread. This is also with some minor modifications to reduce start bet size. New code is this:
//EURUSD(DFB) - IG MARKET
// TIME FRAME 1H
// PROBACKTEST TICK by TICK
// SPREAD 0.9 PIP
// ALE - KASPER - VONASI
DEFPARAM CumulateOrders = false
CP = 101 //Fractal Period
RSINum = 2
Ave = 7 //AverageTrueRange Period
TGLMult = 0.6 //ATR multipier for TGL
STPMult = 1.8 //ATR multiplier for StopLoss
AddOn = 1.1 //Added to STPMult for TakeProfit
RSIHighLevel = 80
RSILowLevel = 100 - RSIHighLevel
//KASPER CODE OF REINVESTMENT
Reinvest=1
if reinvest then
Capital = 5000
Risk = 1//0.1//in % pr position
StopLoss = AverageTrueRange[Ave] * STPMult
TakeProfit = AverageTrueRange[Ave] * STPMult + AddOn
REM Calculate contracts
equity = Capital + StrategyProfit
maxrisk = (equity*(Risk/100))
MAXpositionsize=Capital
MINpositionsize=1
Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(((maxrisk/StopLoss)))))
else
Positionsize=1
StopLoss = Stoploss
Endif
///BILL WILLIAM FRACTAL INDICATOR
if Close[cp] >= highest[2*cp+1](Close) then
LH = 1
else
LH = 0
endif
if Close[cp] <= lowest[2*cp+1](Close) then
LL = -1
else
LL = 0
endif
if LH = 1 then
HIL = Close[cp]
endif
if LL = -1 then
LOL = Close[cp]
endif
//CumulativeRSI2
RSI2 = (SUMMATION[RSINum](RSI[RSINum](Close)))/RSINum
RSILow = RSI2 < RSILowLevel
RSIHigh = RSI2 > RSIHighLevel
//LONG and SHORT CONDITIONS
if (time >=100000 and time < 230000) then
C1 = (close CROSSES OVER HIL)
D1 = (close CROSSES UNDER LOL)
IF c1 and NOT ShortOnMarket and RSIHigh THEN
PositionMultiple = (RSI2/100) + 1//Increase PositionSize depending on CumRSI2 level
PositionSize = (PositionSize/((RSIHighLevel/100)+1)) * PositionMultiple
PositionSize = Round(PositionSize * 100)
PositionSize = PositionSize / 100
BUY positionsize CONTRACT AT MARKET
ENDIF
IF D1 and NOT LongOnMarket and RSILow THEN
PositionMultiple = ((100-RSI2)/100) + 1//Increase PositionSize depending on CumRSI2 level
PositionSize = (PositionSize/((RSIHighLevel/100)+1)) * PositionMultiple
PositionSize = Round(PositionSize * 100)
PositionSize = PositionSize / 100
SELLSHORT positionsize CONTRACT AT MARKET
ENDIF
ENDIF
//TRAILING STOP
TGL = AverageTrueRange[Ave] * TGLMult
TGS = TGL
if not onmarket then
MAXPRICE = 0
MINPRICE = close
PriceExit = 0
ENDIF
if longonmarket then
MAXPRICE = MAX(MAXPRICE,close)
if MAXPRICE-tradeprice(1)>=TGL*pointsize then
PriceExit = MAXPRICE-TGL*pointsize
ENDIF
ENDIF
if shortonmarket then
MINPRICE = MIN(MINPRICE,close)
if tradeprice(1)-MINPRICE>=TGS*pointsize then
PriceExit = MINPRICE+TGS*pointsize
ENDIF
ENDIF
if onmarket and PriceExit>0 then
EXITSHORT AT PriceExit STOP
SELL AT PriceExit STOP
ENDIF
set target pprofit TakeProfit
set stop loss stoploss
ALEModerator
Master
@ vonasi
only some doubts about these:
TGLMult = 0.6 //ATR multipier for TGL
STPMult = 1.8 //ATR multiplier for StopLoss
AddOn = 1.1 //Added to STPMult for TakeProfit
And the strategy in general.. i’m not satisfy…
Almost all strategies will have a fixed stoploss and maybe a trailing one that will be optimized. The ones I have used just happens to be short term ATR based rather than fixed . Takeprofit is the same. I guess the true test of whether it is overoptimized is how big the window of multipliers that still provide a profit is. The cp number has the most effect on overall performance of both your and my version I feel and may be a case of what worked in the past does not work in the future.
I admit that 100k candles on 1 hour is impossible for any true analysis of either version. Can anyone do a backtest on 200k?
Forward testing will be interesting to watch on both versions but we may need to wait quite some time for mine as 75 trades over 100k is not very many. The CumRSI2 has improved quality but at the price of quantity. Of course the CumRSI2 level can be changed to 70/30 or 60/40 etc to improve bet quantity at the price of average gain per trade and win rate.
Always interesting to have other peoples opinions on what is too much optimization and what is not. The day I write a code that has no optimization and turns a profit will be the day I become a millionaire!
I’ve had good results with one of the original strategys in live trading from this thread. See attachment EURUSD fractal results.pdf.
I tried to use 200.000 bars to test the strategy from the post above (48480). When going so far back in time tick-by-tick testing is not possible (!). I removed the mm from it, Reinvest=0, and added a stop and target. I’ll add another post with tick-by-tick, back to mid 2010.
This is the code I used:
//EURUSD(DFB) - IG MARKET
// TIME FRAME 1H
// PROBACKTEST TICK by TICK
// SPREAD 0.9 PIP
// ALE - KASPER - VONASI
DEFPARAM CumulateOrders = false
CP = 101 //Fractal Period
RSINum = 2
Ave = 7 //AverageTrueRange Period
TGLMult = 0.6 //ATR multipier for TGL
STPMult = 1.8 //ATR multiplier for StopLoss
AddOn = 1.1 //Added to STPMult for TakeProfit
RSIHighLevel = 80
RSILowLevel = 100 - RSIHighLevel
//KASPER CODE OF REINVESTMENT
Reinvest=0 //change
if reinvest then
Capital = 5000
Risk = 1//0.1//in % pr position
StopLoss = AverageTrueRange[Ave] * STPMult
TakeProfit = AverageTrueRange[Ave] * STPMult + AddOn
REM Calculate contracts
equity = Capital + StrategyProfit
maxrisk = (equity*(Risk/100))
MAXpositionsize=Capital
MINpositionsize=1
Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(((maxrisk/StopLoss)))))
else
Positionsize=1
TakeProfit = 70 //change
StopLoss = 50 //change
Endif
///BILL WILLIAM FRACTAL INDICATOR
if Close[cp] >= highest[2*cp+1](Close) then
LH = 1
else
LH = 0
endif
if Close[cp] <= lowest[2*cp+1](Close) then
LL = -1
else
LL = 0
endif
if LH = 1 then
HIL = Close[cp]
endif
if LL = -1 then
LOL = Close[cp]
endif
//CumulativeRSI2
RSI2 = (SUMMATION[RSINum](RSI[RSINum](Close)))/RSINum
RSILow = RSI2 < RSILowLevel
RSIHigh = RSI2 > RSIHighLevel
//LONG and SHORT CONDITIONS
if (time >=100000 and time < 230000) then
C1 = (close CROSSES OVER HIL)
D1 = (close CROSSES UNDER LOL)
IF c1 and NOT ShortOnMarket and RSIHigh THEN
PositionMultiple = (RSI2/100) + 1//Increase PositionSize depending on CumRSI2 level
PositionSize = (PositionSize/((RSIHighLevel/100)+1)) * PositionMultiple
PositionSize = Round(PositionSize * 100)
PositionSize = PositionSize / 100
BUY positionsize CONTRACT AT MARKET
ENDIF
IF D1 and NOT LongOnMarket and RSILow THEN
PositionMultiple = ((100-RSI2)/100) + 1//Increase PositionSize depending on CumRSI2 level
PositionSize = (PositionSize/((RSIHighLevel/100)+1)) * PositionMultiple
PositionSize = Round(PositionSize * 100)
PositionSize = PositionSize / 100
SELLSHORT positionsize CONTRACT AT MARKET
ENDIF
ENDIF
//TRAILING STOP
TGL = AverageTrueRange[Ave] * TGLMult
TGS = TGL
if not onmarket then
MAXPRICE = 0
MINPRICE = close
PriceExit = 0
ENDIF
if longonmarket then
MAXPRICE = MAX(MAXPRICE,close)
if MAXPRICE-tradeprice(1)>=TGL*pointsize then
PriceExit = MAXPRICE-TGL*pointsize
ENDIF
ENDIF
if shortonmarket then
MINPRICE = MIN(MINPRICE,close)
if tradeprice(1)-MINPRICE>=TGS*pointsize then
PriceExit = MINPRICE+TGS*pointsize
ENDIF
ENDIF
if onmarket and PriceExit>0 then
EXITSHORT AT PriceExit STOP
SELL AT PriceExit STOP
ENDIF
set target pprofit TakeProfit
set stop ploss stoploss //change
The tick-by-tick results.
Also tried WF with no optimalization. If the strategy is optimized for all bars, it’s not very useful but anyways…
Thanks for that Ronny. Bit difficult to know what the exact conclusion is though as you changed the stoploss and takeprofit from the ATR based ones. Any chance of a tick by tick back to mid 2010 with the ATR?
Overall I think it looks hopeful as the longer test period did not show any major flaws in using the CumRSI2 filter.
Your changes did highlight one thing – I somehow messed up the non re-investment takeprofit and stoploss in my code while creating it so it wouldn’t work correctly with reinvest=0. It should read as so:
//KASPER CODE OF REINVESTMENT
Reinvest=1
if reinvest then
Capital = 5000
Risk = 1//0.1//in % pr position
StopLoss = AverageTrueRange[Ave] * STPMult
TakeProfit = AverageTrueRange[Ave] * STPMult + AddOn
REM Calculate contracts
equity = Capital + StrategyProfit
maxrisk = (equity*(Risk/100))
MAXpositionsize=Capital
MINpositionsize=1
Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(((maxrisk/StopLoss)))))
else
Positionsize=1
StopLoss = AverageTrueRange[Ave] * STPMult
TakeProfit = AverageTrueRange[Ave] * STPMult + AddOn
Endif
The positionsize variable ends up with a value of 5000+.
MIN(MAXpositionsize,abs(((maxrisk/StopLoss))))
returns a value of 5000.
I don’t know about DFB, is this different from cfd?