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?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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?