I had the idea of this little code, wishing to implement a strategy deviated from the famous “Turtle” strategy : a breakout above a last high on a certain period.
The code is very simple : we trade with the breakout of the 100 last days ; and so for the exit. Of course you can test with other parameters the value “100” days , but it seems to me profitable on most indices.
Indeed , this code is performing very well on the CAC40 (83.3 % success , profit factor of 9.7 !), The DAX30, the S&P500, even the NIKKEI, etc.
After weeks of very hard work, and with some other parameters, I did finally succeed to develop a very high-performance code on the Dax (5 times more profit than this code, with 2x less drawdown), which I use each day.
For now, I suggest you try this mini-code, which proves to be effective for long-term investment.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Defparam cumulateorders = false n = 2 REM ACHAT // Le + haut du jour dépasse le +haut des 100 jours précédents ca1 = high > highest[100](high[1]) IF ca1 THEN BUY n shares AT MARKET ENDIF REM SORTIE ACHAT // Le + bas du jour dépasse le +bas des 100 jours précédents ca2 = low < lowest[100](low[1]) IF ca2 THEN SELL AT MARKET ENDIF |
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
Thank you for the contribution Doc. Even if a “buy and hold” strategy is more effective in profit, this one can reduce %drawdown.
Buy and Hold curve is in pink color.
Hi @Nicolas. How did you add the buy and hold to the chart?
You can try this code for buy and hold curve line:
capital = 10000
mylot = 2
i1 = capital+((pipvalue*Close)*mylot)
RETURN i1
Yes, Buy & Hold is effective if the index is keeping growing… this is the case for the DAX, maybe not others…
Thanks for your reply.
thank you so much for your great job, im very impatient to test your another strategy ” the turtle soup +1 “Jo
Thanks Doc,
But it will be more interesting to test on small unit of time (1 or 5 mn), for intraday trading, or daily for swinger, because I don’t know anyone who invest on very very long term?
Have a nice day
Zilliq
Bonjour Nicolas,
Je ne comprends pas où ajouter le code que tu as a donné dans le code initial. Pouvez m’aider svp ?
Merci 🙂
S
Tu veux parler du code pour comparer avec le “buy and hold” ? Si oui, tu as tout ce qu’il faut ici: https://www.prorealcode.com/blog/learning/buy-hold-comparison-automated-trading-strategies/