
The IIndicator interface represents a specified contract whose implementation allows terminal modules to interact uniformly with indicators. Let's examine all the members of this interface:
TypeIndicator – sets the way the indicator is displayed on the chart area. The IndicatorChartPaintType enumeration can have the following values:
1. Line – the indicator is displayed as a line.
2. Column – histogram. The indicator is displayed as a bar chart.
3. Point – the indicator is displayed as a series of points.
Colors – a list of colors for the indicator's data series.
ValuesToChart – a list of all the indicator values, distributed across data series.
CanDelete – indicates whether the indicator can be deleted from the chart. This flag is necessary to prevent the deletion of indicators that serve as data sources for other indicators.
NameSeries – the name for the data series, which will be displayed on the chart.
NameArea – the name of the chart area where the current indicator will be displayed.
Name – a unique name for the indicator.
PaintOn – a flag that indicates whether the indicator should be displayed on the chart.
Save – a method that saves the indicator settings to the storage.
Load – a method that loads the indicator settings from the storage.
Delete – a method that deletes the indicator settings file from the storage.
Clear – a method that removes the data series from the indicator.
ShowDialog – opens the indicator settings window.
NeadToReloadEvent – an event signaling that the indicator needs to be redrawn.
Process – a method that takes a series of candles and performs calculations for the indicator's data series.
With the introduction of the new way of creating indicators, this process has become much faster and more comfortable. This was made possible by the implementation of the abstract class Aindicator, which has taken on the implementation of the IIndicator interface. In addition to this, the class provides a number of methods that allow for flexible configuration of the indicator, attaching other indicators as data providers, and managing the data series flexibly.
The entire process of creating an indicator boils down to overriding two abstract methods:
public abstract void OnStateChange(IndicatorState state);
public abstract void OnProcess(List<Candle> source, int index);
Analogous to robots, so-called indicator parameters – descendants of the abstract class IndicatorParameter – are used to embed settings into the indicator. There is also a special class for working with data series, called IndicatorDataSeries. In the next article, we will take a closer look at the method of creating an indicator using the described classes.
If you have any difficulties or questions, please write to the support chat. Link