//+------------------------------------------------------------------+
//|                                              ytg_Day_Channel.mq4 |
//|                                               Yuriy Tokman (YTG) |
//|                                         http://www.mql-design.ru |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman (YTG)"
#property link      "http://www.mql-design.ru"
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_width1 2
#property indicator_width2 2
extern int bars_limit = 5000;
extern string __________________ = "_________________________";
extern string Copyright = "Yuriy Tokman";
extern string ÏÈØÓ_ÍÀ_ÇÀÊÀÇ_ÝÊÑÏÅÐÒÛ = "ÈÍÄÈÊÀÒÎÐÛ_ÑÊÐÈÏÒÛ";
extern string e_mail = "yuriytokman@gmail.com";
extern string Skype = "yuriy.t.g";
double B0[];
double B1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,B0);
   SetIndexLabel(0,"UP");   
      
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,B1);
   SetIndexLabel(1,"DN");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//----
   double h,l,c;
   double _h,_l,_c;
   double h0,l0,c0;
   int limit;int b;
   int counted_bars=IndicatorCounted();   
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   if(limit>bars_limit)limit=bars_limit;
   
   for(int i=0; i<limit; i++)
   {
    b = iBarShift(Symbol(),1440,Time[i]); 
    h = iHigh(Symbol(),1440,b+1);
    l = iLow(Symbol(),1440,b+1);
    c = iClose(Symbol(),1440,b+1);
    
    h0 = iHigh(Symbol(),1440,b);
    l0 = iLow(Symbol(),1440,b);
    c0 = iClose(Symbol(),1440,b);
    
    if(h0>h || l0<l){_h=h0;_l=l0;_c=c0;}
    else {_h=h;_l=l;c=_c;}
    
    B0[i] = _h;
    B1[i] = _l;           
   }      
//----
   return(0);
  }
//+------------------------------------------------------------------+
            
Comments