AvalsLevels





//+------------------------------------------------------------------+
//|                                                  AvalsLevels.mq4 |
//|                               Copyright © 2006, Âÿ÷åñëàâ Ñóâîðîâ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Âÿ÷åñëàâ Ñóâîðîâ"

#property indicator_chart_window
#property indicator_buffers 2

#property indicator_color1 Blue 
#property indicator_style2 STYLE_DASH
#property indicator_color3 Red
#property indicator_style4 STYLE_DASH

double topband2[]; 
double botband2[]; 
double pogreha=5;

//---- input parameters
extern int       SpeedLineMin=5;
int init()
  {
   IndicatorBuffers(2); 
    
   SetIndexBuffer(0,topband2); 
   SetIndexStyle(0, DRAW_LINE, STYLE_DASH, 1, Blue); 
   SetIndexDrawBegin(0,3); 
   SetIndexLabel(0,"SPEEDUP");  

   SetIndexBuffer(1,botband2); 
   SetIndexStyle(1, DRAW_LINE, STYLE_DASH, 1, Red); 
   SetIndexDrawBegin(1,3); 
   SetIndexLabel(1,"SPEEDDOWN");  
   
//---- indicators
//----
   return(0);
  }
int start()
  {
  double Max=High[Highest(NULL,0,MODE_HIGH,Bars-1,0)];  
  int Basis,sh;
  bool sign;
  double d1,Dist;
   int i=iBars(NULL,PERIOD_D1);
   double Maxx=High[iHighest(NULL,PERIOD_D1,MODE_HIGH,i,0)];  
   double tops[]; 
   double bots[];     
   int   counted_bars=IndicatorCounted(); 
   double lasttop=High[counted_bars];
   double lastbot=Low[counted_bars];
   ArrayResize(tops,0);   
   ArrayResize(bots,0);   

   lasttop=High[counted_bars];
   lastbot=Low[counted_bars];
  
   i=Bars-IndicatorCounted();
   while (i>=0){     
     Basis=i;
     if (Close[i]>=Open[i]){         //UP
       sign=false;
       while((i>=0) && (!sign)){
         while ((ArraySize(tops)>0) && (High[i]>=tops[ArraySize(tops)-1])) ArrayResize(tops,ArraySize(tops)-1);
         while ((ArraySize(bots)>0) && (Low[i]<=bots[ArraySize(bots)-1])) ArrayResize(bots,ArraySize(bots)-1);         
         topband2[i]=tops[ArraySize(tops)-1];
         if (topband2[i]==0) topband2[i]=Max;
         botband2[i]=bots[ArraySize(bots)-1];
         i--;
         if ((High[i]>High[i+1]) && (Low[i]>Low[i+1]) && (Close[i]>Open[i])) sign=false; else sign=true;         
       }//while
       d1= MathMin(High[Basis+1],High[Basis+2]);
       d1= MathMin(d1,High[Basis]);       
       Dist=(High[i+1]-d1)/Point;
       if (Dist>=SpeedLineMin) {
         ArrayResize(bots,ArraySize(bots)+1);
         bots[ArraySize(bots)-1]=d1;         
       }//if       
     } else {
       sign=false;
       while((i>=0) && (!sign)){
         while ((ArraySize(tops)>0) && (High[i]>=tops[ArraySize(tops)-1])) ArrayResize(tops,ArraySize(tops)-1);
         while ((ArraySize(bots)>0) && (Low[i]<=bots[ArraySize(bots)-1])) ArrayResize(bots,ArraySize(bots)-1);         
         topband2[i]=tops[ArraySize(tops)-1];
         if (topband2[i]==0) topband2[i]=Max;
         botband2[i]=bots[ArraySize(bots)-1];
         i--;
         if ((Low[i]<Low[i+1]) && (High[i]<High[i+1]) && (Close[i]<Open[i])) sign=false; else sign=true;         
       }//while
       d1=0;
       d1= MathMax(Low[Basis+1],Low[Basis+2]);
       d1= MathMax(d1,Low[Basis]);       
       Dist=(d1-Low[i+1])/Point;
       if (Dist>=SpeedLineMin) {
         ArrayResize(tops,ArraySize(tops)+1);
         tops[ArraySize(tops)-1]=d1;         
       }//if            
     }            
   }//while   
   return(0);
  }
int deinit()
{ 
  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
Series array that contains close prices for each bar
Series array that contains open prices of each bar


Indicator Curves created:


Implements a curve of type DRAW_LINE

Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: