Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time[1] or any positive value doesn't work

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

    Time[1] or any positive value doesn't work

    I am new to NinjaTrader. I am trying to reference the time of specific x bar ago and get its time. From what I understand from the help, ToTime(Time[1]) or ToTime(Time[15]) should work and what happen is they stop the indicator.

    Any suggestions?

    #2
    Hello Shai Samuel,

    Thank you for your post and welcome to the NinjaTrader support forum!

    When using these positive values do you see an error listed in the Log tab of the NinjaTrader Control Center?

    If so, does this message relate to the barsAgo? If this is true you will need to ensure you have enough bars on the chart before accessing these values. For information on this please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=3170

    Please let me know if I may be of further assistance.

    Comment


      #3
      Thank NinjaTrader_PatrickH for your reply.
      The log shows an error: "Error on calling 'OnBarUpdate' method for indicator 'PreviousPeriodHigh' on bar 0: Bar index need to be greater/equal 0"

      So I learned that the indicator goes to the beginning of the data, and since at the beginning there are no previous bars you get errors.

      The solution is to use CurrentBar and make sure you don't pass it, skipping the first bars, until you have enough 'history'.

      I hope this can help others!
      Last edited by Shai Samuel; 09-22-2013, 11:18 PM. Reason: Solution

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      175 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      331 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      253 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      356 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      183 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X