NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Miscellaneous Support

Miscellaneous Support Miscellaneous support issues.

Reply
 
Thread Tools Display Modes
Old 01-21-2010, 07:46 AM   #1
mefTrader
Senior Member
 
Join Date: Nov 2009
Posts: 205
Thanks: 0
Thanked 0 times in 0 posts
Default Want to check if the computer clock time is less than a specific time

I have the following code:

if (DateTime.Now.TimeOfDay < ToTime(10, 00, 00))
{
Print("Less than");
}


and Im getting the following error
"Operator '<' cannot be applied to operands of type 'System.TimeSpan' and 'int'"

I thought ToTime would be of type TimeSpane too?

Whats the correct syntax?

Thanks
mefTrader is offline  
Reply With Quote
Old 01-21-2010, 08:23 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

mefTrader, no ToTime() returns an Int value -

http://www.ninjatrader-support.com/H...V6/ToTime.html

Do you need the TimeOfDay timespan specifically?

This below should compile -

Code:
 
if (ToTime(DateTime.Now) < ToTime(10, 00, 00))
{
Print("Less than");
}
NinjaTrader_Bertrand 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
How do I get the value of a bar at a specific time TraderFoo Strategy Development 5 06-23-2009 12:42 PM
Computer clock setting markw Charting 1 01-03-2009 10:22 AM
price at specific time Kowal General Programming 2 10-06-2008 08:43 AM
Ninja using local CPU clock time? RK_trader Miscellaneous Support 5 08-17-2007 02:36 AM
new candle bar at different time than clock? coffee898 Charting 4 03-28-2007 06:48 AM


All times are GMT -6. The time now is 01:45 AM.