Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Odd results with time differences

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

    Odd results with time differences

    I was exploring the use of the ToTime function to get some time differences between ticks. When I put the following indicator on a one minute chart of today's YM front month contract I find that it outputs the value 100 for time differences between bars and when the hour rolls over it reads 4000...

    Plot0.Set(ToTime(Time[0] - ToTime(Time[1]));

    What units is that supposed to be in? The problem at the hour rollover appears to be a bug unless I've misapplied something...

    On a tick chart it seems to read out in seconds and i get the 4000 reading at the hour rollover as well...

    #2
    Please review the Help Guide section for clear example of what is returned from the ToTime() method. Its an integer representation and not something you should use to calcualte the difference.



    Try

    Plot.Set(Time[0].Subtract(Time[1]).TotalSeconds);

    More information on DateTime methods/properties - http://msdn.microsoft.com/en-us/libr...e_members.aspx
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    579 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X