Download MetaTrader 5

Nested indicators efficiency?

To add comments, please log in or register
Publish your article and thousands of people all over the world will read it!
suramu
7
suramu 2016.11.27 21:30 
Hi,


I was developing some indicators. Then I wanted to call some of them in a separate indicator and I thought to myself: what if its more efficient to just perform all the indicators in one indicator.

The question I quess is, when an indicator is called through another indicator, does it reset each time its called?

For example lets hace two indicators #indicator1 and #indicator2, where 2 is called inside 1 using the OnCalculate() command, which means that on every tick indicator2 would be called.
Now say that in indicator2 we have something like:

Bars - IndicatorCounter()

or

rates_total - prev_calculated [with a return(rates_total) ]

that governs a variable "limit" which is used to determine a main for loop (pretty standard stuff).

Does it mean that the "prev_calculated" and "IndicatorCounted()" insied indicator2 will calculate using "initial conditions" everytime it is called (so 0 I would assume) and therefor have to reloop every bar everytime its is called?

To add comments, please log in or register