Hi, I modified prorealtime gapdetection indicator to a simple strategy basis for a long position.
Only 1 or 2 parameters and it gives interesting results with a simple stop of 1% for intraday or for daily a stop of 3%
the parameter has very small range i.e. 1-14 to optimise.
some stock/futures 5 min with 50.000 units backtest
p=1 unilever 81.89 % profitable with win/loss 1.8 in 497 trades.
p=1 tkh 71.67 % profitable with win/loss 1.54 473 trades
p=1 heineken 82,46% profitable with win/loss 1.48 496 trades
p=5 aex 5 min 84.44% profitable with win/loss 1.65 270 trades
Have a look and maybe it’s interesting enough to dig further !
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
//Strategy: GapCatcherLong DEFPARAM CUMULATEORDERS = false DEFPARAM PRELOADBARS = 1000 //DEFPARAM FLATBEFORE = 100000 //DEFPARAM FLATAFTER = 200000 //lasttime = 235900 //begintime = 000000 //endtime = 210000 Amplitude = 0 Detector = 0 p=5 // buy criteria if close < dclose(p) then if (abs((high-low[1]) / low[1]) > Amplitude) then detector = 1 endif endif // sell criteria if close > dclose(p) then if (abs((low-high[1]) /high[1]) > Amplitude) then detector = -1 endif endif // long entry // if time >= begintime and time<=lasttime then if not longonmarket and detector = 1 then buy 1 lot at market SET STOP %LOSS 1 endif //endif // long exit if longonmarket and detector = -1 then sell at market endif //If time >= endtime then //if longonmarket then //sell at market //elsif shortonmarket then //exitshort at market //endif //endif //If dayofweek >= 5 and hour > 17 Then //If longonmarket Then //Sell at market //ElsIf shortonmarket Then //Exitshort at market //EndIf //EndIf GRAPH detector coloured(300,0,0) AS "detector" //noting GRAPH (positionperf*100) coloured(0,0,0,255) AS "PositionPerformance" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
thanks, which underlying are you using?
Thank’s for your job. Which spread on your screen report ?
Thanks for the interest. I’am new to this and will trade CFD. What exactly do you mean with underlying? I didn’t set the spread in backtest.
Although it looks interesting just wondering: Aren’t the second conditions for the buy and sell criteria [Buy: (abs((high-low[1]) / low[1]) > Amplitude) ; Sell: (abs((low-high[1]) /high[1]) > Amplitude)] always true due to the use of “abs” with amplitude at 0 [unless high and low[1] or high[1] and low are exactly the same]?
You’re right. It’s always bigger then 0 unless it’s 0, which can happen the way you said.. You can set a different amplitude like 0.0005 which probably makes more sense. In the original gap detection indicator the value is also bigger then 0. With different coding on amplitude you can improve the code, although it gives more parameters to optimise.
Hi Paul,
Thanks for sharing 🙂
Same question probably as Francesco78, which securities you used on the screenshot that you posted? Just to compare if I have similar result as yours
its the aex25 futures with p5
Useful to this code is to put this as indicator on a intraday price chart
dc=dclose(1)
RETURN dc as “dc”
I can not reproduce your results. Which timeframe do you run it on?
1-10 min. Here 5 as posted.
add additional indicator to get bigger profits and limit number of trades.
Hi, great strategy, it would be interesting to filter signals with atr.
Hi Paul – I tried the original strategy. My first trade showed first a great profit, but it turned out to be a loss in the end. Should the strategy have a element of profit-taking?
Another thing – have you also tried to go short?
try activate Williams 3 bar trailing stop to exit when profits are i.e. above x% with a stoploss of y%.
You can modify to go short. It’s more tough although profitable and the gains are lacking behind to the long positions.
Hi Paul,
Thanks for sharing but I cannot reproduce any profit on Heineken on 5mn ;
Best,
C
BONJOUR PAUL impossible de tenter le trading automatique, PRT me dis que l instruction “GRAPH” ne passe pas…as tu une solution? cordialement
Bonjour, supprimez les lignes avec un “graph”
merci. vous l utiliser actuellment sur quel instrument vous? et quel timeframe? Merci