Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnOrderUpdate not firing

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

    #16
    Originally posted by andrewbee View Post
    Just wanted to say I am experiencing this issue as well. NT7 latest beta (today), Zen-Fire, Win Vista 23-bit. OnBarUpdate is not firing for non-historical data for any instrument.
    Andrew, could you please share a simple test snippet for us to be able to check into?

    If you really mean OnBarUpdate() this is different from Dave's initially reported issue where we're still looking for any additional clues to be able to reproduce and investigate, so far it's not happening on the machines and install we tried this on.

    Comment


      #17
      OnBarUpdate(). This was tried with 6E on 1 tick, updateonbarclose = false. The ticks were coming in, but the method was not being called.

      The historical ticks would come in and be printed, but then no new ones.

      #region Using declarations
      using System;
      using System.ComponentModel;
      using System.Diagnostics;
      using System.Drawing;
      using System.Drawing.Drawing2D;
      using System.Xml.Serialization;
      using NinjaTrader.Cbi;
      using NinjaTrader.Data;
      using NinjaTrader.Indicator;
      using NinjaTrader.Gui.Chart;
      using NinjaTrader.Strategy;
      #endregion

      // This namespace holds all strategies and is required. Do not change it.
      namespace NinjaTrader.Strategy
      {
      /// <summary>
      /// Enter the description of your strategy here
      /// </summary>
      [Description("Enter the description of your strategy here")]
      public class WritePrice : Strategy
      {
      #region Variables
      // Wizard generated variables
      private int myInput0 = 1; // Default setting for MyInput0
      // User defined variables (add any user defined variables below)
      #endregion

      private String symbol;
      /// <summary>
      /// This method is used to configure the strategy and is called once before any strategy method is called.
      /// </summary>
      protected override void Initialize()
      {
      CalculateOnBarClose = false;
      symbol = null;
      Print("starting");
      }

      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      protected override void OnBarUpdate()
      {

      Print("" + Close[0]);

      if (symbol == null)
      {
      symbol = base.Bars.Instrument.FullName.Substring(0, 2).ToLower();
      Print(symbol);
      }


      }

      #region Properties
      [Description("")]
      [GridCategory("Parameters")]
      public int MyInput0
      {
      get { return myInput0; }
      set { myInput0 = Math.Max(1, value); }
      }
      #endregion
      }
      }
      Last edited by andrewbee; 06-09-2010, 04:44 AM.

      Comment


        #18
        Could not reproduce here on my end, your sample works here fine on 6E 1 Tick chart with ZenFire - which broker / provider where you using? Did you notice any log errors as this occurred?

        Please also try just running on the Default 24 / 7 session templates to ensure you get all available historical and live data included.

        Comment


          #19
          Hello,

          This is still a problem in Beta 17. Perhaps it is specifically on order update not being called for a call to CancelOrder ?? Could you maybe ask the developers? Is anyone else prepared to give this a run? It's so easy to try. It's unfortunate that NT can't reproduce.

          I really wish we could get some more insight on this. I guarantee it happens. It makes it impossible for me to use Ninja with limit orders, since I can't reliably cancel the order and know what's going on. That's pretty serious. Is there no one else here that uses limits/cancels and has seen this problem?

          I notice that something possibly related was fixed in Beta 17 (
          Fixed
          3794
          NinjaScript strategies
          IExecution.Order could have been null.
          )
          If I turn on trace orders, you can see quite clearly on order update not called:


          22/06/2010 11:35:30 Set pending true for entry = Order='NT-04020/Sim101' Name='Buy' State=Accepted Instrument='6B 09-10' Action=Buy Limit price=1.4624 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='91ba198d6caa485e8d9abc903586eb51' Gtd='01/12/2099 00:00:00'

          22/06/2010 11:35:30 Order update = Order='NT-04020/Sim101' Name='Buy' State=Working Instrument='6B 09-10' Action=Buy Limit price=1.4624 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='91ba198d6caa485e8d9abc903586eb51' Gtd='01/12/2099 00:00:00'

          22/06/2010 11:35:30 Set pending true for entry = Order='NT-04020/Sim101' Name='Buy' State=Working Instrument='6B 09-10' Action=Buy Limit price=1.4624 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='91ba198d6caa485e8d9abc903586eb51' Gtd='01/12/2099 00:00:00'


          22/06/2010 11:35:54 Cancel :Order='NT-04020/Sim101' Name='Buy' State=Working Instrument='6B 09-10' Action=Buy Limit price=1.4624 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='91ba198d6caa485e8d9abc903586eb51' Gtd='01/12/2099 00:00:00'


          Cancelled custom managed order at 22/06/2010 11:35:54: Order='NT-04020/Sim101' Name='Buy' State=Working Instrument='6B 09-10' Action=Buy Limit price=1.4624 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='91ba198d6caa485e8d9abc903586eb51' Gtd='01/12/2099 00:00:00'

          [no call to OnOrderUpdate() here]

          22/06/2010 11:35:54 Cancel :Order='NT-04020/Sim101' Name='Buy' State=Cancelled Instrument='6B 09-10' Action=Buy Limit price=1.4624 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='91ba198d6caa485e8d9abc903586eb51' Gtd='01/12/2099 00:00:00'

          22/06/2010 11:36:05 Cancel :Order='NT-04020/Sim101' Name='Buy' State=Cancelled Instrument='6B 09-10' Action=Buy Limit price=1.4624 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='91ba198d6caa485e8d9abc903586eb51' Gtd='01/12/2099 00:00:00'

          Comment


            #20
            Furthermore, when starting up this test strategy, the first few trades (presumably before the data becomes real time) ALWAYS work. This must be a big clue. In fact, there are two order updates after calling cancel order, one for pending cancel, and one for cancelled. This below is what should happen.

            22/06/2010 11:35:05 Set pending true for entry = Order='NT-04019/Sim101' Name='Buy' State=Working Instrument='6B 09-10' Action=Buy Limit price=1.4625 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='99b4e3f64dfc410d81280c887c99e04b' Gtd='01/12/2099 00:00:00'

            22/06/2010 11:35:30 Cancel :Order='NT-04019/Sim101' Name='Buy' State=Working Instrument='6B 09-10' Action=Buy Limit price=1.4625 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='99b4e3f64dfc410d81280c887c99e04b' Gtd='01/12/2099 00:00:00'

            Cancelled custom managed order at 22/06/2010 11:35:30: Order='NT-04019/Sim101' Name='Buy' State=Working Instrument='6B 09-10' Action=Buy Limit price=1.4625 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='99b4e3f64dfc410d81280c887c99e04b' Gtd='01/12/2099 00:00:00'

            22/06/2010 11:35:30 Order update = Order='NT-04019/Sim101' Name='Buy' State=PendingCancel Instrument='6B 09-10' Action=Buy Limit price=1.4625 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='99b4e3f64dfc410d81280c887c99e04b' Gtd='01/12/2099 00:00:00'

            22/06/2010 11:35:30 Set pending true for entry = Order='NT-04019/Sim101' Name='Buy' State=PendingCancel Instrument='6B 09-10' Action=Buy Limit price=1.4625 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='99b4e3f64dfc410d81280c887c99e04b' Gtd='01/12/2099 00:00:00'

            22/06/2010 11:35:30 Order update = Order='NT-04019/Sim101' Name='Buy' State=Cancelled Instrument='6B 09-10' Action=Buy Limit price=1.4625 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='99b4e3f64dfc410d81280c887c99e04b' Gtd='01/12/2099 00:00:00'

            22/06/2010 11:35:30 Set pending false for entry = Order='NT-04019/Sim101' Name='Buy' State=Cancelled Instrument='6B 09-10' Action=Buy Limit price=1.4625 Stop price=0 Quantity=1 Strategy='test1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='99b4e3f64dfc410d81280c887c99e04b' Gtd='01/12/2099 00:00:00'

            Comment


              #21
              OK, don't worry about this. Having investigated further, it seems that OnOrderUpdate does not get fired before a queued list of OnBarUpdate events. For example, put in a limit order, and you don't necessarily get OOU called before the next few bar updates. That would explain why it happens in real time. It's quite possible that the order update that I'm missing happens much later and I haven't spotted it. In the meantime, my strategy is happily processing ticks.

              I can see why OOU can be useful for longer term housekeeping, but it's useless for high performance tracking of order status. If I ignore it and just use entry.orderstatus all the time, then it will probably resolve my problem.

              To be fair, the documentation does talk of relying on it for the order of status changes, rather than the current status - I just didn't expect that the event wouldn't be the next to fire after on bar update - not knowing the internal of how the event queues work. It may be worth making this clearer in the documentation.

              thanks for your help
              Dave

              Comment


                #22
                Thanks for the indepth look into and your feedback Dave - you're correct OnOrderUpdate() would be called on each order state change.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                595 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                343 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                103 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                556 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                554 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X