A very simple and nice code , I got the idea spontaneously.
This is a long-term strategy, where we take positon with the momentum.
This momentum is defined here by the 100 moving average. If it goes above the moving average 20 days (1 month) before, we go to buy.
We also take short positions with opposite condition.
Therefore, we are constantly in position, buy or sell.
The backtest is very profitable on some indices, with a profit factor greater than 2 : including the DAX, CAC40. It also works on forex on many pairs. But the results are mixed for others.
Test and improve it !
1 2 3 4 5 6 7 8 9 10 11 12 |
DEFPARAM cumulateorders = false MM100 = Average[100](close) IF MM100 > MM100[20] THEN BUY 1 SHARES AT MARKET ENDIF IF MM100 < MM100[20] THEN SELLSHORT 1 SHARES 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
Hello Doc, you should combine 2 momentum for better entries and exit. Look for “dual momentum” strategies on internet. Cheers.
Ok, I will try it.
I have some nice daily strategies, I’m looking to create a code for intraday trading… such as the “Breakout ProOrder” for the CAC40.
But later I will backtest some of those “Dual momentum” strategies, which I did use myself manually.
Ok Doc, beware of intraday, it’s a battlefield full of random noises 🙂 Maybe we can work together on something, let’s open a new thread on forum for intraday trading research!
we should definitely open a new thread for intraday trading – can we post the link once it’s done? Thanks
Bonjour
Si la moyenne 100 est au dessus de la moyenne 20 le trend est baissier zlors pourquoi on achete?
Je nai pas compris ?
Bravo pour ce site
Philippe
La comparaison se fait entre la valeur de la moyenne actuelle et telle qu’elle était il y a 20 périodes de cela. Il n’y a pas de moyenne mobile 20 périodes dans la stratégie.