AddChartIndicator()
<< Click to Display Table of Contents >> AddChartIndicator() |
Adds an indicator to the strategy only for the purpose of displaying it on a chart.
Notes: •Only the Plot properties of an indicator added by AddChartIndicator() will be accessible in the Indicators dialogue on charts. Other properties must be set in code. •To add Bars objects to your strategy for calculation purposes see the AddDataSeries() method. •An indicator being added via AddChartIndicator() cannot use any additional data series hosted by the calling strategy, but can only use the strategy's primary data series. If you wish to use a different data series for the indicator's input, you can add the series in the indicator itself and explicitly reference it in the indicator code (please make sure though the hosting strategy has the same AddDataSeries() call included as well) o If a secondary or null Bars series is specified by the calling strategy (not the indicator itself), the strategy's primary series will be substituted instead. •Dynamically using DrawOnPricePanel in an indicator outside of State.SetDefaults may show issues when working with that indicator through a hosting strategy via AddChartIndicator(). |
This method does not return a value.
Warning: This method should ONLY be called from the OnStateChange() method during State.DataLoaded |
indicator |
An indicator object |
protected override void OnStateChange() |
Tip: If you are adding an indicator which is dependent on the correct State of the indicator, you will need to ensure that you are also calling the indicator from the strategy in OnBarUpdate(), otherwise your indicator will only process in State.RealTime for performance optimizations. |
protected override void OnStateChange() |