• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

something is wrong with this onorderupdate documentation

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

    something is wrong with this onorderupdate documentation

    I copied the onorderupdate line and pasted into my strategy code, it complained that there is no method to override. I just got one from my old strategy and it worked,

    Code:
    syntax
    RealtimeErrorHandling
     
     
     
    
    private Order stopLossOrder = null;
     
    protected override void OnStateChange()
    {
        if (State == State.Configure)
        {
            RealtimeErrorHandling = RealtimeErrorHandling.IgnoreAllErrors;
        }
    }
     
    protected override void OnBarUpdate() 
    { 
        if (entryOrder == null && Close[0] > Open[0]) 
            EnterLong("myEntryOrder"); 
     
        if (stopLossOrder == null) 
            stopLossOrder = ExitLongStopMarket(Position.AvgPrice - 10 * TickSize, "myStopLoss", "myEntryOrder"); 
    }
     
    protected override void OnOrderUpdate(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, OrderState orderState, DateTime time) 
    { 
      // Assign stopLossOrder in OnOrderUpdate() to ensure the assignment occurs when expected.
      // This is more reliable than assigning Order objects in OnBarUpdate, as the assignment is not gauranteed to be complete if it is referenced immediately after submitting
      if (order.Name == "myStopLoss" && orderState == OrderState.Filled)
          stopLossOrder = order;
     
        if (stopLossOrder != null && stopLossOrder == order) 
        {
            // Rejection handling 
            if (order.OrderState == OrderState.Rejected) 
            {
                  // Stop loss order was rejected !!!! 
                  // Do something about it here 
            } 
        }
    }

    #2
    Hello junkone,

    Thank you for your report.

    The Help Guide documentation for the RealtimeErrorHandling has been updated: http://ninjatrader.com/support/helpG...orhandling.htm
    Patrick H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by GussJ, Today, 01:30 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by GARZONJ, Today, 12:25 PM
    3 responses
    13 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by RandanAL, Today, 11:53 AM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by yeshujbp, 07-21-2019, 02:40 PM
    2 responses
    35 views
    0 likes
    Last Post omololu
    by omololu
     
    Started by seagraph, Yesterday, 03:27 PM
    1 response
    29 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X