//+------------------------------------------------------------------+
//|                                                 CandleSample.mq5 |
//+------------------------------------------------------------------+
#property copyright "TheXpert"
#property link      "TheForEXpert@gmail.com"
#property version   "1.00"

#property indicator_separate_window

#property indicator_buffers 4
#property indicator_plots 1

#property indicator_type1 DRAW_CANDLES
#property indicator_color1 Gray

double O[];
double H[];
double L[];
double C[];

void OnInit()
{
   SetIndexBuffer(0, O, INDICATOR_DATA);
   SetIndexBuffer(1, H, INDICATOR_DATA);
   SetIndexBuffer(2, L, INDICATOR_DATA);
   SetIndexBuffer(3, C, INDICATOR_DATA);
}

int OnCalculate(
      const int bars,
      const int counted,
      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[])
{
   ArrayCopy(O, open);
   ArrayCopy(H, high);
   ArrayCopy(L, low);
   ArrayCopy(C, close);
   
   return bars;
}