Corridor





//+---------------------------------------------------------------------+
//|                                              Corridor.mq4           |
//|                                         Copyright © Trofimov 2009   |
//+---------------------------------------------------------------------+
//| Êîðèäîð                                                             |
//|                                                                     |
//| Àâòîðñêîå ïðàâî ïðèíàäëåæèò Òðîôèìîâó Åâãåíèþ Âèòàëüåâè÷ó, 2009     |
//+---------------------------------------------------------------------+


#property copyright "Copyright © Trofimov Evgeniy Vitalyevich, 2009"
#property link      "http://TrofimovVBA.narod.ru/"

//---- Ñâîéñòâà èíäèêàòîðà
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Black
#property indicator_width1 1
#property indicator_color2 Black
#property indicator_width2 1

//---- Âõîäÿùèå ïàðàìåòðû
extern int MyPeriod=12;

double Buff_line1[];
double Buff_line2[];
string Shortname;

//+------------------------------------------------------------------+
//|                Ôóíêöèÿ èíèöèàëèçàöèè èíäèêàòîðà                  |
//+------------------------------------------------------------------+
int init() {
   IndicatorBuffers(2);
   IndicatorDigits(Digits); 
//---- ïàðàìåòðû ðèñîâàíèÿ (óñòàíîâêà íà÷àëüíîãî áàðà)
   SetIndexDrawBegin(0,MyPeriod);
//---- x ðàñïðåäåëåííûõ áóôåðà èíäèêàòîðà
   SetIndexBuffer(0,Buff_line1);
   SetIndexLabel(0,"UpCorridor");
   SetIndexBuffer(1,Buff_line2);
   SetIndexLabel(1,"DnCorridor");
//---- èìÿ èíäèêàòîðà è ïîäñêàçêè äëÿ ëèíèé
   Shortname="Corridor("+MyPeriod+")";
   IndicatorShortName(Shortname);
   return(0);
  }
//+------------------------------------------------------------------+
//|                Ôóíêöèÿ èíäèêàòîðà                                |
//+------------------------------------------------------------------+
int start() {
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   limit=Bars-counted_bars-1;
//---- îñíîâíûå ïåðåìåííûå
   double B, Hbid, Lbid;
//---- îñíîâíîé öèêë
   for(int t=limit; t>0; t--) {
      Buff_line1[t]=High[iHighest(NULL,0,MODE_HIGH,MyPeriod,t)];
      Buff_line2[t]= Low[iLowest (NULL,0,MODE_LOW, MyPeriod,t)];
      if(t==1) {
         Buff_line1[0]=Buff_line1[1];
         Buff_line2[0]=Buff_line2[1];
      }
   }//Next t
   return(0);
}
//+------------------------------------------------------------------+





Sample





Analysis



Market Information Used:

Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar


Indicator Curves created:



Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: