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 cmoran13, 04-16-2026, 01:02 PM
        0 responses
        44 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        27 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        163 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        98 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        158 views
        2 likes
        Last Post CaptainJack  
        Working...
        X