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 > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 09-28-2010, 01:59 PM   #1
mgin98
Member
 
Join Date: May 2008
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
Default e.Time vs ToTime

I'm calculating variables in OnMarketData that are dependent on time, specifically seconds. Some of the calcs aren't working properly when using ToTime. I noticed when doing a print of e.Time and ToTime in OMD (onmarketdata), that ToTime lags e.Time. Any suggesstions for a datetime structure that will match e.Time values in OMD that can be compared using booleans?
mgin98 is offline  
Reply With Quote
Old 09-28-2010, 02:05 PM   #2
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hello mgin98,

ToTime() converts a date time object to an integer. It doesn't hold any time properties. What are you comparing with e.time?
NinjaTrader_RyanM is offline  
Reply With Quote
Old 09-28-2010, 02:26 PM   #3
mgin98
Member
 
Join Date: May 2008
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
Default

I'm analyzing OnMarketData events at the tick level and trying to use the lowest timeframe available in NT to group the data, which is the seconds timeframe as far as I know. I need to be able to determine when a second has passed so that I can reset the variables and begin processing incoming data again. ToTime gives me an integer to compare but it lags e.Time so it skews the results.

How can I use ToTime to convert e.Time to an integer? That would be ideal.
Last edited by mgin98; 09-28-2010 at 02:29 PM.
mgin98 is offline  
Reply With Quote
Old 09-28-2010, 02:35 PM   #4
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

You can use ToTime(e.Time);

That will convert e.Time to an integer.
NinjaTrader_RyanM is offline  
Reply With Quote
Old 09-28-2010, 03:00 PM   #5
mgin98
Member
 
Join Date: May 2008
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks NT_Ryan. That did it.
mgin98 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
DayOfWeek or ToTime or Time? GreenTrade Strategy Development 10 06-11-2012 06:30 PM
ToTime(Time[0]) Confusion shiptastic Automated Trading 14 11-20-2010 08:40 PM
ToTime (Time [0]) hegh2000 Version 7 Beta General Questions & Bug Reports 4 02-03-2010 11:03 AM
ToTime John833 Strategy Development 2 11-25-2008 10:08 AM
Question about ToTime(Time[0]) mazachan General Programming 1 07-09-2007 09:08 AM


All times are GMT -6. The time now is 04:23 PM.