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/14/2017 at 11:00 AM #4935410/14/2017 at 11:12 AM #4935710/14/2017 at 11:20 AM #4935811/25/2017 at 7:59 AM #53893
NEW VERSION
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129DEFPARAM CumulateOrders = FALSE// Posizioni cumulate disattivateONCE trailingStopType = TRT // 0 NONE, 1 TRAILINGONCE percprofit = TP // 0.5ONCE percloss = SL // 1ONCE barlong = BXL //15ONCE barshort = BXS //15ONCE atrtrailingperiod = ATRSP //200ONCE minstop = MINSTP //5 Pipsize - least distance of the stop for IGONCE trailingstoplong = TSL //15 Trailing stop start and distanceONCE trailingstopshort = TSS // 15// FRACTALONCE CP = CPI // 120// MOVING AVERAGEONCE avgLongPeriod = AVGL // 80// CUMMRSIONCE CumRsiPer = CRP // 2ONCE cumrsiEnterLongThreshold = CREL // 160ONCE cumrsiEnterShortThreshold = CRES // 60// TRAILINGSTOP//----------------------------------------------atrtrail = AverageTrueRange[atrtrailingperiod]((close/10)*pointsize)//atrtrail = AverageTrueRange[atrtrailingperiod]((close/10)*pointsize)/1000 // for indices divided for 1000trailingstartl = round(atrtrail*trailingstoplong) //trailing stop start and distancetrailingstartS = round(atrtrail*trailingstopshort)if trailingStopType = 1 THENTGL =trailingstartlTGS=trailingstartsif not onmarket thenMAXPRICE = 0MINPRICE = closePREZZOUSCITA = 0ENDIFif longonmarket thenMAXPRICE = MAX(MAXPRICE,close)if MAXPRICE-tradeprice(1)>=TGL*pointsize thenif MAXPRICE-tradeprice(1)>=MINSTOP thenPREZZOUSCITA = MAXPRICE-TGL*pointsizeELSEPREZZOUSCITA = MAXPRICE - MINSTOP*pointsizeENDIFENDIFENDIFif shortonmarket thenMINPRICE = MIN(MINPRICE,close)if tradeprice(1)-MINPRICE>=TGS*pointsize thenif tradeprice(1)-MINPRICE>=MINSTOP thenPREZZOUSCITA = MINPRICE+TGS*pointsizeELSEPREZZOUSCITA = MINPRICE + MINSTOP*pointsizeENDIFENDIFENDIFif onmarket and PREZZOUSCITA>0 thenEXITSHORT AT PREZZOUSCITA STOPSELL AT PREZZOUSCITA STOPENDIFENDIF// FILTER SETTING///BILL WILLIAM FRACTAL INDICATOR//CP=PERIODif 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]endifPTN01 = (close CROSSES OVER HIL)PTN02 = (close CROSSES UNDER LOL)// CUMRSICUMRSI = SUMMATION[CUMRSIPER](RSI[CUMRSIPER](close))// ENTRYcumrsiFilterEnterLong = (cumrsi > cumrsiEnterLongThreshold)cumrsiFilterEnterShort = (cumrsi < cumrsiEnterShortThreshold)//MOVING AVERAGElongAvg = Average[avgLongPeriod] (close)//EnteravgFilterEnterLong = (close>longAvg)avgFilterEnterShort = (close<longAvg)//--------------------------------------------------------------------------------------------------// STRATEGY//--------------------------------------------------------------------------------------------------if (time >=100000 and time < 230000) thenIF NOT LongOnMarket AND avgFilterEnterLong AND PTN01 AND cumrsiFilterEnterLong THENBUY 1 CONTRACT AT MARKETENDIFIF NOT ShortOnMarket AND avgFilterEnterShort AND PTN02 AND cumrsiFilterEnterShort THENSELLSHORT 1 CONTRACT AT MARKETENDIFENDIF// Condizioni per uscire da posizioni longIF POSITIONPERF<0 THENIF LongOnMarket AND BARINDEX-TRADEINDEX(1)>= barLong THENSELL AT MARKETENDIFENDIFIF POSITIONPERF<0 THENIF shortOnMarket AND BARINDEX-TRADEINDEX(1)>= barshort THENEXITSHORT AT MARKETENDIFENDIFSET STOP %LOSS perclossSET TARGET %PROFIT percprofitGRAPH TGLGRAPH TGSATTENTION TO THE TRAILING STOP, NEEDS TO DIVIDE THE DECIMAL, AS SUITABLE ONES TO TRY USING THE FUNCTION GRAPH
7 users thanked author for this post.
11/25/2017 at 10:52 AM #5390311/25/2017 at 1:51 PM #5392311/25/2017 at 5:48 PM #5394311/25/2017 at 6:41 PM #53950Those are interesting results ALE. I guess you could call my 100k WF test an in sample test which although profitable the WF results would give reason for doubts about robustness. Then your 200k test provides an out of sample period where strategy performance is comparable. This gives some confidence that it may continue working. My only concern is the number of trades – 129 is not many. Glad to see that my Cumulative RSI idea has been kept in the strategy though!
Definitely one to watch.
11/25/2017 at 7:18 PM #5395211/25/2017 at 8:03 PM #53958On 1 hour time frame , It’s difficult to speake about robustness, I suggest to look for high Gain/loss value.
That is very interesting that you say that as I have been struggling to persuade myself that my shorter time frame strategies (1Hour or less) are any good and finding that my longer (daily and 4Hr) are proving more robust after WF testing. Maybe you are right and WF testing is less relevant to shorter time frame strategies but I cannot think why that would be. Have you run a WF on your 200K period or back to 2010 period using a dummy value to see how it fairs?
11/25/2017 at 8:04 PM #5395911/25/2017 at 9:39 PM #5396211/25/2017 at 10:31 PM #53963With the permission of ALE,
Here is the file without the graphics and the variables, so you can run it in DEMO.
btw, Very nice job of improvement of the original code.
Saludos,
Juan
1 user thanked author for this post.
11/25/2017 at 10:53 PM #5396511/25/2017 at 10:59 PM #53966@Vonasi,
as we know the problem is the unpredictable movement of the market under daily time frame. The best and simple strategy that we can find are often on daily time frame. The WF work good, the problem it’s unpredictability and the and the ever-changing market movements on low time frames. -
AuthorPosts