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[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 Max238, Today, 01:28 AM
      1 response
      22 views
      0 likes
      Last Post CactusMan  
      Started by giulyko00, Yesterday, 12:03 PM
      2 responses
      10 views
      0 likes
      Last Post giulyko00  
      Started by r68cervera, Today, 05:29 AM
      0 responses
      4 views
      0 likes
      Last Post r68cervera  
      Started by geddyisodin, Today, 05:20 AM
      0 responses
      6 views
      0 likes
      Last Post geddyisodin  
      Started by JonesJoker, 04-22-2024, 12:23 PM
      6 responses
      38 views
      0 likes
      Last Post JonesJoker  
      Working...
      X