How to fix flickering bitmap when updating its size accordingly? - page 2

 
Nikolai Semko #:
It's a shame that you don't read the answers to your questions.  ChartTimePriceToXY!!!

I strongly doubt that it's the issue on such a simple code.

 
Agustinus Biotamalo Lumbantoruan #:

Sure, please watch it here https://gemoo.com/tools/upload-video/share/569644129862852608?codeId=DGqjl3Veg12Xb&card=569644126134116352

Your link gives nothing.


 
Nikolai Semko #:
It's a shame that you don't read the answers to your questions.  ChartTimePriceToXY!!!


Hi Nikolai, I tried to copy paste your library into the code.

THen i use _X and _Y function of yours as you've suggested earlier. Then I don't see the canvas object on the chart

Please advise, Thanks

The code is attached. Apparently, I can't post a comment as it's over 64000 characters.

So attached it instead

Files:
pie.mq5  81 kb
 
Alain Verleyen #:

Your link gives nothing.


My apology

Ok I have upload it to youtube

https://youtu.be/9N9EuwMfTmI

 
Agustinus Biotamalo Lumbantoruan #:

My apology

Ok I have upload it to youtube

https://youtu.be/9N9EuwMfTmI

See here how to get the chart properties and calculate the coordinates. The example shows channels but you can draw whatever you want using the same methods.

Canvas based indicators: Filling channels with transparency
Canvas based indicators: Filling channels with transparency
  • www.mql5.com
In this article I'll introduce a method for creating custom indicators whose drawings are made using the class CCanvas from standard library and see charts properties for coordinates conversion. I'll approach specially indicators which need to fill the area between two lines using transparency.
 
Alain Verleyen #:

I strongly doubt that it's the issue on such a simple code.

This can be easily verified through profiling.
 
Nikolai Semko #:
This can be easily verified through profiling.

Yes and it's NOT the reason. you should check yourself.

Try my version posted here https://www.mql5.com/en/forum/455324#comment_49799962

I fixed one of the two and you will see that one is flickering and the other, which I fixed, not. Still using ChartTimePriceToXY().

 
Alain Verleyen #:

Yes and it's NOT the reason. you should check yourself.

Try my version posted here https://www.mql5.com/en/forum/455324#comment_49799962

I fixed one of the two and you will see that one is flickering and the other, which I fixed, not. Still using ChartTimePriceToXY().

Alain, I was not lazy and checked.
The check showed that the reason is ChartTimePriceToXY.
Your code is running with flickering due to frequent use of ChartTimePriceToXY. My code doesn't flicker.


 
Agustinus Biotamalo Lumbantoruan #:

Yes I did, I'm sorry I didn't respond. Because I don't know what are the alternative to ChartTimePriceToXY. It's also because MQL5 shop wouldn't allow to upload & sell an indicator that includes external library other than MQL5's default lib files in the include folder. Right?

Firstly, the Market does not allow you to download dll libraries. There are no problems with mqh libraries.

Secondly, it's better not to use my library, as it does a lot of unnecessary things for you. But it won’t be difficult for a programmer to see how to replace ChartTimePriceToXY and create his own library or function. When each CHARTEVENT_CHART_CHANGE event occurs (not more often), it is necessary to save your own table of chart characteristics, and then, if necessary, use this table to calculate XY coordinates from Time-Price coordinates (and vice versa).

 
Agustinus Biotamalo Lumbantoruan #:


Hi Nikolai, I tried to copy paste your library into the code.

THen i use _X and _Y function of yours as you've suggested earlier. Then I don't see the canvas object on the chart

Please advise, Thanks

The code is attached. Apparently, I can't post a comment as it's over 64000 characters.

So attached it instead

I couldn't run your code because of an error (array out of range in 'Ex.mq5' (143,31)). When I bypassed this error, nothing is displayed.