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?

New! PRC is also now 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. david-1984 • 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
Related users ' posts
Florian Legeard Bonjour, comment faire fonctionner sous IG ? Je n'arrive pas a corriger le code. Merci pour...
Matriciel Bonjour Florian, c'est un code qui tourne sur la plateforme ProRealTime.
betocil ligne 47 le close ne fonctionne pas: IF SHORTONMARKET AND COUNTOFLONGSHARES close[6]) = 32 ...
juanj DId some tests using MACD validations on higher timeframes using MTF functionality and unfor...
FREDNC Hi Francesco I tried with :
FREDNC adx[14]>adxmin and adx[14] > adxr[14] and adx[14]>adxmin and adx[14] DIminus[3](clo...
Maik2404 es sind leider nur long Positionen und keine Short zu erkennen.
Maik2404 Vytautas: es bleibt aber nur bei long Auslösungen
ullle73 this one is not a winner, have backtested it on almost all pairs, does not have an edge
Jan Wind Hi Francesco Just a question, how do you deal with interest costs of your broker, do you in...
Jan Wind Hi Francesco, and where do you get the information of non trading months and non trading da...
Francesco78 Jan Wind, I obtain it from the backtest
Wilko In answer to SAM: The Logic of the cover clause containing the same logic as the entry-claus...
JanWd Tried the code, nice concept, seems to work quit well for US/EUR 2hrs, Other markets seems n...
JR1976 Simple and nice code , congrats !!! Seems work well with TIme frame 1 h
juanj The last fractal will be coordinate 1 and the high/low of the candle that generates an angle...
juanj And the point of violation is the close of the candle that violates the line by generating a...
juanj For the latest version of the strategy or to follow updates and developments see the thread ...
poonsl2828 Hi! Francesco I have test it on GBP/USD but it only have a trade on 9 Jun which i backtes...
ullle73 why not use 1h chart? has 95% hitrate
ullle73 i see most of positions are only 1 pip before exit?
imokdesign Hi Everybody, when I look at the strategy I felt the need to implement a Moneymanagement-Sy...
Inertia newlevel then multiplier=multiplier+1 oldlevel=newlevel newlevel=strategyprofit+startequi...
Inertia Hi Bjoern, I was playing around with your code this morning (EUR/USD 5'). Thank you to the...
victormork Hi, I would just like to share my own take on this strategy. I'm using 30 min on EURUSD but ...
mckubik Thanks. I will run a Test. 
poonsl2828 Hi! bjoern May i know what timing should i change for time zone (Singapore (GMT +8:00) ...
Samitha Prasanna Hi ALE, would you be able to provide the values for the below part of the code (time >=1...
Player Bonjour, J'ai testé cette stratégie sur EurUSD en 1 heures sur 10000 unités et le résultat ...
Player Vue du rapport du Backtest https://ibb.co/8BMrBz6
Dimi.A Awesome mate.
mora87 Hi David and Nicola, I'd like to share idea with you guys which is related to David's Idea. ...
Nicolas Please ask for custom coding in forums instead.
Naren Yanan what is    diplus  diminus  please
Barney Has anyone tested this algon now when PRT 10.3 was released?
Yngve does anyone know if the issue with the TP/SL is resolved ?
JakeDB Answered my own question....Sorry about this question. 5 positions, take profit at 15, loss ...
maxxb sto facendo girare in demo questa strategia modificata a 10 minuti con stop e profit ottimiz...
Manuel9z Hello, this strategy improves with the SL 30 and the TP 10. I have done backtesting and it w...
miguel33 Grazie filippo. sto facendo dei backtest per valutare meglio in diverse situazioni. se tro...
DerPat Hello, If you google, you will find a lot of articles and block posts that clearly show expe...
jens_kittner I would like to inform you that these strategies tested till today (03.05.2019) generates en...
GraHal I adjusted for GMT (minus 1 hour on all times) ... no trades. Might it be because the code ...
GraHal Ooops got that excited I sent that last one twice! ha (and can't delete it, sorry) I got it...
Eric n = 3  dont forget to allow 3 contract in proorder
hvluthy@sunrise.ch I'm very interested to try out your strategy, but as a bloody newbie I need some help regard...
Scalp Hola Adolfo, tengo una variante de tu estrategia, pero no se programar, me puedes ayudar al ...
ALZ Hi, I tested this strategy and that doesn't work.. strategy is losing.. Does anyone curr...
Doctrading Hello, Someone asked me something (his results seemed to be different) on my email, but it ...
Glen Marquis Not your best..So what is your best strategy? :)
Doctrading It works on ProRealTime CFD, but backtest begins since May 2014
alex224 Hola Andres, buen trabajo. Algun problema por usar la estrategia con acciones en time frame ...
Andres Hola Alex, no lo he probado en otros timeframes, pero con esta configuración específica no c...
verdi55 At least there should be some moving average that has also reverted into the opposite direct...
verdi55 In addition to the moving average, wait until at least one bar is completely back inside the...
rama This works excellent on range bound I tried , give 90% win rates on dax , 3 min chart. can s...

Top