Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

time == time error

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

    time == time error

    I am having an issue with time. for some reason it won't go in my if statement.

    It went in the if statement the first time but the second time it skips. if you look at the picture below the output shows it went in the first time but on the second time around the times are equal but it won't go in.

    // if the next pivot time is equal to current time
    Print(tNextPivotTime + " tNextPivotTime is Draw Pivot And Angle");
    Print(Time[0] + "Time[0] is");
    if (tNextPivotTime == Time[0])
    {
    Print(" In next Pivot time");
    }
    Attached Files

    #2
    Hello ballboy11,

    Thank you for your note.

    To confirm the times are exactly the same, would you modify your print statements with the following, printing out to the millisecond.

    Code:
    Print(tNextPivotTime.ToString("MM/dd/yyyy hh:mm:ss.fff tt") + " tNextPivotTime is Draw Pivot And Angle");
    Print(Time[0].ToString("MM/dd/yyyy hh:mm:ss.fff tt") + "Time[0] is");
    What results do you see?

    If you use the following if statement,
    Code:
    if(ToTime(Time[0]) == ToTime(tNextPivotTime))
    {
    Print(" In next Pivot time");
    }
    Do you see the prints you expect?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by adeelshahzad, Today, 03:54 AM
    5 responses
    32 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by stafe, 04-15-2024, 08:34 PM
    7 responses
    32 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by merzo, 06-25-2023, 02:19 AM
    10 responses
    823 views
    1 like
    Last Post NinjaTrader_ChristopherJ  
    Started by frankthearm, Today, 09:08 AM
    5 responses
    22 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    43 views
    0 likes
    Last Post jeronymite  
    Working...
    X