MAFRACTALS





//+------------------------------------------------------------------+
//|                                                   MAFRACTALS.mq4 |
//|                             Copyright © 2009, Victor Chebotariov |
//+----[ ICQ ]-------------------------------------------------------+
//|   342-574-15                                                     |
//+----[ Phone ]-----------------------------------------------------+
//|   +380958965042                                                  |
//|   +380652707069                                                  |
//|   +380443609960                                                  |
//+----[ Web ]-------------------------------------------------------+
//|   http://chebotariov.com                                         |
//|   http://chebotariov.co.ua                                       |
//|   http://amero.com.ua                                            |
//|   http://amero.co.ua                                             |
//|   http://investmoney.kiev.ua                                     |
//|   http://riskinvest.kiev.ua                                      |
//|   http://tetrabourse.com.ua                                      |
//|   http://tb-unitrade.com.ua                                      |
//|   http://i-contact.kiev.ua                                       |
//|   http://srubidom.com                                            |
//+----[ E-mail ]----------------------------------------------------+
//|   victor@chebotariov.co.ua                                       |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Victor Chebotariov"
#property link      "http://www.chebotariov.com"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- input parameters
extern int period=14;
extern int shift=4;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW,EMPTY,1);
   SetIndexArrow(0,234);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_ARROW,EMPTY,1);
   SetIndexArrow(1,233);
   SetIndexBuffer(1,ExtMapBuffer2);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| MAFRACTALS                                                       |
//+------------------------------------------------------------------+
int start()
  {
   int i,counted_bars=IndicatorCounted();
//----
   i=Bars-counted_bars-1;
   while(i>=0)
     {
      if(shift<3)
         {
            shift=3;
         }
      double ma = iMA(NULL,0,period,0,0,0,i);
      double ma1 = iMA(NULL,0,period,0,0,0,i+shift);
      double ma2 = iMA(NULL,0,period,0,0,0,i+shift*2-1);
      
      if(ma<ma1 && ma1>ma2)
         {
            ExtMapBuffer1[i+shift] = High[i+shift];
         }
      if(ma>ma1 && ma1<ma2)
         {
            ExtMapBuffer2[i+shift] = Low[i+shift];
         }

      i--;
     }
//----
   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:

Implements a curve of type DRAW_ARROW


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: