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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    29 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    46 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X