PDA

View Full Version : DateTime.Now vs Market Replay


ATI user
09-11-2008, 03:48 PM
I have posted before re the time in the Orders and Executions showing the computer time instead of the time of the data.

I now had the same issue occur when trying to use DateTime.Now (which will only picks up the current computer time) in Market Replay.

Also, in market replay, DateTime gives a date from April instead of today's date (11 sep).

So...I can not use my strategy in market replay as it will never be able to compare the DateTime.Now with the DateTime and get values that are meaningful.

Will this be changed in NT7?

Thanks.

NinjaTrader_Josh
09-11-2008, 03:52 PM
DateTime.Now is not related to anything in the Market Replay. It is a C# property and takes the current date and time as defined on your local computer.

http://msdn.microsoft.com/en-us/library/system.datetime.now.aspx

Sicilian
11-15-2008, 05:25 PM
DateTime.Now is not related to anything in the Market Replay. It is a C# property and takes the current date and time as defined on your local computer.

http://msdn.microsoft.com/en-us/library/system.datetime.now.aspx

OK, but what can we use in place of DateTime.Now that will work in both Market Replay and real time. There should be some way to access the replay time.

I tried using Time[0], but that gives me the time at the end of the current bar, which is no good.

I could compare the MarketDataEventArgs times to DateTime.Now, and take the difference, but this will not work if I pause or speed up the replay.

I could use MarketDataEventArgs.MarketData.Last.Time, but if there are no trades for a while this will fall behind the actual replay time as well.

I think I need a replacement for DateTime.Now anyway, since my local PC might get out of sync with the exchange time.

NinjaTrader_Ray
11-15-2008, 07:35 PM
This is on our list already, thanks for the suggestion.