Any suggestions?
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!
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
NinjaTrader
Time[1] or any positive value doesn't work
Collapse
X
-
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? -
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.
-
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!
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,403 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
||
Started by Shai Samuel, 07-02-2022, 02:46 PM
|
4 responses
94 views
0 likes
|
Last Post
by Bidder
Today, 12:11 AM
|
||
Started by DJ888, Yesterday, 10:57 PM
|
0 responses
6 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
158 views
0 likes
|
Last Post Yesterday, 10:23 PM | ||
Started by Belfortbucks, Yesterday, 09:29 PM
|
0 responses
8 views
0 likes
|
Last Post
by Belfortbucks
Yesterday, 09:29 PM
|
Comment