Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

OrderState of a StopLimit order

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

    OrderState of a StopLimit order

    Hi all,

    I would like to know if, when the stop price specified in a StopLimit order has been reached, the orderState change.

    If not, is there a way to understand if the stop price has been reached and the order is waiting for the limit price achievement?

    Thanks.

    #2
    Hello mbk2787, and thank you for your question.

    I believe you may be interested in the OnOrderUpdate() method. This will get triggered every time one of your order states changes. I can include an excerpt from the Help Guide.

    http://ninjatrader.com/support/helpG...rderupdate.htm

    Code:
    private IOrder entryOrder = null;
      
     protected override void OnBarUpdate()
    {
         if (entryOrder == null && Close[0] > Open[0])
              entryOrder = EnterLong();
    }
      
     protected override void OnOrderUpdate(IOrder order)
    {
         if (entryOrder != null && entryOrder == order)
         {
              Print(order.ToString());
              if (order.OrderState == OrderState.Cancelled)
              {
                   // Do something here
                   entryOrder = null;
              }
         }
    }
    Please let us know if there is any other way we can help.
    Jessica P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by mattdowns1234, Today, 06:57 PM
    0 responses
    14 views
    0 likes
    Last Post mattdowns1234  
    Started by dgee949, Today, 06:26 PM
    0 responses
    24 views
    0 likes
    Last Post dgee949
    by dgee949
     
    Started by dgee949, Today, 05:58 PM
    0 responses
    30 views
    0 likes
    Last Post dgee949
    by dgee949
     
    Started by thepcmd, Today, 05:14 PM
    0 responses
    33 views
    0 likes
    Last Post thepcmd
    by thepcmd
     
    Started by xmess777, Today, 04:58 PM
    0 responses
    23 views
    0 likes
    Last Post xmess777  
    Working...
    X