This is playing on my end. Please use a different web browser. If you are using Google Chrome use Microsoft Edge or Mozilla Firefox. If you are using Edge, use Chrome or Firefox. If you are using Firefox use Chrome or Edge.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
RTH High Low Open and GLOBEX High Low Open
Collapse
X
-
I downloaded the video. Extremely helpful. Is there any sound to explain what you're doing? Thanks.
Comment
-
Hello AdeptistJune,
There is no sound.
The video is to show what I explained in post #4 and post #8. If you remove the condition, the print appears for every bar including BarsInProgress 0, to show there is data for BarsInProgress 0.
With your assignment that I commented and uncommented I added a currentbar check which is necessary to prevent an indexing error.
Hello, I want to create an indicator that show data in a chart but calculate in other charttime different to the time of the chart where is showed. For example:
Always check the Log tab of the Control Center for errors.Chelsea B.NinjaTrader Customer Service
Comment
-
-
Now, I can't get the indicator to work in a strategy. I added the same adddataseries in the strategy. I tested an entry signal, but Im not getting anything.Last edited by AdeptistJune; 12-14-2021, 12:15 PM. Reason: I figured out what the currentbars check in for.
Comment
-
Chelsea B.NinjaTrader Customer Service
Comment
-
Now, I can't get the indicator to work in a strategy. I added the same adddataseries in the strategy. I tested an entry signal, but Im not getting anything
Comment
-
Hello, Chelsea,
I got the strategy to work, but in the strategy, I had to make the same changes you did in the video you posted. So if my indicator uses BarsInProcess == 1, and I want to use that indicator in a strategy, I would have to use BarsInProcess ==1 in my strategy as well?
Thanks.
Comment
-
Hello AdeptistJune,
Printing the BarsInProgress and Time[0] was to debug the script and show that BarsInProgress 0 has bars.
If your custom logic should only evaluate on BarsInProgress 1, then that would your choice to make.
If you are trying to understand if the primary series is updating OnBarUpdate() then add prints to debug the script and don't put the print in any condition.
Below is a link to a forum post on using prints to understand behavior.
A CurrentBar check, or index size check, is needed everytime you are using indexes.Chelsea B.NinjaTrader Customer Service
Comment
-
I'm new at programming and I'm having a tough time understanding BarsInProcess and when I should be using BarsInProcess. I just wanted to write a custom script that plots the RTH high, low, open, and the Globex high, low and open, and use that customer indicator in a strategy. When I don't use BarsInProcess the indicator will not plot, but when I do use BarsInProcess, it works. I guess my question is: To get my indicator to plot, when the indicator uses addeddataseries, do I have to use BarsInProcess?
Thanks.
Comment
-
Hello AdeptistJune,
When adding multiple series to a script with AddDataSeries() these will all cause OnBarUpdate to run for each series. BarsInProgress identifies which series is currently updating OnBarUpdate().
If BarsInProgress is 0, this would be the primary series (or the series of the chart). BarsInProgress 1 would be the first added series, BarsInProgress 2 would be the second added series, etc.
Below is a link to the help guide on BarsInProgress, AddDataSeries(), CurrentBars, Times, and Closes.
Plots in an indicator are associated with the primary series only, BarsInProgress 0, but can use data and information from other BarsInProgress series like Closes[1].
In general, to ensure every bar has a plot, a check can be done to see if a value has been set, and if not, set the Value series to the previous bar's plot.
Below is a link to an example.
I am also including a link to a forum post with helpful information about getting started with C# and NinjaScript programming.
Chelsea B.NinjaTrader Customer Service
Comment
-
Hello,
I've done everything to get the script to work when applied to a chart. But the script will not work unless I add it to a chart that has the same data series as the AddDataSeries hard coded in the script. I'm a hands on learner, and I find it difficult to understand the help guild. (I just can't get to work) So if you don't mind, can I send you the script, and can you walk me through on what I'm doing wrong. Im having a real hard time understanding what you're saying.
This is the error message I'm getting the output: Indicator 'GlobexAuctionIndex': Error on calling 'OnBarUpdate' method on bar -1: 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.
Thanks.Last edited by AdeptistJune; 12-15-2021, 06:56 PM.
Comment
-
Hello AdeptistJune,
I cannot write the code on your behalf, I can only guide you on how to debug it.
Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. Further, we do not provide C# programming education services or one on one educational support over the phone in our NinjaScript Support department. This is so that we can maintain a high level of service for all of our clients as well as our associates.
You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our NinjaTrader Ecosystem team follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.
Looking at the Log tab of the Control Center and finding that you are getting an error was the right thing to do.
This error is telling you that you are using an index that does not exist.
And index looks like this [1]. This would be an index of 1. If CurrentBar is 0, using an index of [1] would cause this error, as there is no bar 1 bar ago.
With multi-series scripts, this check needs to be done for each series. CurrentBars must be greater than any index you are using to look back in data, and to confirm there is a bar for the series being called.
Below is a link to a forum post on index errors and how to resolve them.
Hello, I want to create an indicator that show data in a chart but calculate in other charttime different to the time of the chart where is showed. For example:
Be sure that you re-reviewed CurrentBars in the help guide linked in post #27.
You will next need to identify which index was the invalid index and needs a currentbar check (or array size check).
Add prints above each line that uses an index. Print the time of the bar, print the BarsInProgress, print the index you are using, print CurrentBars for the series being used.
If you need to, re-review the post on using prints to understand behavior linked in post #25.
Save the output to a text file and include this with your reply.Chelsea B.NinjaTrader Customer Service
Comment
-
Thanks Chelsea,
This was the best explanation so far. Can you have the NinjaTrader Ecosystem team follow up with me with a list of affiliate consultants who can provide educational services. Thanks.Last edited by AdeptistJune; 12-16-2021, 09:25 AM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
589 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
342 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 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
555 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|
Comment