??
Candles do have open, high, low, close, histogram-bars have only their size.
But you can vary the thickness of the histogram bars:
int thick = 2; // 1,2,.,5 SetIndexStyle(3,DRAW_HISTOGRAM,EMPTY,thick ,clrRed);
sir:
when draw costum indicator in DRAW_HISTOGRAM, it is drawn in candles.
how to draw it in stck mode ?
DRAW_HISTOGRAM does not work for me in the main window either.
I don't know why that should be. Do you realise that you need 2 buffers to draw a Histogram when 1 value does not equal 0?
Here is a simple code. Note that you may need to change to a line chart to be able to see it
//+------------------------------------------------------------------+ //| Histo.mq4 | //| GumRai | //| none | //+------------------------------------------------------------------+ #property copyright "GumRai" #property link "none" #property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 2 #property indicator_plots 2 //--- plot one #property indicator_label1 "one" #property indicator_type1 DRAW_HISTOGRAM #property indicator_color1 clrDodgerBlue #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot two #property indicator_label2 "two" #property indicator_type2 DRAW_HISTOGRAM #property indicator_color2 clrDodgerBlue #property indicator_style2 STYLE_SOLID #property indicator_width2 1 //--- indicator buffers double oneBuffer[]; double twoBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,oneBuffer); SetIndexBuffer(1,twoBuffer); //--- 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[]) { int x; if(prev_calculated==0) x=rates_total-1; else x=rates_total-prev_calculated+1; for(;x>=0;x--) { oneBuffer[x]=High[x]; twoBuffer[x]=Low[x]; } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+
what I need is such stick drawn with indicator: no such STYLE ?
For this you have to set the properties of the chart, so everything will be that way!
try (in OnInit()?):
long handle=ChartID(); if(handle>0) ChartSetInteger(handle,CHART_MODE,CHART_BARS);
I don't know why that should be. Do you realise that you need 2 buffers to draw a Histogram when 1 value does not equal 0?
...
Sorry, I only said it did not work for me.
It works with MQL5, by the way.
And you can even see it on MT4, too, if you confuse the chart layout by adding and removing indicators.
And finally, two buffers is not a big problem, when you have 512 at disposal.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
sir:
when draw costum indicator in DRAW_HISTOGRAM, it is drawn in candles.
how to draw it in stck mode ?