I'm currently experiencing an issue, with moving the value of an ISeries to an addon then strategy, and would love some help !
To explain :
The goal of this is to create a ISeries double and its values in a indicator, to pass this value trough and indicator, to have a strategy getting the values of the Series, and then the strategy use it for a plot.
- I have a indicator, let's say Indicator1, that create and set the values for a Series double, let's say Series1[0]. The Series1 has the value expected in the indicator, and can be used and printed like expected.
- I then want the value of Series1 to be used in a strategy, so i create an addon, and in the addon i have a Series<double> called SeriesStorage1.
- I then do NinjaTrader.NinjaScript.AddOns.Addon1.SeriesStorag e1[0] = Series1[0]
- And in the strategy i then do SeriesStrategy1[0] = NinjaTrader.NinjaScript.AddOns.Addon1.SeriesStorag e1[0]
Those principles work great while working with a double, i can even create a Series double in the strategy, and then get the value from the addon IF i'm using a double in the addon. But as soon as i try to use a Series double in the addon to store the value, it will compile, well, but create an error of Object reference not set to an instance of a object.
This error is common when a Series double is not declared, so i tried to not go trough an addon, and just set the Series1 (from the indicator) to public, and also i tried by changing the Series<double> to static series (or we would get an error), and then in the strategy, do so SeriesStrategy1[0] = NinjaTrader.NinjaScript.Indicators.Indicator1.Seri es1[0]
Sadly, using this last method, the value dissapear during the transfer, so if i print the Series1[0] value in the indicator before the transfer, we have the correct value, but after the transfer, the value in the SeriesStrategy1[0] go to 0 (not to n/a so the transfer as been tried).
I suppose this come from the Series<double>, and most likely the use of bar that it is doing, since i have been enable to transfer value with double using all of the methods above (transfer trough addon, or directly from indicator to strategy), but i cannot transfer and successfully recover the value of a Series<double>, and for my script, i need to use a Series<double> where a normal double would sadly not do the job.
So, could you help me, on how could it be possible to get the value of a ISeries from an indicator, to a strategy and recover the value successfully ?
Thanks a lot, have a fantastic day !
Comment