• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Want to check if the computer clock time is less than a specific time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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

    #2
    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");
    }
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by vivekniwas, Today, 11:31 AM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Heath  
    Started by Austiner87, Yesterday, 04:59 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by rlcheny, Today, 10:38 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Tyler  
    Started by JAtrades, Today, 05:38 AM
    5 responses
    24 views
    0 likes
    Last Post rlcheny
    by rlcheny
     
    Started by RobotSyndicate, Today, 08:27 AM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X