To test, I have written a simple strategy that compares Time[0] and DateTime.Now, and outputs the difference in seconds. I also made sure to sync my system clock before each test, to minimize the impact of clock-skew. I then ran it in real time on 15s Last time series, choosing the 15 seconds only to generate a lot of data points quickly- I have also run this on minute charts with similar results, and can provide documentation of that if needed.
Here are some sample outputs:
1/31/2013 1:11:00 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:11:00 PM Bar Time: 1/31/2013 1:11:00 PM Bar is 0.9987365 stale.
1/31/2013 1:11:15 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:11:20 PM Bar Time: 1/31/2013 1:11:15 PM Bar is 5.5912325 stale.
1/31/2013 1:11:30 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:11:30 PM Bar Time: 1/31/2013 1:11:30 PM Bar is 0.7175375 stale.
1/31/2013 1:11:45 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:11:45 PM Bar Time: 1/31/2013 1:11:45 PM Bar is 0.5603375 stale.
1/31/2013 1:12:00 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:12:04 PM Bar Time: 1/31/2013 1:12:00 PM Bar is 4.2778895 stale.
1/31/2013 1:12:15 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:12:15 PM Bar Time: 1/31/2013 1:12:15 PM Bar is 0.9021455 stale.
1/31/2013 1:12:30 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:12:30 PM Bar Time: 1/31/2013 1:12:30 PM Bar is 0.558434 stale.
1/31/2013 1:12:45 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:12:45 PM Bar Time: 1/31/2013 1:12:45 PM Bar is 0.7713275 stale.
1/31/2013 1:13:00 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:13:00 PM Bar Time: 1/31/2013 1:13:00 PM Bar is 0.710801 stale.
1/31/2013 1:13:15 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:13:19 PM Bar Time: 1/31/2013 1:13:15 PM Bar is 4.8003995 stale.
1/31/2013 1:13:30 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:13:32 PM Bar Time: 1/31/2013 1:13:30 PM Bar is 2.0535215 stale.
1/31/2013 1:13:45 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:13:45 PM Bar Time: 1/31/2013 1:13:45 PM Bar is 0.0155825 stale.
1/31/2013 1:14:00 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:14:03 PM Bar Time: 1/31/2013 1:14:00 PM Bar is 3.4265135 stale.
1/31/2013 1:14:15 PM Instrument SPYBar Series: 0 Current System Time: 1/31/2013 1:14:25 PM Bar Time: 1/31/2013 1:14:15 PM Bar is 10.30109 stale.
So, we see delays ebbing and flowing between 0.01s and 10.3s. Anyway, I started to develop a theory, so I switched to something more thinly traded. Here is what I saw for the same strategy, applied to a 15s bar last of ERX- its completely and unbelievably off.
1/31/2013 1:17:45 PM Instrument ERXBar Series: 0 Current System Time: 1/31/2013 1:18:11 PM Bar Time: 1/31/2013 1:17:45 PM Bar is 26.1294095 stale.
1/31/2013 1:18:15 PM Instrument ERXBar Series: 0 Current System Time: 1/31/2013 1:26:47 PM Bar Time: 1/31/2013 1:18:15 PM Bar is 512.8131365 stale.
1/31/2013 1:27:00 PM Instrument ERXBar Series: 0 Current System Time: 1/31/2013 1:29:46 PM Bar Time: 1/31/2013 1:27:00 PM Bar is 166.736255 stale.
To make matters worse, I had a 15s last chart of ERX up at the same time- OnBarUpdate appears to have never fired for a bar at 13:18:00 that is displayed on the chart. I also witnessed the bar at 13:27:00 remain on the chart for several minutes- as a solid green bar- suddenly update after several minutes, to solidly red.
I then took a close look at my 15s chart for ERX- each bar does not represent 15 seconds, or rather, there can be huge, undrawn gaps between bars. On the chart I mentioned, I see 15 second bars at
13:17:00
13:17:45
13:18:00
13:18:15
13:27:00
13:30:00
This poses some questions for me:
(1) Does Ninja track time, or does it realize that the 15s bar its currently working on is only closed when the next tick comes in (even if its several minutes later)? This implies that for any strategy driving off time charts using OnBarClose=true, you could incurr MASSIVE slippage because you will only realize the bar is closed (and generate an order) several minutes after the fact, when a fill at a different price level completes. Is there any way to force time based events into the model?
(2) Can the data provider (Kinetick in this case) be sending corrections? This is the only thing that can explain a 15 second bar being changed several minutes after the fact.
(3) Why would OnBarUpdate miss an entire bar?

Comment