I have a similar thing. But the problem is that you don't get the information all the time, as many times the event is missed/forgotten/not happening.
For such cases, I have a ChartChanged() function in this library, which forcibly updates all the chart parameters. I mainly use it in the tester mode.
In general, I managed to achieve acceptable work when the acceleration of XY <=> price-time coordinates translation is tens and even hundreds of thousands of times faster than using mega-braking ChartGet.... and XY,... functions.
Nikolai Semko #: For such cases, I have a ChartChanged() function in this library, which forcibly updates all the chart parameters. I mainly use it in the tester mode.
In general, I managed to achieve acceptable work when the acceleration of XY <=> price-time coordinates translation is tens and even hundreds of thousands of times faster than using mega-braking ChartGet.... and XY,... functions.
Yeah of course, right decision. I even transfer all the buffered values to the indicators and no indicator never uses any ChartGetWhatever function. Its all just hell of work to create all these workarounds and it took me months to figure out that the parallel access of any Chart values from EA and indicators is the reason for freezes of the whole MT terminal.
MQL is simply highly critical when its getting complex. Its a fact and I would wish so much, that MQ would offer to cooperate with professionals like us. But thats just a wish. For quite a while I was in contact with Renat directly, but from some time, he simply didn´t reply anymore at all.
A pity.
Long term, the only way out of this is to develop whatever is possible in C# and (mis)use MQL as a host to exchange data and receive commands from C#. This is what I am working on in the meanwhile and its the most stable solution. The pipes are written in native C and I can choose between sycnhronous and asynchronous transfer. All visual stuff is executed in a separate thread. Funfact: It takes 20 microseconds to convert the whole metrics data plus all colors into a byte stream, 10 microseconds to transfer, 20 microseconds to convert the data back to a structure in C# - but 1.000 times more to execute ONE ChartGetInteger() function in MQL plus same time again in timer just to check. That is a massive bottleneck and nothing in CCanvas, as nice as it is, can make that up.
All u can do with CCanvas, can then also be done with GDI, since CCanvas is 1:1 the same basis anyway. And with some tricks, you can use the C# Graphics GDI functions to write directly into the same array - also async in another thread without sending back the bitmap first.
Doerk Hilger #: In the long run, the only way out is to develop everything possible in C# and (incorrectly) use MQL as a host to exchange data and get commands from C#.
I would say that in the long run you have to get away from any trading platforms, and write your trading systems in C++ or Rust on a high performance server with your own connectors to the exchanges. Like all high-tech hedge funds specialising in algorithmic trading do. And the client control panel with all the necessary visualisation can be done on anything. Even in a browser.
And MT5, of course, is a great way to start thanks to the possibility to test your trading systems on real ticks and free access to quotes. Thank you very much for that!
you can use cairo https://cairographics.org/, take as surface (initial, the same as in Canvas) an array of pixels, format ARGB32 and go with a song....
Here is an example, but through a separate DLL. To write #import to API cairo_XXX honestly lazy.
but the approach will not work for a dying market :-))
But it closes a lot of problems and even raises the question of whether Canvas is necessary...if you can draw on a ready array of pixels with a normal stable, mature library.
you can use cairo https://cairographics.org/, take as surface (initial, the same as in Canvas) an array of pixels, format ARGB32 and go with a song...
Here is an example, but through a separate DLL. To write #import to the API cairo_XXX honestly lazy.
MQL:
C
H
and the result of course :
but the approach won't work for a dying market :-)
But it closes a lot of problems. and even raises the question whether Canvas is necessary...if you can draw on a ready array of pixels with a normal stable, mature library.
Actually I was aiming initially at Blend2D https://blend2d.com but there are no ready binary packages with it for win, and I couldn't build it from sorts (some cmake tricks are like that).
The principle of use is the same (you can also provide a pixel array and use it to drive), but B2D is more optimised than cairo and it is multithreaded.
If I get my hands on it next weekend, I'll tell you how to use it.
Реter Konow #: Through the resource you can transfer a large amount of information from the tester to the Expert Advisor on the chart and trade with the panel by hand too. The system is certainly more complex than checking the states of buttons of the "dead" panel in the tester, but the possibilities are much greater.
Such a tandem cannot be sold on the Market. And the level of buyers there is not very good for such complexities. I often meet complaints like: - I bought an Expert Advisor for MT5, but it does not work under MT4, how can I fix it?
you can use cairo https://cairographics.org/, take as surface (initial, the same as in Canvas) an array of pixels, format ARGB32 and go with a song...
Here is an example, but through a separate DLL. To write #import to the API cairo_XXX honestly lazy.
MQL:
C
H
and the result of course :
but the approach won't work for a dying market :-)
But it closes a lot of problems. and even raises the question whether Canvas is necessary...if you can draw on a ready array of pixels with a normal stable, mature library.
and without external additional DLL, exclusively API cairographics.org
Well, why can't you sell it? Yes, you can. After all, it is one and the same Expert Advisor, but it is just installed on the chart and in the tester at the same time. Its panel is active on the chart, but not in the tester. The Expert Advisor from the chart writes instructions to open/close an order to the resource, which then reads the EA in the tester and places/deletes the order. Somewhere on the forum I posted a video of such a tandem (or Papkov, who I made it for, I don't remember). That video shows trade management in the tester through the panel on the MT4 chart. Maybe I will find it later.
Why can't you do it? After all, it is one and the same Expert Advisor, it is just installed on the chart and in the tester at the same time. Its panel is active on the chart, but not in the tester. The Expert Advisor from the chart writes instructions to open/close an order to the resource, which then reads the EA in the tester and places/deletes the order. Somewhere on the forum I posted a video of such a tandem (or Papkov, who I made it for, I don't remember). That video shows trade management in the tester through the panel on the MT4 chart. Maybe I will find it later.
If it is the same one, then yes, I didn't think of it somehow ))) But I foresee a lot of problems with users, most of them are below the plinth level.
If it's the same one, then yes, I didn't think of it somehow )) But I foresee a lot of problems with users, most of them are below the plinth level.
Well, I don't know). I have been approached many times by people asking how to use my panels in the tester. For many people this question is relevant. And if I had not left MT4, I could easily help them. As for MT5, I assume that such a scheme will not work. But I have not checked it.
In general, there is a demand for panels trading in the tester. And it is strange that with such a level of programming power of forum members, no one has occupied an empty niche)).
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I have a similar thing. But the problem is that you don't get the information all the time, as many times the event is missed/forgotten/not happening.
For such cases, I have a ChartChanged() function in this library, which forcibly updates all the chart parameters. I mainly use it in the tester mode.
Yeah of course, right decision. I even transfer all the buffered values to the indicators and no indicator never uses any ChartGetWhatever function. Its all just hell of work to create all these workarounds and it took me months to figure out that the parallel access of any Chart values from EA and indicators is the reason for freezes of the whole MT terminal.
A pity.MQL is simply highly critical when its getting complex. Its a fact and I would wish so much, that MQ would offer to cooperate with professionals like us. But thats just a wish. For quite a while I was in contact with Renat directly, but from some time, he simply didn´t reply anymore at all.
Long term, the only way out of this is to develop whatever is possible in C# and (mis)use MQL as a host to exchange data and receive commands from C#. This is what I am working on in the meanwhile and its the most stable solution. The pipes are written in native C and I can choose between sycnhronous and asynchronous transfer. All visual stuff is executed in a separate thread. Funfact: It takes 20 microseconds to convert the whole metrics data plus all colors into a byte stream, 10 microseconds to transfer, 20 microseconds to convert the data back to a structure in C# - but 1.000 times more to execute ONE ChartGetInteger() function in MQL plus same time again in timer just to check. That is a massive bottleneck and nothing in CCanvas, as nice as it is, can make that up.
All u can do with CCanvas, can then also be done with GDI, since CCanvas is 1:1 the same basis anyway. And with some tricks, you can use the C# Graphics GDI functions to write directly into the same array - also async in another thread without sending back the bitmap first.
In the long run, the only way out is to develop everything possible in C# and (incorrectly) use MQL as a host to exchange data and get commands from C#.
for drawing in Canvas
you can use cairo https://cairographics.org/, take as surface (initial, the same as in Canvas) an array of pixels, format ARGB32 and go with a song....
Here is an example, but through a separate DLL. To write #import to API cairo_XXX honestly lazy.
MQL:
C
H
and the result of course :
but the approach will not work for a dying market :-))
But it closes a lot of problems and even raises the question of whether Canvas is necessary...if you can draw on a ready array of pixels with a normal stable, mature library.
to draw in Canvas
you can use cairo https://cairographics.org/, take as surface (initial, the same as in Canvas) an array of pixels, format ARGB32 and go with a song...
Here is an example, but through a separate DLL. To write #import to the API cairo_XXX honestly lazy.
MQL:
C
H
and the result of course :
but the approach won't work for a dying market :-)
But it closes a lot of problems. and even raises the question whether Canvas is necessary...if you can draw on a ready array of pixels with a normal stable, mature library.
Actually I was aiming initially at Blend2D https://blend2d.com but there are no ready binary packages with it for win, and I couldn't build it from sorts (some cmake tricks are like that).
The principle of use is the same (you can also provide a pixel array and use it to drive), but B2D is more optimised than cairo and it is multithreaded.
If I get my hands on it next weekend, I'll tell you how to use it.
Through the resource you can transfer a large amount of information from the tester to the Expert Advisor on the chart and trade with the panel by hand too. The system is certainly more complex than checking the states of buttons of the "dead" panel in the tester, but the possibilities are much greater.
Such a tandem cannot be sold on the Market. And the level of buyers there is not very good for such complexities. I often meet complaints like:
- I bought an Expert Advisor for MT5, but it does not work under MT4, how can I fix it?
to draw in Canvas
you can use cairo https://cairographics.org/, take as surface (initial, the same as in Canvas) an array of pixels, format ARGB32 and go with a song...
Here is an example, but through a separate DLL. To write #import to the API cairo_XXX honestly lazy.
MQL:
C
H
and the result of course :
but the approach won't work for a dying market :-)
But it closes a lot of problems. and even raises the question whether Canvas is necessary...if you can draw on a ready array of pixels with a normal stable, mature library.
and without external additional DLL, exclusively API cairographics.org
draws :-) WORKS !!!
You can't sell a tandem like this on the Market.
...
If it is the same one, then yes, I didn't think of it somehow ))) But I foresee a lot of problems with users, most of them are below the plinth level.
If it's the same one, then yes, I didn't think of it somehow )) But I foresee a lot of problems with users, most of them are below the plinth level.