Any suggestions?
Announcement
Collapse
No announcement yet.
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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
605 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
351 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
560 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
561 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment