Drawing a different Currency Candles in indicator window

 
I am trying to draw Candles of a different currency pair inside the Indicator_separate_window , but its Not drawing correctly , can someone please point to what I am doing wrong here:

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 clrYellow
#property indicator_color2 clrBlue
#property indicator_color3 clrYellow
#property indicator_color4 clrBlue
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 3
#property indicator_width4 3 

double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[]; 

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnInit()
   {
    SetIndexStyle(0, DRAW_HISTOGRAM);
    SetIndexBuffer(0, Buffer1);
    SetIndexStyle(1, DRAW_HISTOGRAM);
    SetIndexBuffer(1, Buffer2);
    SetIndexStyle(2, DRAW_HISTOGRAM);
    SetIndexBuffer(2, Buffer3);
    SetIndexStyle(3, DRAW_HISTOGRAM);
    SetIndexBuffer(3, Buffer4);
   }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
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[])
   {
    double o, h, l, c;
    string symbol = "EURUSD";
    for(int i = 0; i < Bars - 1; i++)
       {
        c = iClose(symbol, PERIOD_CURRENT, i);
        o =  iOpen(symbol, PERIOD_CURRENT, i);
        h =  iHigh(symbol, PERIOD_CURRENT, i);
        l =   iLow(symbol, PERIOD_CURRENT, i);
        Buffer1[i] = h;
        Buffer2[i] = l;
        Buffer3[i] = o;
        Buffer4[i] = c;
       }
    return rates_total;
   }
//+------------------------------------------------------------------+ 

This is what it draws: 


Looks nothing like a Candle and more like a Line with infinite low Price

 

"DRAW_HISTOGRAM" works differently for "indicator_separate_window" than it does for "indicator_chart_window".

On "indicator_chart_window", it fills between two buffer values, but on " "indicator_separate_window" it always fills between the zero level and the buffer value.

To simulate candles, you will have to use another histogram to "paint" over it with the background colour.

The following example from the CodeBase may help you understand the concept:

Code Base

Renko Charts

Collector, 2006.10.16 10:23

The Renko charting method is thought to have acquired its name from "renga" which is the Japanese word for bricks.
 

In the chart window, histograms are drawn via pairs of buffers. If the first is higher than the second, it uses the first's color.

In a separate window, histograms are drawn from the buffer value to zero. They are drawn from the first to the last. If you want one to be the background, it must be the first buffer.

See also
          How to Draw Cnadle chart in indicator_separate_window ? (XDXD) - MQL4 programming forum (2016)

Reason: