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
Hosted Script with AddDataSeries()
Collapse
X
-
Hello Julio,
Thank you for your post.
You would use myIndicatorName.Update() in the strategy to force the indicator update. For example:
Code:SMA(14).Update();
Please let me know if you have any questions.
Leave a comment:
-
Hosted Script with AddDataSeries()
Hello All,
I use an indicator hosted in a Stretegy. The scheme is as follows:
-The indicator has 10 AddDataSerires() based on 15 minutes, calculated on bar close. The indicator calculates some parameters from the prices of these 10 series regardless of the Primary (BarsArray[0]) Instrument. This works fine, whenever I load this indicator on a chart produces the expected output.
-The strategy works at much higher frequency, calculated on each tick from 1 minute bars, and needs some variables from the indicator above as they become accesible. However, the strategy does not need the 10 dataseries at all, but following the Hosted recommendation of the documentation, I added them too.
The weird thing is (Debugged with VS):
When I load the Strategy on Strategy Analyzer, this is what happens:
1) Strategy State.Configure is hitted
2) Strategy State.DataLoaded is hitted
3) Indicator State.Configure is hitted
4) Indicator State.DataLoaded is hitted
5) Strategy OnBarUpdate is executed for all the ticks and never produces any entry. this is because the indicator never computed anything since its OnBarUpdate Method never was called
6) When Strategy ends, the indicator starts to compute its bars, inside OnBarUpdate but it is too late because The strategy has already ended.
What I would like is to have step 5) and 6) in parallel. I can achieve this if I change the referenced Indicator. If the Strategy used for example another indicator that does not call AddDataSerires(), then I can see step 5) and 6) in parallel
Of course 1 solution would be writting the Indicator's code in the Strategy but I would like to solve it in another way.
Thanks in advance!
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by JohnS52, 03-22-2024, 08:06 AM
|
4 responses
28 views
0 likes
|
Last Post
by JohnS52
Today, 02:30 PM
|
||
Started by RaygunWizzle, Yesterday, 08:52 PM
|
2 responses
10 views
0 likes
|
Last Post
by RaygunWizzle
Today, 02:26 PM
|
||
Started by carnitron, 03-25-2024, 01:59 PM
|
11 responses
51 views
0 likes
|
Last Post
by carnitron
Today, 02:18 PM
|
||
Started by Gerik, 12-21-2023, 08:20 AM
|
15 responses
203 views
0 likes
|
Last Post
by Mindset
Today, 02:06 PM
|
||
Started by visvabalaji, Today, 02:04 PM
|
0 responses
4 views
0 likes
|
Last Post
by visvabalaji
Today, 02:04 PM
|
Leave a comment: