Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarUpdate() not updating at specified intervals

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

    OnBarUpdate() not updating at specified intervals

    I`m trying to track down a large discrepancy between my live performance today vs performance estimated when back testing the same day. My strategy is printing a debug statement every OnBarUpdate(). QLD is set to run every second, GLD every 2 seconds. Note the gaps, looking at the whole trace OnBarUpdate() is being called every 1-4 seconds rather than every second.

    QLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:47 AM 37.11
    QLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:49 AM 37.1
    QLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:50 AM 37.09
    QLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:51 AM 37.09
    GLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:49 AM 87.61
    GLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:52 AM 87.6
    QLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:52 AM 37.12
    QLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:55 AM 37.13
    QLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:56 AM 37.13
    QLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:57 AM 37.13
    QLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:58 AM 37.14
    GLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:54 AM 87.6
    QLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:59 AM 37.16
    GLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:05:59 AM 87.62
    QLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:06:00 AM 37.14
    QLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:06:04 AM 37.14
    GLD Default OnBarUpdate, CurrentBar: 10/9/2008 9:06:02 AM 87.63

    Does this mean I`m not receiving market data every second?
    If the strategy calculates a 20 period moving average, is the data used by the moving average going to be that of the previous 20 seconds, or of the previous 20 data samples received, which will be more than 20 seconds if the data samples aren't arriving every second?

    I`m connected via IB (live, not paper trade account), with Barchart for historical data. I`m open to recomendations on other connections.

    #2
    OnBarUpdate() triggers every single time there is a new market data event. It is not based on time. When a tick comes in it will trigger. If there are no ticks for 15 seconds there will be no event for 15 seconds.

    All indicators are calculated based on bars. A 20 period means 20 bars. There is no direct correlation between period and time.

    A list of our supported data providers can be found here: http://www.ninjatrader-support.com/H...HistoricalData
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thank you for clarifying that. I bought up a tick chart on the machine that was collecting ticks from IB, and on a machine connected to Barchart, and there were indeed no ticks for 4 seconds at 09:06. I did however notice big differences between the data, especially the last few minutes near the close.

      Is there a way to use the Barchart feed for real time quotes rather than IB?

      Comment


        #4
        Hi Idruna,

        Connect to BarChart first then connect to IB.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Cool, thanks. I`ll also play with NT's tick filter.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          80 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          46 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          29 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          32 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          66 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X