Help: how to show Text or Label foreground in MT5

 

In MT5, when using channel indicators like Bollinger Bands that fill the space between the bands with color, any text labels or objects placed over the indicator are hidden behind the filled channel bands (See below an example image). However, in MT4, text labels and objects can be placed in the foreground over the filled indicator bands without being obscured.

How can I configure M5 so that text labels and objects are always rendered in the foreground? I would like the text and objects to display prominently without being hidden behind the filled channel bands like they do in MT4. 


 

Here you have the list of available object functions: https://www.mql5.com/en/docs/objects.

Here you have the chart functions to set things like fore- and background: https://www.mql5.com/en/docs/chart_operations/chartsetinteger

Documentation on MQL5: Object Functions
Documentation on MQL5: Object Functions
  • www.mql5.com
Object Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
happyleo: However, in MT4, text labels and objects can be placed in the foreground over the filled indicator bands without being obscured.
There are no filled bands in MT4.
 
happyleo:

In MT5, when using channel indicators like Bollinger Bands that fill the space between the bands with color, any text labels or objects placed over the indicator are hidden behind the filled channel bands (See below an example image). However, in MT4, text labels and objects can be placed in the foreground over the filled indicator bands without being obscured.

How can I configure M5 so that text labels and objects are always rendered in the foreground? I would like the text and objects to display prominently without being hidden behind the filled channel bands like they do in MT4. 

Try 

ObjectSetInteger(ChartID(),name,OBJPROP_BACK,false);
 

Carl and Lorentzos, thanks for your feedback. 

William, MT4 also has indicators with filled channel bands. The key difference is that in MT4, text labels and objects are drawn in the foreground by default, so they display prominently over the filled bands without being obscured. See attached an example image - the text labels A, B, C render cleanly over the filled indicator bands.

I believe this issue is specific to MT5 on how it handles object layering and foreground/background rendering. I'm looking for is to configure MT5 to mimic MT4 - where text and objects are always drawn in the foreground layer above the filled indicator bands.


 

happyleo #William, MT4 also has indicators with filled channel bands. The key difference is that in MT4, text labels and objects are drawn in the foreground by default, so they display prominently over the filled bands without being obscured. See attached an example image - the text labels A, B, C render cleanly over the filled indicator bands.

I think you seem to be misunderstanding something.

Unlike in MT5, in MT4 there is no "fill" in the real sense of the word. It is simulated using a "histogram" style.

In the MT5, there is an actual "fill" plot style, a painted area (filled channel)DRAW_FILLING.

Also, you seem to be ignoring the advice given by Carl Schreiber's post .

Documentation on MQL5: Custom Indicators / Indicator Styles in Examples / DRAW_FILLING
Documentation on MQL5: Custom Indicators / Indicator Styles in Examples / DRAW_FILLING
  • www.mql5.com
DRAW_FILLING - Indicator Styles in Examples - Custom Indicators - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
happyleo #:

Carl and Lorentzos, thanks for your feedback. 

William, MT4 also has indicators with filled channel bands. The key difference is that in MT4, text labels and objects are drawn in the foreground by default, so they display prominently over the filled bands without being obscured. See attached an example image - the text labels A, B, C render cleanly over the filled indicator bands.

I believe this issue is specific to MT5 on how it handles object layering and foreground/background rendering. I'm looking for is to configure MT5 to mimic MT4 - where text and objects are always drawn in the foreground layer above the filled indicator bands.


This happens and your object properties (right click) has this unselected ?

the texts are not under the histogram bars when you uncheck that parameter 

 

 
Fernando Carreiro #:

I think you seem to be misunderstanding something.

Unlike in MT5, in MT4 there is no "fill" in the real sense of the word. It is simulated using a "histogram" style.

In the MT5, there is an actual "fill" plot style, a painted area (filled channel)DRAW_FILLING.

Also, you seem to be ignoring the advice given by Carl Schreiber's post .

Thank you for explaining the difference between MT4's simulated histogram fill and MT5's true fill plot. 

Please excuse my ignorance as a non-programmer. I don't intend to ignore the advice from Carl and others, I just need some time to learn and figure out how to follow the suggestions properly.

 
Lorentzos Roussos #:

This happens and your object properties (right click) has this unselected ?

the texts are not under the histogram bars when you uncheck that parameter 

 

I tried that, and it does not work.
 
happyleo #:
I tried that, and it does not work.

It could be a canvas output

If you open the data window can you see the indicator buffer values ?

 
Lorentzos Roussos #:

It could be a canvas output

If you open the data window can you see the indicator buffer values ?

I think you are right.

I have just tested the original indicator which used "DRAW_FILLING", and it allows the text to be shown in the foreground with no issues.

The problem occurred when I modified the indicator to use DRAW_HISTOGRAM2 instead. With this histogram style, the text gets obscured behind the fill color and cannot be shown in the foreground layer.

Please find attached the indicator file I modified. 

Thanks.

Files:
Reason: