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 IanS00, 03-27-2024, 11:24 AM
|
2 responses
10 views
0 likes
|
Last Post Today, 02:00 AM | ||
Started by Mariawilcoxi, Today, 01:32 AM
|
0 responses
1 view
0 likes
|
Last Post
by Mariawilcoxi
Today, 01:32 AM
|
||
Started by gleichnerany, Today, 01:17 AM
|
0 responses
4 views
0 likes
|
Last Post
by gleichnerany
Today, 01:17 AM
|
||
Started by WHICKED, 03-27-2024, 12:33 PM
|
4 responses
45 views
0 likes
|
Last Post Today, 12:28 AM | ||
Started by f.saeidi, Today, 12:12 AM
|
0 responses
6 views
0 likes
|
Last Post
by f.saeidi
Today, 12:12 AM
|
Comment