Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged Change Order Question

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

    Unmanaged Change Order Question

    When using unmanaged orders and an limit order is currently long.

    Can in the same code snippet i place a cancelorder() command and a submitoder command?

    such as if (entryOrder !=null && limitprice=true)
    {

    cancelorder(entryoder);
    Submitorder ()

    }

    Is this going to work in real time or will i need to delay a period of time between the cancel and submit orders?


    Thanks.

    #2
    Hello neb1998,

    Yes, this is definitely possible to do. There is possibility of overfill if both orders are filled. This would happen if the order pending cancel is filled before it can be cancelled.

    If you want to verify it's cancelled before submitting, best is to work off OrderState values rather than a delay.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ok thanks, i have too many orders being fired at a time now, still working through the unmanaged orders. They are working better in backtesting than i could get the managed to work but i have way to many orders firing.....more debugging.

      Thanks.

      Comment


        #4
        Another question.....

        When using changeorder() methods where is the best place in the code to place them? It would seem to me that onbarupdate would be the best but i am getting some strange results.

        Once a long order is issued within the onbarupdate method then the script moves to the onexecute() method correct?

        After the exits are submitted then the script returns to the first action of onbarupdate() or onexecute() if one of the exits is executed prior to the next tick being received or bar closing historically?

        Comment


          #5
          You would need to add prints to see the event call sequencing for your script and scenario, then you can deduct where to best place your change order call...the events come in a they 'fire' in realtime, so there's race conditions at play here.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          60 views
          0 likes
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          145 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          161 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 05-10-2026, 08:12 PM
          0 responses
          97 views
          0 likes
          Last Post CarlTrading  
          Started by Hwop38, 05-04-2026, 07:02 PM
          0 responses
          283 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Working...
          X