Errors, bugs, questions - page 1392
![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
...
Anyway, it's shown in a crooked way that calling OnCalculate from OnTimer works)
We need to add correct value transmission in timeseries
The article shows just this example. )
Here is another example for tests with the same method:MQL5 Recipes - Development of Multicurrency Indicator for Price Divergence Analysis >>>
The variable count should be incremented before leaving OnCalculate() - then this variable will correctly count all runs in OnCalculate.
It should not count all of them, but only until the Ishimoku calculation. All that time, count was greater than or equal to 0 and then -1. Actually it doesn't matter. What is important is that
1) At the first start of the indicator, it was called once (OnCalculate) and it hasn't started until the next tick (on weekends and holidays up to several days), if we don't press the "Refresh" button.
2) At this first call, the Ishimoku indicator has not had time to calculate (let alone more complex indicators)
3) If you use OnTimer instead of OnCalculate (or call OnCalculate from OnTimer), a user can start an indicator that will be built automatically, otherwise he/she has to press the Refresh button (probably several times) or wait for the next ticks. Which is an obvious inconvenience, compared to the same MT4.
It's quite normal in simple indicators. But in more complex ones it is sometimes not working properly. )
There you didn't have to count everything, but only until the calculation of the Ishimoku. All that time count was greater than or equal to 0 and then -1. In general, it does not matter. What is important is that
...
The idea is for the user to see the number of entries in OnCalculate. In this case in the OnCalculate itself, when the result ofCopyBuffer is more than zero, the messages about successful receiving of values into the buffer are output. As a result, visually we can see the number of successful entries in OnCalculate.
I understand, it's just that we've already moved on a little beyond this example. It has been used, sorted out and returned to the main issue. The example confirmed that from the first run the calculation does not take place at the weekend. It confirmed it for me, at least. Would have had to constantly click on "Refresh". I personally find this unacceptable for users. So I will try to do it through OnTimer.
It is not possible to wait for timeseries to be ready in OnCalculate, because everything will hang. Therefore, if it's not ready, we make an EventTimer for a millisecond and check readiness in OnTimer. As soon as the timeseries is ready, we call OnCalculate and kill the timer with KillTimer.
I have another question, how can I be 100% sure that all required timeseries are ready or not?
It seems that OnTimer in indicators, which are called from other indicators, does not run at all. Therefore, you will not be able to update them through OnTimer. It seems that I have to put up with dozens of unnecessary clicks on the "Refresh" chart during the operation, compared to MT4.
And as bad luck it will be done each time using the mouse from the menu, because there is no such an option in the Toolbar, nor is there a hotkey for it. And there are "heavy" indicators, which are built much longer than 1 second.
... And there are 'heavy' indicators that take much longer than 1 second to build.
I've encountered the problem of "heavy" indicators. Look through the links in order - you will be interested.
The key point - one heavy indicator for a symbol slows down the work of all EAs on this symbol.Even on another chat!!! Heavy indicators are evil :)
2)A theme with a description and options for solving the problem
3.the solution to the problem within the Market
Have encountered the problem of 'heavy' indicators. Have a look at the links in order - you will be interested.
I do not need to exchange data between EAs and indicators, and the indicators themselves, although "heavy" in part, but perform relatively long calculations only at the moment of calculation of all history at the start.
The problem is that I cannot wait for the calculation of all of the other indicators used in this indicator at the first start of OnCalculate, and OnCalculate itself is called again only at the next tick, which is not present at the weekend for example. You can not use OnTimer instead of (or together with) OnCalculate, because it won't be called in indicators that weren't called by a user, but for example were called from another indicator using iCustom (it is so far according to my tests). I would like to find a solution for the indicator to automatically wait for the calculation of all indicators used in it and provide information without user's interference (without regular pressings of the "Refresh" button from the chart drop-down menu, if the frequency of new ticks is not enough for that).
I do not need to exchange data between the Expert Advisors and indicators, and the indicators themselves, although "heavy" in part, but they perform relatively long calculations only at the moment of calculation of the whole history at the start.
The problem is that I cannot wait for the calculation of all of the other indicators used in this indicator at the first start of OnCalculate, and OnCalculate itself is called again only at the next tick, which is not present at the weekend for example. You can not use OnTimer instead of (or together with) OnCalculate, because it won't be called in indicators that weren't called by a user, but for example were called from another indicator using iCustom (it is so far according to my tests). I would like to find a solution, that the indicator would be able to automatically wait for the calculation of all of its indicators and provide information without a user's intervention (without regular pressings of the "Refresh" button from the chart drop-down menu, if the frequency of new ticks is not enough for that).
If the task is set in such a way - there's really no need.
But we can create an Expert Advisor that will create indicators, receive data from them, process the data and pass the result to the indicator visualizer. Then there won't be all these problems you described. And many other problems as well...
The solution is not very nice, but it helps to get rid of the described problems.
HELLO, COULD YOU ADVISE ME, WHEN I OPEN A REAL ACCOUNT ON MT5, HOW LONG DOES IT TAKE FOR A COMPANY EMPLOYEE TO CALL ME AND COMPLETE THE ACCOUNT OPENING PROCEDURE?