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 Hwop38, 05-04-2026, 07:02 PM
            0 responses
            152 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            305 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            244 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            345 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            176 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X