NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 09-11-2008, 03:48 PM   #1
ATI user
Senior Member
 
Join Date: Apr 2006
Location: , ,
Posts: 1,316
Thanks: 1
Thanked 7 times in 7 posts
Default DateTime.Now vs Market Replay

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.
ATI user is offline  
Reply With Quote
Old 09-11-2008, 03:52 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

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/libr...etime.now.aspx
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-15-2008, 05:25 PM   #3
Sicilian
Junior Member
 
Join Date: Jul 2008
Posts: 1
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Josh View Post
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/libr...etime.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.
Sicilian is offline  
Reply With Quote
Old 11-15-2008, 07:35 PM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

This is on our list already, thanks for the suggestion.
NinjaTrader_Ray is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
backtesting and DateTime.Now andrewbee Strategy Analyzer 3 06-28-2010 09:18 AM
Market Replay MJT Historical NinjaTrader 6.5 Beta Threads 11 02-21-2008 07:31 AM
Market Replay pgabriel Miscellaneous Support 3 05-28-2007 10:11 AM
Market data for market replay function grd974 Miscellaneous Support 1 05-26-2007 09:02 AM
Market replay saroj Miscellaneous Support 6 06-13-2006 09:16 AM


All times are GMT -6. The time now is 06:05 AM.