Help: how to show Text or Label foreground in MT5 - page 2

 
happyleo #:

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.

hmm i'm using DRAW_HISTOGRAM_2 in my test too and it works 

#property version   "1.00"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_plots   2
//--- plot Up
#property indicator_label1  "Up"
#property indicator_type1   DRAW_HISTOGRAM2
#property indicator_color1  clrSteelBlue
#property indicator_style1  STYLE_SOLID
#property indicator_width1  3
//--- plot Dw
#property indicator_label2  "Dw"
#property indicator_type2   DRAW_HISTOGRAM2
#property indicator_color2  clrMediumVioletRed
#property indicator_style2  STYLE_SOLID
#property indicator_width2  3
//--- indicator buffers
double         UpBuffer1[];
double         UpBuffer2[];
double         DwBuffer1[];
double         DwBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,UpBuffer1,INDICATOR_DATA);
   SetIndexBuffer(1,UpBuffer2,INDICATOR_DATA);
   SetIndexBuffer(2,DwBuffer1,INDICATOR_DATA);
   SetIndexBuffer(3,DwBuffer2,INDICATOR_DATA);
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
  for(int i=prev_calculated;i<rates_total;i++){
  double m=(open[i]+close[i])/2.0;
  UpBuffer1[i]=high[i];
  UpBuffer2[i]=m;
  DwBuffer1[i]=m;
  DwBuffer2[i]=low[i];
  }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
 
Lorentzos, thank you for the indicator example. Unfortunately it does not resolve the foreground issue on my system - the text still gets hidden behind the filled bands.

BTW - in MT4 with "chart on foreground" enabled, the text is not obscured by fills or candles. However in MT5, the text gets hidden behind both fills and candles. 

Please see the screenshot showing how the text is obscured on my MT5 chart.



 
happyleo #:
Lorentzos, thank you for the indicator example. Unfortunately it does not resolve the foreground issue on my system - the text still gets hidden behind the filled bands.

BTW - in MT4 with "chart on foreground" enabled, the text is not obscured by fills or candles. However in MT5, the text gets hidden behind both fills and candles. 

Please see the screenshot showing how the text is obscured on my MT5 chart.



So you want the bars to be over the indicator display and the text to be over everything 

 
Lorentzos Roussos #:

So you want the bars to be over the indicator display and the text to be over everything 

Yes, that is exactly what I want, which is what MT4 does.