Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry and exit orders to the same bar

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Entry and exit orders to the same bar

    Hi, I'm testing on NT a strategy I developed in tradestation; my question is about entry and exit orders sent at the same time to the same bar.

    Actually my strategy is something like that:

    if (EMA(Veloce)[0] < EMA(Lenta)[0])
    EnterShortLimit()
    ;


    ExitShortLimit()
    ;

    In this case strategy sends an entry order to the first bar and after this an exit order to the next bar.
    I need to send both the limit orders to the first bar; what is really important is to have both orders (the entry and the exit) sent to the same bar.

    How can I solve this problem?

    Thank you.

    #2
    Use SetProfiitTarget() this might help but please read and understand how this method works. Once it is called, it will always send profit target orders once a position is entered.

    RayNinjaTrader Customer Service

    Comment


      #3
      Thank You it works, but I cannot reverse any position once SetProfitTarget is called...can you suggest any way to do it? I mean exit from an entry order and reverse the position....thanx.

      Comment


        #4
        You would have to reverse with a market order such as EnterShort() which will exit a long and open a short.

        Check out the order handling rules for clarification what can/can't be done currently. At bottom of page of the following link.

        RayNinjaTrader Customer Service

        Comment


          #5
          I just do it but it doesn't work. SetProfitTarget cancels every other order sent like an EnterShortLimit to reverse the position.

          If condition
          EnterLongLimit ();
          SetProfitTarget () ;
          EnterShortLimit ();

          After the close position with the profit target there is a new buy order and not a sell short to reverse the position.

          I tried also moving the position of SetProfitTarget in the script but the result is the same.

          Comment


            #6
            It will not ignore Market orders, but will other orders.

            If condition
            EnterLongLimit ();
            SetProfitTarget () ;
            EnterShortLimit ();

            Clearly violate the order handling rules documented in the link I provided in my prior post.
            RayNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            152 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            87 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            131 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            127 views
            1 like
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            106 views
            0 likes
            Last Post CarlTrading  
            Working...
            X