
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
OnCalculate
The OnCalculate() function is called only in custom indicators when it's necessary to calculate the indicator values by the Calculate event.
This usually happens when a new tick is received for the symbol, for which the indicator is calculated.
This indicator is not required to be attached to any price chart of this symbol.
The OnCalculate() function must have a return type int. There are two possible definitions. Within one indicator you cannot use both versions of the function.
The first form is intended for those indicators that can be calculated on a single data buffer. An example of such an indicator is Custom Moving Average.
int OnCalculate (const int rates_total, // size of the price[] array
const int prev_calculated, // bars handled on a previous call
const int begin, // where the significant data start from
const double& price[] // array to calculate
);
OnCalculate
The OnCalculate() function is called only in custom indicators when it's necessary to calculate the indicator values by the Calculate event.
This usually happens when a new tick is received for the symbol, for which the indicator is calculated.
This indicator is not required to be attached to any price chart of this symbol.
The OnCalculate() function must have a return type int. There are two possible definitions. Within one indicator you cannot use both versions of the function.
The first form is intended for those indicators that can be calculated on a single data buffer. An example of such an indicator is Custom Moving Average.
int OnCalculate (const int rates_total, // size of the price[] array
const int prev_calculated, // bars handled on a previous call
const int begin, // where the significant data start from
const double& price[] // array to calculate
);
( I use word " Lag " it means delays price action, order open, close, just one word takes down my MT4 platform )
I use below function for my custom indicator.
When I write below return code to my custom indicator then my custom indicator starts to lag. But works correct, which one I want.
And when I write below return code to my custom indicator then my custom indicator does not work correctly which one I want. I mean while fake MA cross " Arrow " does not go back to previous MA cross point.
Q: What can I do for this situation, please?
Thanks in advance.
Here you go.
Thanks in advance.
OK! Thanks!
I still need more clearly answer.
Thanks in advance.
Answer is: Check Both Current MA Cross and Previous MA Cross.
#Buffer ( array out of range in ) - Closed
#Custom Indicator Lagging - Closed
#First result of Loop - Open
Thanks in advance.