I confirm, I tweaked the code a bit. Regularly above 3 ms, which is a lot to get 2 chart properties.
2020.05.28 15:44:15.202 342152 (NZDJPY,H4) Execution delay: 10655 µs
2020.05.28
15:45:07.667 342152 (NZDJPY,H4) Execution delay: 3870 µs
2020.05.28
15:45:10.916 342152 (NZDJPY,H4) Execution delay: 8960 µs
2020.05.28
15:45:46.179 342152 (NZDJPY,H4) Execution delay: 25125 µs
2020.05.28
15:45:53.932 342152 (NZDJPY,H4) Execution delay: 20580 µs
2020.05.28
15:46:02.163 342152 (NZDJPY,H4) Execution delay: 4551 µs
I have known this problem for a long time
https://www.mql5.com/ru/forum/1111/page2099#comment_6312163
That is why I created the iCanvas class - to minimize the use of asynchronous functions.
In this class, this problem is minimized.
Therefore, the correct behavior of an experienced programmer is the development of smart algorithms that minimize the use of asynchronous functions.
I have known this problem for a long time
https://www.mql5.com/ru/forum/1111/page2099#comment_6312163
That is why I created the iCanvas class - to minimize the use of asynchronous functions.
In this class, this problem is minimized.
Therefore, the correct behavior of an experienced programmer is the development of smart algorithms that minimize the use of asynchronous functions.
What asynchronous functions ?
How is Canvas related to this issue ?
If you solution is to build your own chart it's not a solution, it's a workaround.
What asynchronous functions ?
How is Canvas related to this issue ?
If you solution is to build your own chart it's not a solution, it's a workaround.
ChartGetInteger, ChartGetDouble, ChartXYToTimePrice
Read the forum which I gave a link.
In a situation when developers have repeatedly made it clear that they are not going to solve this problem, a workaround is a solution.
ChartGetInteger, ChartGetDouble, ChartXYToTimePrice
Read the forum which I gave a link.
In a situation when developers have repeatedly made it clear that they are not going to solve this problem, a workaround is a solution.
These are not asynchronous functions, but on the contrary synchronous ones.
Forum on trading, automated trading systems and testing trading strategies
Ilyas , 06/20/12 1:40 p.m.
This is not a mistake, this is the cost of a synchronous command to the chart
If you use canvas without binding to the chart, then there is no problem, but if there is a binding to price and time, then asynchronous functions cannot be avoided.
This has nothing to do with binding to chart or not. The above code shows the issue to get chart properties, nothing to do with objects on the chart. (I can imagine if additionally there are objects it's even worst, but that's not the point here).
In general I am find your tone here condescending and unpleasant, I hope it's only a matter of language.
In general I am find your tone here condescending and unpleasant, I hope it's only a matter of language.
Yes, Alain, you probably were embarrassed by my incorrect translation from Russian. I apologize. The fact is that in the Russian language the pronoun "You" has a much broader interpretation than in English. The Russian words “ты” (singular), “вы” (plural), "Вы" (respectful addressing to a person) will be translated into English as “you”. Also in Russian, the pronoun “you” in some semantic constructions has the meaning “anyone” or “someone”. I meant "If anyone ...", not "If you".
Of course, there was no condescending towards to you. I treat you with great respect.
I apologize again for my English.
These are not asynchronous functions, but on the contrary synchronous ones.
ChartGetInteger, ChartGetDouble, ChartXYToTimePrice are asynchronous functions.
This has nothing to do with binding to chart or not. The above code shows the issue to get chart properties, nothing to do with objects on the chart. (I can imagine if additionally there are objects it's even worst, but that's not the point here).
The above code demonstrates a large delay in the asynchronous ChartGetInteger function, which is executed in the Scale () and AutoScroll () functions. Therefore, this topic has the same name. And this function (ChartGetInteger) is also very actively used to bind the Canvas object to the chart.
PS:
Oh no, I'm sorry, but the ChartGetInteger and ChartGetDouble functions are synchronous functions. You're right.
But I don’t understand why they are so slow.
Yes, Alain, you probably were embarrassed by my incorrect translation from Russian. I apologize. The fact is that in the Russian language the pronoun "You" has a much broader interpretation than in English. The Russian words “ты” (singular), “вы” (plural), "Вы" (respectful addressing to a person) will be translated into English as “you”. Also in Russian, the pronoun “you” in some semantic constructions has the meaning “anyone” or “someone”. I meant "If anyone ...", not "If you".
Of course, there was no condescending towards to you. I treat you with great respect.
I apologize again for my English.
ChartGetInteger, ChartGetDouble, ChartXYToTimePrice are asynchronous functions.
The above code demonstrates a large delay in the asynchronous ChartGetInteger function, which is executed in the Scale () and AutoScroll () functions. Therefore, this topic has the same name. And this function (ChartGetInteger) is also very actively used to bind the Canvas object to the chart.
PS:
Oh no, I'm sorry, but the ChartGetInteger and ChartGetDouble functions are synchronous functions. You're right.
But I don’t understand why they are so slow.
Me neither, but Ilyas seems to find it normal !? It's a mystery for me and I would like to know the reason.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
some of us use the timer to check chart settings for synchronizing etc. I figured out, that some simple executions of ChartGetInteger() can produce a drastic delay of up to 100ms already already in this simple sample. Problem is as usual: Once you use such a timer and you have 10 Charts opened, it delays MetaTrader heavily and can also result in a freeze, especially when used within an indicator. The normal execution time for a function like this, which does not communicate with the world outside, is done in a few microseconds, but should never need 10.000 - 100.000 times longer.
This is the test code. I don´t deal with native functions, so don´t wonder that I use CChart here, but it makes no difference.
And this is the result:
The version of MT5 or MT4 does not matter, I know this problem since more than a year in any version. Futhermore it happend on every local workstation, every VPS, every server.