NinjaScript > Educational Resources > Reference Samples > Indicator > Exposing indicator values that are not plots |
|
There may be cases where you want to have your indicator calculate non-plotted values that you will want to access when using this indicator inside of another indicator or strategy.
Key concepts in this example
Important related documentation
We suggest using any available class that implements the IDataSeries interface. These include the following:
Notes There is an indicator and a strategy in the attached file used to demonstrate this concept. Please be sure to review both files.
Using these classes will provide you with a way to store calculated values associated to each bar in a chart. This will allow any referencing objects to access the historical calculated values. These classes hold internal logic that ensure that the OnBarUpdate() method of the indicator is processed prior to accessing the current bar’s value. This guarantees you will receive up-to-date values when retrieving the calculations.
In the event that an IDataSeries type class does not exist for the object type you wish to expose, you will need to use the Update() method within the property “getter” to ensure that OnBarUpdate() is processed and your calculated value is up-to-date.
Import instructions
|