Scalping DAX UT 50s

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #222574 quote
    teshmi9z
    Participant
    New

    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.

    mm7=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 MM7
    if mm7 CROSSES OVER mm20 and close > mm50 then
     buy 1 contract at market
    set target profit 30 
    set stop loss  20
    if LONGONMARKET  and TRADEPRICE   + 10 then
    set  stop loss TRADEPRICE 
    endif
    endif
    
    if mm7 CROSSES UNDER mm20 and close<mm50 then
    sellshort 1 contract at market
    set target profit 30
    set stop loss 20
    if SHORTONMARKET and tradeprice + 10 then
    set  stop loss TRADEPRICE 
    endif
    endif
    #222582 quote
    robertogozzi
    Moderator
    Master

    Post your topic in the correct forum:  ProOrder: only strategy topics.

    I moved it from ProBuilder support.

    Thank you 🙂

    #222588 quote
    GraHal
    Participant
    Master

    Strategies 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?

    #222641 quote
    Wim
    Participant
    Junior

    Hello. 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.

    GraHal thanked this post
    Scalping-DAX-50Sec.png Scalping-DAX-50Sec.png
    #222675 quote
    teshmi9z
    Participant
    New

    Hello, 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?

     

    defparam CUMULATEORDERS = true
    
    mm7=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 mm20
    signalDown= mm7 CROSSES UNDER  mm20
    signalUp1 =mm20 CROSSES OVER mm50
    signalDown1= mm20 CROSSES UNDER  mm50
    once sens=0
    
    trailingstart = 20
    
    //reglage BE achat Long
    startBreakeven = 50
    PointsToKeep = 30
    
    if not longonmarket and mm50 CROSSES OVER mm600 and close > mm600 then
    buy 1 contract at market
    SET TARGET pPROFIT 100
    set stop loss  35
    endif
    
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ELsIF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN
    breakevenLevel = tradeprice(1)+PointsToKeep*pipsize
    ENDIF
    IF breakevenLevel>0 THEN
    SELL AT breakevenLevel STOP
    ENDIF
    if   shortonmarket and ( tradeprice-close)>=(startBreakeven1 *pointsize) then
    breakevenLevel  = tradeprice(1)-Pointstokeep1*pipsize
    endif
    if breakevenLevel then
    EXITSHORT  aT breakevenLevel   stop
    endif
    
    ////
    startBreakeven1 = 50
    PointsToKeep1 = 10
    
    if not shortonmarket and signalDown  and close <mm200 then
    sellshort 1 contract at market
    set target profit 70
    set stop loss 30
    endif
    
    
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Scalping DAX UT 50s


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
teshmi9z @teshmi9z Participant
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by teshmi9z
2 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/17/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...