Adding Histogram to a Chart

 

I was wondering how we can draw histogram on the chart or rather cover the candles with a specific colour. For example I'm trying to cover white candles with the green colour when the white candle is longer than 15 pips. Here is the code I've written and I don't know what's wrong with it. Any ideas?

//+------------------------------------------------------------------+

//| Colour_White.mq4 |

//+------------------------------------------------------------------+

#property copyright "Alireza Parsai"

#property link "http://www.cadpanel.com"

#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 Green

//---- input parameters

extern double Span=15.0;

//---- buffers

double ExtMapBuffer1[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_HISTOGRAM, 0, 2, Green);

SetIndexBuffer(0,ExtMapBuffer1);

//SetIndexDrawBegin(0,10);

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

int counted_bars=IndicatorCounted();

//----

if (counted_bars<0)

return(-1);

else counted_bars--;

int i=Bars-counted_bars;

while (i>=0)

{

double _close, _open, _difference;

_close=Close;

_open=Open;

_difference=_close-_open;

if ((_difference>0)&&(_difference>Span*Point))

{

ExtMapBuffer1=_open;

Comment("Bar Lenght:",ExtMapBuffer1);

}

else ExtMapBuffer1=0.0;

i--;

}

//----

return(0);

}

//+------------------------------------------------------------------+

Thanks in advance

 

Is there anybody out there to help me with this issue.

 

Does anybody want to help this guy??

 
iscuba11:
Does anybody want to help this guy??

Wait 5 min...

Raff

 
raff1410:
Wait 5 min... Raff

if close-open > pips = yellow candle

if close-open < pips = blue candle

if HiLo = true then it repaint canle if high-low > or < pips

Raff

Files:
Reason: