Fractal breakout intraday Strategy EUR/USD 1H –
Forums › ProRealTime English forum › ProOrder support › Fractal breakout intraday Strategy EUR/USD 1H –
- This topic has 359 replies, 1 voice, and was last updated 1 year ago by RandyG.
-
-
10/05/2017 at 6:49 PM #48337
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.
10/05/2017 at 9:10 PM #4833910/05/2017 at 9:12 PM #4834010/06/2017 at 1:03 PM #4843310/06/2017 at 6:53 PM #48472@ 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.
10/06/2017 at 9:09 PM #4847410/06/2017 at 9:21 PM #48479ALE – 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.
10/06/2017 at 9:39 PM #48480Just 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:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109//EURUSD(DFB) - IG MARKET// TIME FRAME 1H// PROBACKTEST TICK by TICK// SPREAD 0.9 PIP// ALE - KASPER - VONASIDEFPARAM CumulateOrders = falseCP = 101 //Fractal PeriodRSINum = 2Ave = 7 //AverageTrueRange PeriodTGLMult = 0.6 //ATR multipier for TGLSTPMult = 1.8 //ATR multiplier for StopLossAddOn = 1.1 //Added to STPMult for TakeProfitRSIHighLevel = 80RSILowLevel = 100 - RSIHighLevel//KASPER CODE OF REINVESTMENTReinvest=1if reinvest thenCapital = 5000Risk = 1//0.1//in % pr positionStopLoss = AverageTrueRange[Ave] * STPMultTakeProfit = AverageTrueRange[Ave] * STPMult + AddOnREM Calculate contractsequity = Capital + StrategyProfitmaxrisk = (equity*(Risk/100))MAXpositionsize=CapitalMINpositionsize=1Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(((maxrisk/StopLoss)))))elsePositionsize=1StopLoss = StoplossEndif///BILL WILLIAM FRACTAL INDICATORif Close[cp] >= highest[2*cp+1](Close) thenLH = 1elseLH = 0endifif Close[cp] <= lowest[2*cp+1](Close) thenLL = -1elseLL = 0endifif LH = 1 thenHIL = Close[cp]endifif LL = -1 thenLOL = Close[cp]endif//CumulativeRSI2RSI2 = (SUMMATION[RSINum](RSI[RSINum](Close)))/RSINumRSILow = RSI2 < RSILowLevelRSIHigh = RSI2 > RSIHighLevel//LONG and SHORT CONDITIONSif (time >=100000 and time < 230000) thenC1 = (close CROSSES OVER HIL)D1 = (close CROSSES UNDER LOL)IF c1 and NOT ShortOnMarket and RSIHigh THENPositionMultiple = (RSI2/100) + 1//Increase PositionSize depending on CumRSI2 levelPositionSize = (PositionSize/((RSIHighLevel/100)+1)) * PositionMultiplePositionSize = Round(PositionSize * 100)PositionSize = PositionSize / 100BUY positionsize CONTRACT AT MARKETENDIFIF D1 and NOT LongOnMarket and RSILow THENPositionMultiple = ((100-RSI2)/100) + 1//Increase PositionSize depending on CumRSI2 levelPositionSize = (PositionSize/((RSIHighLevel/100)+1)) * PositionMultiplePositionSize = Round(PositionSize * 100)PositionSize = PositionSize / 100SELLSHORT positionsize CONTRACT AT MARKETENDIFENDIF//TRAILING STOPTGL = AverageTrueRange[Ave] * TGLMultTGS = TGLif not onmarket thenMAXPRICE = 0MINPRICE = closePriceExit = 0ENDIFif longonmarket thenMAXPRICE = MAX(MAXPRICE,close)if MAXPRICE-tradeprice(1)>=TGL*pointsize thenPriceExit = MAXPRICE-TGL*pointsizeENDIFENDIFif shortonmarket thenMINPRICE = MIN(MINPRICE,close)if tradeprice(1)-MINPRICE>=TGS*pointsize thenPriceExit = MINPRICE+TGS*pointsizeENDIFENDIFif onmarket and PriceExit>0 thenEXITSHORT AT PriceExit STOPSELL AT PriceExit STOPENDIFset target pprofit TakeProfitset stop loss stoploss10/06/2017 at 10:39 PM #4848310/07/2017 at 10:33 AM #48518Almost 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!
10/07/2017 at 12:31 PM #48533I’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:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110//EURUSD(DFB) - IG MARKET// TIME FRAME 1H// PROBACKTEST TICK by TICK// SPREAD 0.9 PIP// ALE - KASPER - VONASIDEFPARAM CumulateOrders = falseCP = 101 //Fractal PeriodRSINum = 2Ave = 7 //AverageTrueRange PeriodTGLMult = 0.6 //ATR multipier for TGLSTPMult = 1.8 //ATR multiplier for StopLossAddOn = 1.1 //Added to STPMult for TakeProfitRSIHighLevel = 80RSILowLevel = 100 - RSIHighLevel//KASPER CODE OF REINVESTMENTReinvest=0 //changeif reinvest thenCapital = 5000Risk = 1//0.1//in % pr positionStopLoss = AverageTrueRange[Ave] * STPMultTakeProfit = AverageTrueRange[Ave] * STPMult + AddOnREM Calculate contractsequity = Capital + StrategyProfitmaxrisk = (equity*(Risk/100))MAXpositionsize=CapitalMINpositionsize=1Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(((maxrisk/StopLoss)))))elsePositionsize=1TakeProfit = 70 //changeStopLoss = 50 //changeEndif///BILL WILLIAM FRACTAL INDICATORif Close[cp] >= highest[2*cp+1](Close) thenLH = 1elseLH = 0endifif Close[cp] <= lowest[2*cp+1](Close) thenLL = -1elseLL = 0endifif LH = 1 thenHIL = Close[cp]endifif LL = -1 thenLOL = Close[cp]endif//CumulativeRSI2RSI2 = (SUMMATION[RSINum](RSI[RSINum](Close)))/RSINumRSILow = RSI2 < RSILowLevelRSIHigh = RSI2 > RSIHighLevel//LONG and SHORT CONDITIONSif (time >=100000 and time < 230000) thenC1 = (close CROSSES OVER HIL)D1 = (close CROSSES UNDER LOL)IF c1 and NOT ShortOnMarket and RSIHigh THENPositionMultiple = (RSI2/100) + 1//Increase PositionSize depending on CumRSI2 levelPositionSize = (PositionSize/((RSIHighLevel/100)+1)) * PositionMultiplePositionSize = Round(PositionSize * 100)PositionSize = PositionSize / 100BUY positionsize CONTRACT AT MARKETENDIFIF D1 and NOT LongOnMarket and RSILow THENPositionMultiple = ((100-RSI2)/100) + 1//Increase PositionSize depending on CumRSI2 levelPositionSize = (PositionSize/((RSIHighLevel/100)+1)) * PositionMultiplePositionSize = Round(PositionSize * 100)PositionSize = PositionSize / 100SELLSHORT positionsize CONTRACT AT MARKETENDIFENDIF//TRAILING STOPTGL = AverageTrueRange[Ave] * TGLMultTGS = TGLif not onmarket thenMAXPRICE = 0MINPRICE = closePriceExit = 0ENDIFif longonmarket thenMAXPRICE = MAX(MAXPRICE,close)if MAXPRICE-tradeprice(1)>=TGL*pointsize thenPriceExit = MAXPRICE-TGL*pointsizeENDIFENDIFif shortonmarket thenMINPRICE = MIN(MINPRICE,close)if tradeprice(1)-MINPRICE>=TGS*pointsize thenPriceExit = MINPRICE+TGS*pointsizeENDIFENDIFif onmarket and PriceExit>0 thenEXITSHORT AT PriceExit STOPSELL AT PriceExit STOPENDIFset target pprofit TakeProfitset stop ploss stoploss //change10/07/2017 at 12:36 PM #4853710/07/2017 at 12:41 PM #4854010/07/2017 at 2:21 PM #48550Thanks 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:
Reinvestment Code Error Fix12345678910111213141516171819//KASPER CODE OF REINVESTMENTReinvest=1if reinvest thenCapital = 5000Risk = 1//0.1//in % pr positionStopLoss = AverageTrueRange[Ave] * STPMultTakeProfit = AverageTrueRange[Ave] * STPMult + AddOnREM Calculate contractsequity = Capital + StrategyProfitmaxrisk = (equity*(Risk/100))MAXpositionsize=CapitalMINpositionsize=1Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(((maxrisk/StopLoss)))))elsePositionsize=1StopLoss = AverageTrueRange[Ave] * STPMultTakeProfit = AverageTrueRange[Ave] * STPMult + AddOnEndif10/07/2017 at 3:30 PM #48557 -
AuthorPosts