EN / Hello everyone,
Here is an automatic trading strategy based on the Mobile Averages.
This code is very simple because I started in this discipline! 🙂
I need your help to optimize the code. I would like to filter out false signals in order to have more winning positions and reduce drawdown.
Thank you in advance for your help.
Best regards,
DJ
FR / Bonjour à tous,
Voici une stratégie de trading automatique basée sur les Moyennes Mobiles.
Ce code est très simple car je débute dans cette discipline ! 🙂
Je sollicite votre aide afin d’optimiser ce code. J’aimerais filtrer les faux signaux afin d’avoir davantage de positions gagnantes et réduire le drawdown.
Merci d’avance pour votre aide.
Bien cordialement,
DJ
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 |
// Définition des paramètres du code DEFPARAM CumulateOrders = True // Cumul des positions activé // Conditions pour ouvrir une position acheteuse indicator1 = close indicator2 = Average[100](close)*1.002 c1 = (indicator1 CROSSES OVER indicator2) indicator3 = close indicator4 = Average[1000](close) c2 = (indicator3 > indicator4) IF c1 AND c2 THEN BUY 1 CONTRACT AT MARKET ENDIF // Conditions pour fermer une position acheteuse indicator5 = close indicator6 = Average[100](close)*0.998 c3 = (indicator5 CROSSES UNDER indicator6) IF c3 THEN SELL AT MARKET ENDIF // Conditions pour ouvrir une position en vente à découvert indicator7 = close indicator8 = Average[100](close)*0.998 c4 = (indicator7 CROSSES UNDER indicator8) indicator9 = close indicator10 = Average[1000](close) c5 = (indicator9 < indicator10) IF c4 AND c5 THEN SELLSHORT 1 CONTRACT AT MARKET ENDIF // Conditions pour fermer une position en vente à découvert indicator11 = close indicator12 = Average[100](close)*1.002 c6 = (indicator11 CROSSES OVER indicator12) IF c6 THEN EXITSHORT 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
Hi Matriciel,
on which timeframe and Indices does your code run?
ciao Klaus
Hi Klaus,I’m about 15 minutes time frame and I trade on the DAX30.
Hi Klaus,I’m about 15 minutes time frame I trade on the DAX30.
what do 0.998 and 1.002 factors represents?
These are the moving averages offset on the vertical axis.
It’s incredible, this little offset make big difference! dunno why..
Amusante cette petite strat : elle est positive sur 200000 ut mais tu obtiens un DD de 78% du benefice et un profit factor de 1,10.
cordialement.
Hi Matriciel,
How do you change the limit to take profit ? kindly advice
Hi Chaostrader82,
You can play with the value of the trailing stop.This one works well : SET TARGET pPROFIT 300
Je voulais dire : “take profit” et non “trailing stop”… 🙂
I wanted to say “take profit” and not “trailing stop” … 🙂
hi marticiel , can you email me at xxxx ? i want to work with you on the development of the codes
Please dont put your email address publicly on the website. If you want to make a dev team for improvements of this strategy, I suggest you to make a new thread on the forums where everyone in interest should help. It makes senses since everything here is completely free and share the same sharing spirit. Thanks.
Dear Matriciel , you should try removing these 1.0998 , 0.0998 , these functions actually draws down your profits .I made it more cleaner but it is for scalping only. i only tested on some of the pairs so far. maybe you want to have a further look at it. This is only for a trending market that has a definate trend, if its a sideway market dont use this because the MAs will trigger and you will get whipped sawed.
// Conditions pour ouvrir une position acheteuse setting (1000units 15mins chart )indicator1 = closeindicator2 = Average[5](close)c1 = (indicator1 CROSSES OVER indicator2)
IF c1 THENBUY 3 CONTRACT AT MARKETENDIF
// Conditions pour fermer une position acheteuseindicator3 = closeindicator4 = Average[7](close)c2 = (indicator3 CROSSES OVER indicator4)
IF c2 THENBUY 3 CONTRACT AT MARKETENDIF
// Conditions pour ouvrir une position acheteuseindicator5 = closeindicator6 = Average[60](close)c3 = (indicator5 CROSSES OVER indicator6)
IF c3 THENSELL AT MARKETENDIF
Dear Matriciel , can you add in the following ? stoploss=30pips , take profit= 4pips <=== after you are done pls paste it back here. Thanks
Theres some bugs still with this program , can somebody help to improve on the following?
Improvements needed
BUY if current close is higher than previous close
No stoploss or take profit settings
Notes : Strategy only works in a upward trending market, heavy losses in a downward or whipped saw trend
Hi Chaostrader82,You know, I’m starting in automatic strategy coding so I’m not going to be able to help you a lot.