Combined SuperTrend, Parabolic SAR and MACD strategy

Combined SuperTrend, Parabolic SAR and MACD strategy

EUR / USD 1 minute strategy

This strategy is a combination of 3 indicators, SuperTrend, Parabolic SAR and MACD; also including the Range. A trade entry is generated following the switch of the Parabolic SAR from BUY to SELL or vice versa, after a longer Parabolic SAR run (the aim of this is to ignore shorter term price changes and focus on more significant trend changes). The attachments and performance is based on only £1 per pip, producing an approximate 9% return every 3 months. Compounding the trade size as your capital grows should produce a reasonable return (i.e. use the 2% compounding model as per Bob Volman’s book (2011) on FX scalping.

However this is far from perfect as I would like to improve the Win / Loss ratio. So any comments and improvements are welcome!

 

Share this

Risk disclosure:

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 : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Nicolas • 05/15/2016 #

    Thanks a lot for your contribution to the library. Much appreciated 😉

  2. Steftonio • 05/15/2016 #

     Nicolas, cette stratégie ne fonctionne pas avec l’EUR/USD minilot en France et je ne comprends pas le a[1]>2. Pourrais-tu m’expliquer ou traduire cette stratégie sur le minilot EUR/USD français.
    Bien cordialement,

  3. Pablo Carmona del Moral • 05/15/2016 #

    hello! this program when I download, no run. I don’t know why.

  4. gianlox • 05/15/2016 #

     not working too hard for me to find the error..

  5. Nicolas • 05/15/2016 #

    I just asked the author of this strategy, cpgraham, the reason why no trade are launched.
    I think the lines 36 and 41 maybe have something wrong in the range tests and the a[1]>2 should be replaced by :
    a[1] > 2*pipsize
    But this is not my code and I’m looking forward for cpgraham answers 🙂

  6. Eric • 05/15/2016 #

    Its probably the difference between IGs CFD and SB quotes?
    EURUSD SB = 11 325.1
    EURUSD CFD = 1.13251

  7. cpgraham • 05/15/2016 #

    Hi all, thanks for the feedback. I apologise for any difficulties running the code. I suspect the problems are a combination of a few issues; hence some further details are appropriate. My setup is:  IG Markets version 10.2 of ProRealTime.
    Eric is absolutely correct. There can be differences in quote formats with brokers. Most brokers quote in the same format as normal FX quotes e.g. 1.1325; but IG have moved the decimal point 4 places to 11325.1. After a little checking using POINTSIZE to convert the price into the correct format should resolve the issue. I also tested the change suggested by Nicolas on my version, and it produced the same results, so hopefully these fixes should work on any version / platform of PRT. The amended code is attached below. If you are still having problems you know the likely reasons why, as stated here, so you should be able to resolve them. If not please let me know and I’ll do my best to help you resolve it. Hopefully you can step through the code and understand what the strategy is doing, and apply it to your platform.
    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    DEFPARAM FlatBefore = 080000
    DEFPARAM FlatAfter = 180000

    ST = SuperTrend[3,5] //3,10
    ParaSAR = SAR[0.02,0.02,0.03]
    MCD = MACDline[12,26,150](close)
    SIG = ExponentialAverage[9](MACDline[12,26,150](close))
    Q = MCD - SIG
    a=Range

    p = 100 //100
    a1= lowest[p](low) //p
    b1= highest[p](high) //p
    c1 =100* (3 * close - 2* a1 - open[p-1]) / customclose //p-1
    c2 = 100*(open[p-1] + 2 * b1 -3 * close) / customclose //p-1
    SR = exponentialAverage[p*5](c1) - exponentialAverage[p*5](c2) //5*p

    ONCE countB = 0
    ONCE countS = 0

    IF ST[2] >= ST[1] THEN
    countB = countB + 1
    ELSE
    countB = 0
    ENDIF

    IF ST[1] >= ST[2] THEN
    countS = countS + 1
    ELSE
    countS = 0
    ENDIF

    // Conditions to enter long positions 0.045
    IF NOT ONMARKET AND countB > 15 AND ST > ST[1] AND ParaSAR < close AND (Q - Q[1]) > (0.045*POINTSIZE) AND SR > SR[1] AND a[1] > 2*PIPSIZE THEN
    BUY 1 PERPOINT AT MARKET
    ENDIF

    // Conditions to enter short positions 0.19 0.186
    IF NOT ONMARKET AND countS > 15 AND ST[1] > ST AND ParaSAR > close AND (Q[1] - Q) > (0.186*POINTSIZE) AND SR < SR[1] AND a[1] > 2*PIPSIZE THEN
    SELLSHORT 1 PERPOINT AT MARKET
    ENDIF

    // Stops and targets
    SET TARGET pPROFIT 10
    SET STOP PLOSS 10
     

  8. ladefense • 05/15/2016 #

    ça marche pas ….

  9. ladefense • 05/15/2016 #

    je suis d accord avec eric , doit y avoir un soucis avec l echelle .

  10. ladefense • 05/15/2016 #

    ok it works !

  11. cpgraham • 05/15/2016 #

    Good. Enjoy. Please advise of any improvements. Many thanks.
     

  12. ladefense • 05/15/2016 #

    works well on dax  10 min  15 min …. but spread non included .

  13. cpgraham • 05/15/2016 #

    IG Market spread on EUR / USD is 0.8 pip

  14. ladefense • 05/15/2016 #

    i ‘ ll try to post some screenshots …

  15. cpgraham • 05/15/2016 #

    Thanks ladefense; I agree, both 10 min and 15 min on the DAX works well!

  16. manel • 05/15/2016 #

    Hi guys. I tried testing this same code and agree that on the face of it the Dax 10/15m appears to work well but on closer inspection at the timing of the entry/exits the results cannot be relied upon. A large proportion of the trades are entered and exited within the same bar (admittedly resulting in both profits and losses) but as has been discussed on here before, this gives rise to incorrect results as it is a limitation of PRT that the system cannot look inside the bar to see how the ticks actually progressed in real time. So I would view any results like these with caution. Perhaps there may be a way of coding the indicators to use 10/15 min periods (ie 2/3 x 5 min bars) but the code is always run on a 5 min timeframe to give more accurate results ? I’m trying myself to code like this but am finding it difficult so far.
    On a more positive note it works well on EUR/USD 1 min with none of the issues above, so something worth pursuing on that front I think. I am going to test some parameters and will report back if anything useful comes out of it. 

  17. volpiemanuele • 05/15/2016 #

    Hi,
    what is the correct code and in wich market perform the best ? I  will try to optimize it. Tanks emanuele
     

  18. Nicolas • 05/15/2016 #

    The code of the post has been updated to the final version FYI.

  19. Doctrading • 05/15/2016 #

    I think that with some optimization, it can be a good strategy.For example : 
    DAX, M15
    spread : 1 point
    stop loss and take profit : 30 pips (to avoid SL and TP on the same candle, which PRT considers always as a winning trade…)
     
    We need to make some tests

  20. ladefense • 05/15/2016 #

    Does anybody could backtest the strategie  on forex ( eur usd )  with more data ?
     
    i mean before february 2016 .

  21. manel • 05/15/2016 #

    Hi Grahal – I fully concur with your comments. Until PRT change the issue with the incorrectly calculated results in backtest anyone using shorter timeframe entry/exit strategies or strategies with very small limits/stops should be very wary of the results as they will almost certainly be incorrect. There almost needs to be a warning on the results incorporated by PRT for this as it will catch out the inexperienced and may cause them ultimate loss.
    On the other hand, longer timeframe strategies and those with bigger limits/stops should be accurate as it would  most likely not give rise to a “look inside bar” issue.  PRT is a very good system on the whole I feel so this should not discourage anyone. This forum is great and many thanks to all the people who take the time to post on here and especially to Nicolas who does a great job on helping everyone.
    Also Grahal – thanks for pointing out the zero bar position issue, it’s easy to assume that no position on the graph meant exactly that before but good that you pointed out the possible discrepancy here.

  22. cpgraham • 05/15/2016 #

    Hi All, I had exactly the same experience a year ago with PRT; I thought I’d discovered a fantastic scalping strategy with a 2 pip stop loss and 2 pip take profit. Running it in live with real funds made me realise otherwise. If I’m being negative about the PRT platform it is that I often find there are differences between the backtests and the real performance; which is frustrating. I suspect the issue is with the broker database of historic data rather than the software itself. That is why I stopped trying to create strategies with anything less than a 6 pip S/L or T/P; because the performance cannot be relied upon.
    Ladefense, I’ve also been looking for a source of more historic data for backtesting. I’d be happy to purchase additional data if it was available.
     
    Any improvements to the original code are very welcome, please share them of course.
    Best Regards

  23. Nicolas • 05/15/2016 #

    Hello everyone, I must agree with everyone about the backtests difference with the real time trading.
    But, this is something I can ensure everyone, that is definitely a priority for the PRT programmers in their TO-DO list. I can only tell you that this improvement is actually been coded and tested for Probacktest to better reflect real-time trading and what would really occurred. So please be patient because this feature will be implemented with many others… The only information I have about their releases is “when it’s done”, so please don’t ask! 😉

  24. ladefense • 05/15/2016 #

    ok les gars bien sur je suis d accord avec vous , et je connaissait ce probleme . Mais je pense qu il faut comparer le backtest et les signaux  dans pro order ,c est  a dire en reel ,  en ce moment je suis en train de faire cette etude .
    Apres cette etude on sera surs que ça  ne marche pas ou pas .
    @ nicolas : peut tu traduire s il t plait …

    • Nicolas • 05/15/2016 #

      Directement depuis Google Translate 🙂
      Bonjour à tous, je suis d’accord avec tout le monde à propos de la différence de backtests avec le trading en temps réel.Mais, cela est quelque chose que je peux assurer tout le monde, qui est certainement une priorité pour les programmeurs PRT dans leur liste de tâches. Je peux seulement vous dire que cette amélioration est effectivement été codé et testé pour ProBacktest afin de mieux refléter la négociation en temps réel et ce qui est réellement passé. Alors s’il vous plaît soyez patient car cette fonctionnalité sera mise en œuvre avec beaucoup d’autres … La seule information dont je dispose au sujet de leurs rejets est “quand il est fait”, s’il vous plaît donc ne demandez pas!

  25. ladefense • 05/15/2016 #

    real orders and orders on backtest seem to be similar .

     
     

  26. avatar
    Anonymous • 05/15/2016 #

    Why?
     
    DEFPARAM FlatBefore = 080000DEFPARAM FlatAfter = 180000
     
    It is forex should work 24h. Don’t you think so?

  27. Ian Graham • 05/15/2016 #

    Reading some of the above about back testing. The smaller the time frame the more likely that the back testing will be accurate though none of it is that accurate. Yes, it’s only at the end of the candle that the stops/limits are checked. If you have a 50 stop and a 50 limit and neither is hit during the candle, it moves on to the next as you’d expect. If both the limit and loss are hit during the candle then EVEN IF the stop is hit first, as long as your limit is hit your given the limit and the loss ignored. This inflates profits big time. Ideally it should recognise both and return the 1st hit but alternatively they could easily change it so the loss overrides the profit so and profits made would be understated so when you go live you should at least make what the back testing shows. Over longer time periods on backtesting as the price moves more, there’s more chance your limits and stops will be hit delivering only the profit so shorter time periods on backtesting are likely to be more realistic.
    At time of writing on back testing with IG trailing stops don’t work at all on many pairs and not certain they work at all and multiple trades don’t work either. Only one trade at a time opens even when copying the code direct from the manual.
    🙁

  28. Francesco78 • 05/15/2016 #

    does anyone still use this strategy? Seems like it doesnt work anymore

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+1 more likes

Related users ' posts
Doctrading Bonjour, Tu as raison, il faut faire attention à la fiabilité de certains backtests. Le pro...
Duccio Hi DocTrading, I've backtested your strategy and I notice that 75% of position have been cl...
Doctrading Hello,  No, I don't use this strategy on real account, because my own strategies (that you ...
Doctrading Maybe you can also change the hourly beginning of the day (not 23PM but 12AM, OOH in french)...
Duccio Hi Doctrading,there is a way to control the max loss of the positions in this code? For exa...
Doctrading Hello, Yes, there is a command I think, but I don't know it. Nicolas knows it. You can als...

Top