Download MetaTrader 5

Drawing Opaque objects

To add comments, please log in or register
They are already making profit from their signals. Publish your signal and join them!
sd59 2015.10.09 06:27 

Hi all, I need a sanity check on drawing objects on charts. Below is a snapshot of what a rectangle looks like on a chart - the red candles are hidden because they are the same colour as the rectangle fill. Changing chart foreground/background doesn't make any difference.


Question is: How do I draw opaque (non-transparent) objects on charts?

I know about CCanvas class in MQL5 but I am using MQL4.

I have coded up a function which can 'hide' other objects in the shape area to make it appear opaque but it is very cumbersome and not pretty!

Am I missing something here? Is there a standard MQL4 function that does this?


Keith Watford
Keith Watford 2015.10.09 09:46  

I've never understood what goes on with Rectangles. If you set them to background then they are filled with colour. Otherwise,when in the foreground only the border shows.

When filled with colour, if they overlap, the colour mixes.

You can use a rectangle label instead but these are anchored by pixel co-ordinates instead of time and price 

sd59 2015.10.09 11:51  

I'm glad I'm not the only one! Also if draw a thick trend line it covers everything up so why doesn't the rectangle!

Anyway, thank you very much for the suggestion this works perfectly for what I want to do - I just wouldn't have thought of using a label if the rectangle didn't work. 

To add comments, please log in or register