![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: May 2008
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
|
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?
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
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?
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: May 2008
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
|
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.
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
You can use ToTime(e.Time);
That will convert e.Time to an integer.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: May 2008
Posts: 55
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks NT_Ryan. That did it.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |