Open strategy dax

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #192648 quote
    ullle73ullle73
    Participant
    Senior

    I found this which is quite similar to what i use today. Roberto, could you help me code this? 😃

     

    • having x TP
    • y SL
    • z trailing sl
    2E1B47A0-0921-4935-B6EE-188B7B66D00A.jpeg 2E1B47A0-0921-4935-B6EE-188B7B66D00A.jpeg
    #192684 quote
    phoentzsphoentzs
    Participant
    Master

    Why do we think so complicated? Opening strategies

    I had tried something similar a long time ago… maybe this will help you?

    #192685 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Explain what the strategy has to do, when should it enter LONG or SHORT?

    #192702 quote
    ullle73ullle73
    Participant
    Senior

    yes ofc, sorry šŸ™‚

    • at dax open. wait for 5 min candle close, if it closes GREEN, go SHORT next candle open, TP open candles low + x points.
    • If open 5m candle is RED, go LONG at next candle open. TP open candles high + x points.
    • SL y points, BE stop z points, Trailing z points

    also put some code i found for not getting slippage if possible to use in code as well.

    šŸ˜€

     

    c100 = barindex = tradeindex
    spread = 1.2
    
    If longonmarket and c100 then
    priceinlong = open + spread / 2
    set stop ploss sl + (positionprice - priceinlong)
    set target pprofit tp - (positionprice - priceinlong)
    endif
    
    If shortonmarket and c100 then
    priceinshort = open – spread / 2
    set stop ploss sl + (priceinshort - positionprice)
    set target pprofit tp - (priceinshort - positionprice)
    endif
    Nicolas thanked this post
    #192752 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    This is the code:

    DEFPARAM CumulateOrders = False
    Timeframe(default)
    DAXopen = 080000
    //
    Timeframe(5 minute,UpdateOnClose)
    Green = close > open
    Red   = close < open
    IF OpenTime = DAXopen THEN
       IF Red THEN
          BUY 1 CONTRACT AT MARKET
          TP = (high - close) + 5*PipSize
          SL = 20
          SET TARGET PROFIT TP
          SET STOP   pLOSS  SL
       ELSIF Green THEN
          SELLSHORT 1 CONTRACT AT MARKET
          TP = (close - low) + 5*PipSize
          SL = 20
          SET TARGET PROFIT TP
          SET STOP   pLOSS  SL
       ENDIF
    ENDIF
    //
    //************************************************************************
    //trailing stop function
    trailingstart = 20 //trailing will start @trailinstart points profit
    trailingstep  = 5 //trailing step to move the "stoploss"
     
    //reset the stoploss value
    IF NOT ONMARKET THEN
     newSL=0
    ENDIF
     
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
     IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
      newSL = tradeprice(1)+trailingstep*pipsize
     ENDIF
    //next moves
     IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
      newSL = newSL+trailingstep*pipsize
     ENDIF
    ENDIF
     
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
     IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
      newSL = tradeprice(1)-trailingstep*pipsize
     ENDIF
    //next moves
     IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
      newSL = newSL-trailingstep*pipsize
     ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
     SELL AT newSL STOP
     EXITSHORT AT newSL STOP
    ENDIF
    //************************************************************************

    As to the code you posted, lines 5 and 11 which OPEN are referencing, the current one or the one when the trade was entered?

    #192792 quote
    ullle73ullle73
    Participant
    Senior

    THANKS AGAIN ROBERTO šŸ˜€

    #192793 quote
    SnorreDKSnorreDK
    Participant
    Junior

    Hi.
    Whats the the deafult Timeframe for the strategy?

    #192794 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    It must be no higher than 5 minutes.

    And 5 minutes must be a multiple of it, so 5 minutes or 1 minute are both fine.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTimeā„¢ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Open strategy dax


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
ullle73 @jonas_rydqvist Participant
Summary

This topic contains 7 replies,
has 4 voices, and was last updated by robertogozzirobertogozzi
4 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/04/2022
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...