colorbars mt5 indicator - how to draw non-gap bars
karlson3:
Hi, how to get the below metaquotes indicator to draw bars without gaps ? where all "open" equals to previous "close". Can someone please help on this
#property indicator_color1 clrGreen, clrRed #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //#property indicator_label1 "Open;High;Low;Close"
{
//--- auxiliary variables
int i = 0;
//bool vol_up=true;
//--- set position for beginning
if(0 < prev_calculated)
i = prev_calculated - 1;
else
{
ExtOpenBuffer[i] = open[i];
ExtHighBuffer[i] = high[i];
ExtLowBuffer[i] = low[i];
ExtCloseBuffer[i] = close[i];
i = 1;
}
//--- start calculations
while(i < rates_total && !IsStopped())
{
ExtOpenBuffer[i] = close[i - 1];
ExtHighBuffer[i] = high[i];
ExtLowBuffer[i] = low[i];
ExtCloseBuffer[i] = close[i];
//--- define volume change
//if(i>0)
//{
if(tick_volume[i] > tick_volume[i - 1]) ExtColorsBuffer[i] = 0.0;
if(tick_volume[i] < tick_volume[i - 1]) ExtColorsBuffer[i] = 1.0;
// }
//--- set color
//if(vol_up) ExtColorsBuffer[i]=0.0;
//else ExtColorsBuffer[i]=1.0;
//---
i++;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
Nagisa Unada:
Thank you very much!!!!
Hi, how to get the below metaquotes indicator to draw bars without gaps ? where all "open" equals to previous "close". Can someone please help on this