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 Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            576 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            334 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            553 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            551 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X