Scalping DAX UT 50s
Forums › ProRealTime English forum › ProOrder support › Scalping DAX UT 50s
- This topic has 4 replies, 4 voices, and was last updated 1 year ago by teshmi9z.
-
-
10/17/2023 at 6:53 PM #222574
Hello, I’ve created a code for scalping the DAX based on the 50-period Simple Moving Average (SMA) on the 50-second timeframe. The signal triggers when the 7-period SMA crosses above the 20-period SMA, but we’re above the 50-period SMA, and vice versa.
Here’s the code. Do you have any ideas for improving it? I’ve experienced significant losses at times.
123456789101112131415161718192021222324252627282930mm7=average[7]mm20=average[20]mm50=average[50]mm80=average[80]mm200=average[200]mm7up= mm7>mm7[1]mm7Down=mm7<mm7[1]once sens=0//flèche pour debut tendance MM7if mm7 CROSSES OVER mm20 and close > mm50 thenbuy 1 contract at marketset target profit 30set stop loss 20if LONGONMARKET and TRADEPRICE + 10 thenset stop loss TRADEPRICEendifendifif mm7 CROSSES UNDER mm20 and close<mm50 thensellshort 1 contract at marketset target profit 30set stop loss 20if SHORTONMARKET and tradeprice + 10 thenset stop loss TRADEPRICEendifendif10/17/2023 at 11:50 PM #222582Post your topic in the correct forum: ProOrder: only strategy topics.
I moved it from ProBuilder support.
Thank you 🙂
10/18/2023 at 9:11 AM #222588Strategies based on moving averages are known to look great on backtest, but the real live performance then turns out to be very different.
It is so easy to get the optimiser to find MA crosses etc over a long backtest period, but these same MA crosses etc do not appear again in quite the same combination during Live running.
I suggest you re-optimise over 10K bars only and also re-optimise every day!
Let us know if losses reduce?
10/19/2023 at 9:42 AM #222641Hello. I think your code needs a little revision. On the screen capture I indicated 2 IF-THEN-ENDIF blocks that need to be extracted from the IF where you test for the presence of a signal. I guess you expect from these 2 indicated IF-THEN-ENDIF blocks that they put your position to BreakEven. But currently these blocks will only be executed when a valid entry signal is present, and not during the position itself.
Next, the condition for BE needs a correction too. Currently you state “longonmarket and tradeprice + 10”. I think I understand what you mean, but PRT will not. Try this: “longonmarket and close > tradeprice+10”. You could also use high instead of close, whatever you prefer. The other one will be “shortonmarket and close < tradeprice -10”. Good luck. And if 50S doesn’t work, try M5, you could be surprised.1 user thanked author for this post.
10/19/2023 at 9:36 PM #222675Hello, I’ve made some modifications to my code, and now we need to use it on the DAX with a 5-minute timeframe. Could you try it in simulation from September 30th to October 19th and let me know if you have any ideas for improvement? I’ve resolved my break-even issue.
I would like to add conditions for a second buying condition for a shorter take profit, especially at the end of bullish movements with a MACD reversal or by taking advantage of price elasticity relative to its moving average (close > 100 pips).
The problem is that I don’t know how to manage differentiating positions. How can I limit the first buying condition to 1 lot and the second buying condition to 2 lots, for example?
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455defparam CUMULATEORDERS = truemm7=average[7]mm20=average[20]mm50=average[50]mm80=average[80]mm200=average[200]MM600=average[600]mm7up= mm7>mm7[1]mm7Down=mm7<mm7[1]signalUp =mm7 CROSSES OVER mm20signalDown= mm7 CROSSES UNDER mm20signalUp1 =mm20 CROSSES OVER mm50signalDown1= mm20 CROSSES UNDER mm50once sens=0trailingstart = 20//reglage BE achat LongstartBreakeven = 50PointsToKeep = 30if not longonmarket and mm50 CROSSES OVER mm600 and close > mm600 thenbuy 1 contract at marketSET TARGET pPROFIT 100set stop loss 35endifIF NOT ONMARKET THENbreakevenLevel=0ELsIF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THENbreakevenLevel = tradeprice(1)+PointsToKeep*pipsizeENDIFIF breakevenLevel>0 THENSELL AT breakevenLevel STOPENDIFif shortonmarket and ( tradeprice-close)>=(startBreakeven1 *pointsize) thenbreakevenLevel = tradeprice(1)-Pointstokeep1*pipsizeendifif breakevenLevel thenEXITSHORT aT breakevenLevel stopendif////startBreakeven1 = 50PointsToKeep1 = 10if not shortonmarket and signalDown and close <mm200 thensellshort 1 contract at marketset target profit 70set stop loss 30endif -
AuthorPosts
Find exclusive trading pro-tools on