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

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 geddyisodin, Yesterday, 05:20 AM
    7 responses
    45 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by gbourque, Today, 06:39 AM
    2 responses
    5 views
    0 likes
    Last Post gbourque  
    Started by cre8able, Yesterday, 07:24 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by cocoescala, 10-12-2018, 11:02 PM
    6 responses
    939 views
    0 likes
    Last Post Jquiroz1975  
    Started by cmtjoancolmenero, Yesterday, 03:58 PM
    1 response
    17 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X