Errors, bugs, questions - page 1391
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
After pressing "refresh" everything is calculated. It would be more convenient if indicator data, created in the inite, was calculated before the first call of OnCalculate/OnTimer etc.
It would be useful to have a possibility to wait for their calculation after the initialization in the loop inside the indicator.
To calculate the indicator, the user should press "refresh" on the chart several times. Does he need it. He will remember good old MT4 and will stay on it, despite some advantages of MT5.
Any calculations in indicators MUST be done only in OnCalculate().
I'm talking about the Ishimoku indicator readings in this case. I'm talking about indicator readings that are used in the current one, i.e. OnCalculate. So they are calculated before OnCalculate is called, as it was in MT4.
I am talking about the readings of the Ishimoku indicator in this case. I am talking about indicator readings that are used in current, i.e. in OnCalculate. So they are calculated before call of OnCalculate, as it was in MT4. Or it would be possible to wait for their calculation in OnCalculate. Otherwise users will have to press Update several times to build an indicator. Because not all indicators are built on the entire history in 1 second, there are complex indicators that take longer to calculate. All this time the user will have to wait over the "Refresh" button, while in MT4 you just have to wait for it to be drawn.
This problem comes up from time to time on the forum. Unfortunately, calling OnCalculate() in OnTimer() does not solve the problem.
But you can try it. An example can be found in this article: MQL5 Recipes - Development of a Multicurrency Volatility Indicator in MQL5.
Afterwards you will be able to write whether it worked or not.
OnInit() prepares the trading environment for the indicator. And only in OnCalculate() you can use the indicator data.
This problem comes up from time to time on the forum. Unfortunately, calling OnCalculate() in OnTimer() does not solve the problem.
But you can try it. An example can be found in this article: MQL5 Recipes - Development of a Multicurrency Volatility Indicator in MQL5.
Afterwards write whether it worked or not, if not too much trouble.
It turns out that you can't, without pressing "Update" button on the chart once or several times (or wait for 1/few ticks), if the indicator uses other indicators from other symbols and/or tf.
And if you look more closely at the workings of the code I gave? And in particular to the Experts? After restarting the terminal at the weekend:
You can perfectly see that the calculation only went through on the second call to OnCaalculate(). So no one removes from the programmer responsibility to check: check the result of CopyBuffer() in OncalCulate() - if the function did not return anything, it must be checked at the next input in OnCalculate().
This problem comes up from time to time on the forum. Unfortunately, calling OnCalculate() in OnTimer() does not solve the problem.
But you can try it. An example can be found in this article: MQL5 Recipes - Development of a Multicurrency Volatility Indicator in MQL5.
Please write later, if not too much trouble, whether it worked or not.
I have not read the article yet, but it works fine with OnTimer
I have a strange picture showing that call of OnCalculate from OnTimer works) I need to add correct values in timeseries
Haven't read the article yet, but the reception with OnTimer works fine
Haven't read the article yet, but the reception with OnTimer works fine
Use the Styler - it's better for identifying errors.
Increase count variable before exit from OnCalculate() - in this case this variable will correctly count all runs in OnCalculate.