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.



    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 DanielSanMartin, Yesterday, 02:37 PM
    2 responses
    13 views
    0 likes
    Last Post DanielSanMartin  
    Started by DJ888, 04-16-2024, 06:09 PM
    4 responses
    12 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by terofs, Today, 04:18 PM
    0 responses
    11 views
    0 likes
    Last Post terofs
    by terofs
     
    Started by nandhumca, Today, 03:41 PM
    0 responses
    8 views
    0 likes
    Last Post nandhumca  
    Started by The_Sec, Today, 03:37 PM
    0 responses
    7 views
    0 likes
    Last Post The_Sec
    by The_Sec
     
    Working...
    X