Pre-processed indicator
Pre-processed indicator
IValuesHandlerWithPrecalc - script class interface, shows that the handler works with the current values, but requires preprocessing.
Has the following methods:
PreCalc - the method is executed before the main calculation.
Execute - the basic calculation method.
PostCalc - the method is executed after the main calculation.
Incoming data
The class is preceded by the input data of the indicator through the Input attribute, for example:
[InputsCount (2)] [Input (0, TemplateTypes.DOUBLE, false, "list1")] [Input (1, TemplateTypes.DOUBLE, false, "list2")]
This means that the indicator accepts two lists of data with real numbers. The number of parameters can be unlimited.
Outgoing data
[OutputsCount (1)] [OutputType (TemplateTypes.DOUBLE)]
This means that the indicator produces one list of real numbers.
Example with streaming data:
In this example, the PreCalc method is executed first, passing two lists of data, list1 and list2. The method returns nothing. Then the Execute method is launched one by one for each bar, here i is the bar number. The method returns a real number. After that, the PostCalc method is run, it returns nothing.
Example with non-streaming data
You can specify that the data is not streaming, then the values will be passed element by element to the Execute method, for example:
[InputsCount (2)] [Input (0, TemplateTypes.DOUBLE, true, "list1")] [Input (1, TemplateTypes.DOUBLE, true, "list2")]
Note that now nothing is passed to the PreCalc method.
Feature of the indicator with one list of data
If the indicator has only one incoming data list, then it can work only with streaming data and the PostCalc method will not be available.
Last updated