Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

State of an IOrder Object when TP or SL

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

    State of an IOrder Object when TP or SL

    Hello,

    what happens with an IOrder Object, if this Order runs into SL oder TP?
    Get this dynamic variable automatically on null?

    The Backround is I want so realize 2 things:

    1. The Strategy should cancel a submitted Order after one more Bar

    2. The Strategy should realize, if an Open Order goes into TP or SL, and set the IOrder Object to null, because I want to Block the Order entering while an Open Order is in the Market

    I tried it with the OnOrderUpdate methode, but I can't finde an Order state that saing "Order runed into SL/TP"

    #2
    Hi Ludwig,
    Thanks for the post and welcome to the forums! For checking order properties on profit target / stop losses (submitted with Set), you have to look for the name of the order. A complete sample showing how to do this is here:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you,

      but does this run with multiple statagies? does Position.Quantity only use the specific postion from the strategy? What if there are positions in the market by other strategies?

      Is it right that in the sample code the OnOrderUpdate condition if (order.OrderState == OrderState.PendingSubmit) checks for all orders not only for orders by the strategie?

      Comment


        #4
        Yes, that's correct. Any position or order state information is only for the strategy instance from where you access it.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        61 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        148 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        98 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        286 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X