Download MetaTrader 5

Adding Histogram to a Chart

To add comments, please log in or register
Why to sell products in MetaTrader AppStore? Find that out from the article!
Al Parsai
105
Al Parsai 2006.05.16 19:28 

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

Al Parsai
105
Al Parsai 2006.05.17 14:03  

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

iscuba11
631
iscuba11 2006.07.07 17:56  

Does anybody want to help this guy??

raff1410
320
raff1410 2006.07.07 19:03  
iscuba11:
Does anybody want to help this guy??

Wait 5 min...

Raff

raff1410
320
raff1410 2006.07.07 19:51  
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:
To add comments, please log in or register