PDA

View Full Version : Getting tick timestamp in market replay


dave1992
08-06-2009, 01:05 AM
Hi,

To get a tick timestamp in market replay, when using 10 min bars, do I have to define an OnMarketUpdate and just save it for every tick, or is there a way to get it only when I want it. This would be quite a useful feature from a performance perspective.

thanks
Dave

dave1992
08-06-2009, 04:13 AM
Furthermore, and even worse, it appears that OnMarketData is called after OnBarUpdate? This means that any tick timestamp I set in OnMarketData will be the previous tick time when OnBarUpdate gets called.

Any ideas what the solution to all this is?

thanks
Dave

NinjaTrader_Bertrand
08-06-2009, 04:16 AM
Dave, which CalculateOnBarClose setting do you use? Perhaps it would easiest for you to add a 1 tick chart to the strategy to get the more granular timestamps - http://www.ninjatrader-support.com/HelpGuideV6/MultiTimeFrameInstruments.html

dave1992
08-06-2009, 04:34 AM
Calculate on bar close = false, which is how I'm getting all the intra-bar ticks.

Is that the only way to do it? Add a 1 tick series?

How about my question about event order? It's a shame if you can't use all your market data info before the bar update call?

NinjaTrader_Josh
08-06-2009, 07:18 AM
There is no guarantee that OnMarketData() will be called before OnBarUpdate(). What guarantee there is is that for every OnMarketData() there will be an OnBarUpdate() when using CalculateOnBarClose.

If you want the current time as a tick comes in during realtime you could try using DateTime.Now.

dave1992
08-06-2009, 07:40 AM
There is no guarantee that OnMarketData() will be called before OnBarUpdate(). What guarantee there is is that for every OnMarketData() there will be an OnBarUpdate() when using CalculateOnBarClose.

If you want the current time as a tick comes in during realtime you could try using DateTime.Now.

That's a shame. Why is there a bar update for every market data? Isn't a bid update a market data event that would have no bar update?

I specifically said 'during market replay'. Are you saying there's no way to get the time of a tick during market replay? The T&S window has it? Why is it so hard for Ninja Script to have it?

NinjaTrader_Josh
08-06-2009, 07:44 AM
Sorry for the confusion. For ever Last event in OnMarketData() you will get one in OnBarUpdate().

It is not hard to get it in NinjaScript. Its in e.Time for OnMarketData and Depth.

dave1992
08-06-2009, 07:48 AM
Sorry for the confusion. For ever Last event in OnMarketData() you will get one in OnBarUpdate().

It is not hard to get it in NinjaScript. Its in e.Time for OnMarketData and Depth.

It is hard to get if you want to use it as part of your strategy, which I do. Strategy is driven by OnBarUpdate, and it's impossible to get it in OnBarUpdate. I'd say that was hard!

NinjaTrader_Josh
08-06-2009, 07:52 AM
What is your end game requirement for getting these timestamps then? You still have the option to get them from a secondary bars object.

dave1992
08-06-2009, 07:57 AM
OK, so I need to add a 1 tick secondary bar object. So I probably need to set my 10 min bar to calc on close true, and run everything of the one tick bar update?

I still think it's a lot of effort for something that sounds easy to supply.

thanks for your help
Dave

NinjaTrader_Bertrand
08-06-2009, 08:19 AM
Dave, yes I think that's the best way to go - http://www.ninjatrader-support.com/HelpGuideV6/MultiTimeFrameInstruments.html