Download MetaTrader 5

Histogram Width can not be affected. Please help

To add comments, please log in or register
stitchtrader
136
stitchtrader  

Hi, 

I wrote the following code. But the width setting of Histogram (#property indicator_width1  4) could not affect.

Please tell me why. How can I make it?

Thanks! 

I need the feature to make a simple candlestick indicator like the image working with MT4.

 

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   1
#property indicator_type1   DRAW_HISTOGRAM2
#property indicator_color1  clrBlue
#property indicator_width1  4

double HighBuffer[];
double LowBuffer[];

int OnInit()
  {
  SetIndexBuffer(0, HighBuffer, INDICATOR_DATA);
  SetIndexBuffer(1, LowBuffer, INDICATOR_DATA);
  return(INIT_SUCCEEDED);
  }

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[])
  {
   int start = 0;  if(prev_calculated > 0)  start = prev_calculated - 1;
   for(int i=start; i<rates_total; i++)
     {
      HighBuffer[i] = high[i];
      LowBuffer[i] = low[i];
     }
  return(rates_total);
  }

 

testhistogram.mq5 with MT5

testhistogram with MT4 

MT4 

MT4 default

Files:
Alain Verleyen
Moderator
32811
Alain Verleyen  
stitchtrader:

Hi, 

I wrote the following code. But the width setting of Histogram (#property indicator_width1  4) could not affect.

Please tell me why. How can I make it?

Thanks! 

I need the feature to make a simple candlestick indicator like the image working with MT4.

Seems like you can't set a width larger than the actual candles. I don't know if it's a bug or a feature ;-)

You can write to ServiceDesk to report this and obtain a definitive answer.

Get in touch with developers using Service Desk!
Get in touch with developers using Service Desk!
  • www.mql5.com
We therefore attach great importance to all user reports about issues in our programs and try to answer each one of them.
stitchtrader
136
stitchtrader  
angevoyageur:

Seems like you can't set a width larger than the actual candles. I don't know if it's a bug or a feature ;-)

You can write to ServiceDesk to report this and obtain a definitive answer.

Hi Alain,

Thank you so much :)

I have reported this to ServiceDesk. I look forward to hear from them.

I think it is a very important feature, so I 'll go back to MT4.

Hoping that they'll fix it soon!

Slava
Moderator
6961
Slava  

Why "cannot be affected"?

I see difference between

#property indicator_width1  4

and

#property indicator_width1  3
stitchtrader
136
stitchtrader  

Hi Slawa,

Thanks for your comment :)

That's right.  Sorry for my bad English. Seems like there are differences among width 1~3.  

But MT5 can't delineate width 4 or above for now, though MT4 can do that -

Width 4 with MT4

Alain Verleyen
Moderator
32811
Alain Verleyen  
stringo:

Why "cannot be affected"?

I see difference between

and

You see the difference only if histogram width is <= candle width.
Slava
Moderator
6961
Slava  
angevoyageur:
You see the difference only if histogram width is <= candle width.

I know how histogram is drawn.

Definitely there is difference between MT4 and MT5. As designed.

Definitely this is first complaint about histogram drawing. What should we do?

BTW there is special style DRAW_CANDLES

stitchtrader
136
stitchtrader  
MT4 Less space
To add comments, please log in or register