fractals_Takbir_m





//+------------------------------------------------------------------+
//|                                                                  |
//|                 Copyright © 1999-2008, MetaQuotes Software Corp. |
//|                                         http://www.metaquotes.ru |
//+------------------------------------------------------------------+
#property copyright "© 2007 Takbir"
#property link      "www.stigal.com"
//----
#define major   1
#define minor   1
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_color2 OrangeRed
#property indicator_width1  0
#property indicator_width2  0
//----
double UpperFr[];
double LowerFr[];
//----
extern int Bars.left  =2;
extern int Bars.right =2;
extern double signalGap =1.1;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void init()
  {
   SetIndexBuffer(0, UpperFr);
   SetIndexBuffer(1, LowerFr);
   //
   SetIndexEmptyValue(0, 0);
   SetIndexEmptyValue(1, 0);
   //
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexArrow(0, 158);
   //
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 158);
   
   SetIndexLabel(0,"UpFr("+Bars.left+","+Bars.right+")");
   SetIndexLabel(1,"DnFr("+Bars.left+","+Bars.right+")");

   
   
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void start()
  {
   int counted=IndicatorCounted();
   if (counted < 0) return(-1);
   if (counted > 0) counted--;
   int limit=Bars-counted;
//-----
   double dy=0;
     for(int i=1; i<=20; i++) 
     {
      dy+=0.3*(High[i]-Low[i])/20;
     }
   for(i=1+Bars.right; i<=limit+Bars.left; i++)
     {
      UpperFr[i]=0;
      LowerFr[i]=0;
//----
      if (IsUpperFr(i)) UpperFr[i]=High[i] + dy*signalGap;
      if (IsLowerFr(i)) LowerFr[i]=Low[i] - dy*signalGap;
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool IsUpperFr(int bar)
  {
   for(int i=1; i<=Bars.left; i++)
     {
      if (bar+i>=Bars) return(false);

      if (High[bar] < High[bar+i]) return(false);
     }
   for(i=1; i<=Bars.right; i++)
     {
      if (bar-i < 0) return(false);
      if (High[bar] < High[bar-i]) return(false);
     }
//----
   return(true);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool IsLowerFr(int bar)
  {
   for(int i=1; i<=Bars.left; i++)
     {
      if (bar+i>=Bars) return(false);
      if (Low[bar] > Low[bar+i]) return(false);
     }
   for(i=1; i<=Bars.right; i++)
     {
      if (bar-i < 0) return(false);
      if (Low[bar] > Low[bar-i]) return(false);
     }
//----
   return(true);
  }
//+------------------------------------------------------------------+



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:


Implements a curve of type DRAW_ARROW

Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: