Thanks for that information.
I have tested the script you shared and when adding the indicator to the chart, we can see an error appearing in the Log tab of the Control Center.
The error message states "Indicator 'OneLine': Error on calling 'OnBarUpdate' method on bar 0: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart."
This error message indicates that you are trying to access a BarsAgo value that is not valid. A more simple example using one series would be on bar 5 you check for 6 BarsAgo. There are not yet 6 bars so the CurrentBar minus 6 would be a negative number or a non-existent bar.
A CurrentBar check could be used in your indicator's logic to ensure that a certain number of bars have been processed before the indicator begins calculation. A CurrentBar check would look something like this.
if (CurrentBar < 10) return;
After adding a CurrentBar check to the indicator script you shared, I see the indicator is drawing the line on the chart. See the attached screenshot.
See the help guide documentation below for more information and sample code.
CurrentBar - https://ninjatrader.com/support/help...currentbar.htm
Make sure you have enough bars - https://ninjatrader.com/support/help...nough_bars.htm
Comment