How do I make the output on a chart in monospaced font? - page 6

 
Nikolai Semko:

With MT4, on the other hand, the picture is completely different.
While on MT5 the work of Comment and Canvas is about the same, on MT4 Comment is 1000 times faster. I conclude that in MT5 the Comment is implemented through the internal BitMap, while in MT4 it works differently. The difference is impressive. I think I will move this question to the Bug forum.

Detailed explanation here: https://www.mql5.com/ru/forum/1111/page2102#comment_6156364

The Comment in MT4 is essentially fake and does not cause the chart to redraw.

 
Renat Fatkhullin:

Detailed explanation here: https://www.mql5.com/ru/forum/1111/page2102#comment_6156364

Comment in MT4 is essentially fake and does not cause the chart to redraw.


And now to draw practical conclusions

1. It would be nice to replace the series of functions that affect performance in testing with their #define counterparts

2. 90% of ladies/people present here are in defines like oinking in oranges.

4. There is a defines monster on the forum fxsaber

5. Maybe ask him to make and maintain a library of similar defines, so that mere mortals don't have to think about what mode the program works in?

What does the community and fxsaber think about such a suggestion?

 

What do defines have to do with it if people don't understand the tool and are trying to test for speed what can't be tested.

Calling up a comment to look at it is normal.

Calling it 1000-10000 times per second is abnormal both logically (you can't look at it) and technologically - it causes high costs not to display/redraw the whole chart (not just your line).

You need to understand what you're doing. Which is what I wrote about in detail in my reply.

 
Renat Fatkhullin:

What do defines have to do with it if people don't understand the tool and are trying to test for speed what can't be tested.

Calling up a comment to look at it is normal.

Calling it 1000-10000 times per second is abnormal both logically (you can't look at it) and technologically - it causes high costs not to display/redraw the whole chart (not just your line).

You need to understand what you're doing. Which is what I wrote about in detail in my reply.

And instead of that you suggest "give me a piece of code to keep thinking", ignoring explanations of why it's wrong to do it that way.

Renat, I have a working EA here. I'm a sucker and don't know anything about these drawings. It works and it's great. I submit it for testing and see the performance degradation due to the problems I have described.

Wouldn't it make sense to make a define that determines in which mode we're working? And in test/optimization mode it just doesn't output anything?

 
Alexey Volchanskiy:

Renat, I have a working EA here. I'm a sucker and don't know anything about these drawings at all. It works and it's great. I'm testing it and see a decrease in performance due to the problems I've described.

Wouldn't it make sense to make a define that determines in which mode we're working? And in test/optimization mode it just doesn't output anything?


Don't expect people to understand everything like that. God forbid 20% of people on this forum understand OOP. It may be compared to knowledge of a car. All drive them, but very few understand how the same internal combustion engine works and a fraction of % can somehow fix something.

But they are all your customers.)

 
Alexey Volchanskiy:

Renat, I have a working EA here. I'm a sucker and don't know anything about these drawings at all. It works and it's great. I'm testing it and see a decrease in performance due to the problems I've described.

Wouldn't it make sense to make a define that determines in which mode we're working? And in test/optimization mode it just doesn't output anything?

And what is the problem to think about and dramatically improve everything?

There's already some MQL4-MQL5 library in "it works and it's great" mode, that's why we have to tear our hair out. People are seriously using it to compare the speed of both platforms.

And now you're offering not to think, but to make another handmade product that will be hauled around saying "MT5 is slower".

 
Renat Fatkhullin:

There's already a MQL4-MQL5 library in "works and is great" mode, which makes you tear your hair out. People are seriously using it to compare the speed of both platforms.

This is not a well-reasoned statement.

 
Alexey Volchanskiy:

Isn't it logical to make a define that determines which mode we are working in? And in test/optimisation mode just doesn't output anything?

There is a universal tool that allows you to measure code performance in the tester with one line. We can see a lot of things there. In particular, that a single run is slower than an optimization run.

On the subject of the comment, the developers gave their answer. So far, I myself accelerate the optimization by 1.5-2 times by one line.

And the SD told me about an important nuance for performance.


Worrying about microseconds of function execution is reasonable only in optimization modes. In real-time, it makes no difference. And the Comment does not play any role in the performance of the Expert Advisor in real-time, even if it is an order of magnitude slower.


But it is a fact that almost no one writes EAs in such a way that they run as fast as possible in the tester.

 
Renat Fatkhullin:

What do defines have to do with it if people don't understand the tool and are trying to test something that cannot be tested for speed.

Renat Fatkhullin:

There is already a MQL4-MQL5 library in "it works and it's great" mode that makes you tear your hair out. The people are seriously using it to compare the speed of both platforms.


And I personally do not feel sorry for the work done. These seemingly uselessbenchmarks turned out to be not useless at all. As many useful things came to light thanks to your detailed explanation, and as a result some puzzles began to fit together. It's not written anywhere, so I have to pinched it out :)).

For example, though I'm ashamed to confess it, I did not know that Kanvas' Update() function redraws the whole window regardless of its size. But to understand it, I just had to look through CCanvas guts. And knowing at least just this fact will change the logic of work and save me from unnecessary gestures in some graphics-related implementations. And Comment had nothing to do with it, it was just a "just to get to the bottom of it". Thanks again!

What remains unclear is that while the Update(false) function in MT5 does not draw anything on the screen, the MT4 function does not draw the whole window but only the canvas itself. It means that the ResourceCreate function in MT5 does not draw an array of pixels without ChartRedraw() but does in MT4. I think it would be useful in MT5 as well.

 
Nikolai Semko:

ResourceCreate in MT5 does not display an array of pixels without ChartRedraw(), but it does in MT4.

And it does it correctly. It's as logical as not to do ChartRedraw after changing the object properties. Using the terminology of

Forum on trading, automated trading systems and strategy testing

Errors, Bugs, Questions

Renat Fatkhullin, 2017.12.05 02:51

  • MT5 has a more correct system of changing objects on the chart and you need to clearly understand the consequences of mixing read/write commands
    it is recommended not to mix read/write commands, but to do a separate mass read and mass write.

ChartRedraw should be called after mass write, not after every write.