Instantiate a custom indicator with input parameters.
General
Quantower API provides a huge collection of built-in indicators. But sometimes we need to use our own indicator that we developed before or downloaded from the Internet.
In this article, we will create an instance of the custom indicator and pass the input parameters in different ways.
Below you can see the custom indicator code. Let's imagine that it is a very useful script and that we want to use its calculation results in our code. But we are not satisfied with the default input parameters, so we want to change them.
The easiest way to create and pass parameters is to use the class constructor. At this moment, our custom indicator has сonstructor that takes no parameters (parameterless constructor). Each indicator must have such a constructor.
Let's add a new constructor for the "CustomIndicator" class in which we will override the default input parameters.
This method can be used if you are unable to add the required constructor. For example, you imported a dll-library with an indicator. Each indicator has a "Settings" property that contains all input parameters converted into objects of “SettignItem” type.
To modify any of the parameters, you need to invoke the "UpdateItemValue" method and pass the name of the required parameter and the new value.