//+------------------------------------------------------------------+
//|                                                         try.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Try"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_width1 1
#property indicator_width2 1
#property indicator_level1 1


//---- buffers
double try_buff[];
double try_array[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(2);
   SetIndexBuffer(0,try_buff);
   SetIndexBuffer(2,try_array);
   SetIndexDrawBegin(0,try_array);
   SetIndexStyle(0,DRAW_LINE);
   return(0);
  }
//+------------------------------------------------------------------+
//| Indicator iteration function                              |
//+------------------------------------------------------------------+
  int start()
  
    {
     int limit;
     int counted_bars=IndicatorCounted();
  //---- check for possible errors
     if(counted_bars<0) return(-1);
  //---- the last counted bar will be recounted
     if(counted_bars>0) counted_bars--;
     limit=Bars-counted_bars;
  //---- main loop
     for(int i=0; i<limit; i++)
       {
        try_array[i] = (iOpen(Symbol(),PERIOD_H1,i))/(iClose(Symbol(),PERIOD_H1,i));
        try_buff[i]=try_array[i];
       }

  //---- done
     return(0);
    }
//+------------------------------------------------------------------+