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
Multiple DataSeries Issue
Collapse
X
-
-
Hello,
I am unsure of the overall goal here, OnBarUpdate should occur once bars are loaded or after State.DataLoaded. This would occur in OnStateChange, and then your per bar logic would go in OnBarUpdate. What specifically are you running into where you need to wait until bars are loaded in OnBarUpdate?
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
The overall goal is to know when OnUpdateBar has executed for all dataseries. This would be the most practical and efficient way when building a dashboard. Otherwise, we would be building the dashboard after every execution of OnBarUpdate. What is the most efficient way to determine this?
Thanks in advance!!
Comment
-
Hello,
There is no definite end for OnBarUpdate, each series would call this override for each historical bar in the requested series along with new bars that are built for incoming data. What is the specific goal, are you trying to do a calculation only one time per script being enabled or do something only once you are in realtime?
You can use State.DataLoaded to know all data is loaded, this occurs before bars start processing. You can wait till State.Realtime if historical data should be omitted and only calculated once all bars have been processed.
I could suggest adding a Print into OnStateChange and also one in OnBarUpdate, you could then run the script and view the output. This would tell you when each state is run and when each bar is processed to give you a better idea where your logic may need to go.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Thanks. I actually already solved it. But the goal is to make sure all of the dataseries had loaded so that my indicator could recommend trading decisions.I actually think that would be a nice enhancement as many strategies call for the use of multiple dataseries.
Thanks!!
Comment
-
I'll try to explain again. Let's say you use the Daily, H4 and H2 bars to make a trading decision on 10 different pars and you want to evaluate this data after every bar close for all 30 of the dataseries after they have been updated. How would you do it?
Comment
-
Hello,
If you are wanting to check that all series have at least A bar processed or have enough data to begin processing logic, you would use the CurrentBar:
Code:if(CurrentBars[0] < 1 || CurrentBars[1] < 1 || CurrentBars[2] < 1) return;
Code:|| CurrentBars[BarsInProgressIndex] < MinimumBarsNeeded
This would only ensure that bars are available for each series, if you wanted to then execute logic after this point but be specific on which series executes that logic, you would use BarsInProgress
Code:if(CurrentBars[0] < 1 || CurrentBars[1] < 1 || CurrentBars[2] < 1) return; // return until each series has X bars available if(BarsInProgress == 0) { // do logic on primary series only after all bars have X bars processed. }
Is this what you were questioning?
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by WHICKED, 03-27-2024, 12:33 PM
|
4 responses
41 views
0 likes
|
Last Post Today, 12:28 AM | ||
Started by f.saeidi, Today, 12:12 AM
|
0 responses
3 views
0 likes
|
Last Post
by f.saeidi
Today, 12:12 AM
|
||
Started by Conall, Today, 12:06 AM
|
0 responses
5 views
0 likes
|
Last Post
by Conall
Today, 12:06 AM
|
||
Started by proptradingshop, 03-21-2024, 09:50 AM
|
6 responses
27 views
0 likes
|
Last Post Today, 12:02 AM | ||
Started by mly916, Yesterday, 09:48 PM
|
1 response
12 views
0 likes
|
Last Post Yesterday, 11:54 PM |
Comment