Ind-Fractals-alltf-1.1.1(1)





//+------------------------------------------------------------------+
//|                                               Ind-Fractals-1.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

extern string     M0000     = "=====Íàñòðîéêè òàéìôðåéìà=====";
extern bool       TF_M1     = true;
extern bool       TF_M5     = true;
extern bool       TF_M15    = true;
extern bool       TF_M30    = true;
extern bool       TF_H1     = true;
extern bool       TF_H4     = true;
extern bool       TF_D1      = true;

extern string     M0001     = "========Êîëè÷åñòâî äíåé======";
extern int        Nday     = 0;
extern int        discord  = 1; //ñìåùåíèå çíà÷êà ôðàêòàëà (â ïóíêòàõ)
extern bool       Comm     = true;

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Blue
#property indicator_color5 Lime
#property indicator_color6 Lime
#property indicator_color7 Sienna
#property indicator_color8 Sienna
//---- input parameters
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW, EMPTY, 1);
   SetIndexArrow(0,217);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW, EMPTY, 1);
   SetIndexArrow(1,218);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,0.0);
   SetIndexStyle(2,DRAW_ARROW, EMPTY, 1);
   SetIndexArrow(2,217);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexEmptyValue(2,0.0);
   SetIndexStyle(3,DRAW_ARROW, EMPTY, 1);
   SetIndexArrow(3,218);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexEmptyValue(3,0.0);
   SetIndexStyle(4,DRAW_ARROW, EMPTY, 1);
   SetIndexArrow(4,217);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexEmptyValue(4,0.0);
   SetIndexStyle(5,DRAW_ARROW, EMPTY, 1);
   SetIndexArrow(5,218);
   SetIndexBuffer(5,ExtMapBuffer6);
   SetIndexEmptyValue(5,0.0);
   SetIndexStyle(6,DRAW_ARROW, EMPTY, 1);
   SetIndexArrow(6,217);
   SetIndexBuffer(6,ExtMapBuffer7);
   SetIndexEmptyValue(6,0.0);
   SetIndexStyle(7,DRAW_ARROW, EMPTY, 1);
   SetIndexArrow(7,218);
   SetIndexBuffer(7,ExtMapBuffer8);
   SetIndexEmptyValue(7,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//------------------------------------------------------------------  
bool Fractal (string F,int Per, int shift)
  {
   if (Period()>Per) return(-1);
   Per=MathCeil(Per/Period()*2)+MathCeil(Per/Period()/2);

   if (shift<Per)return(-1);
   if (shift>Bars-Per)return(-1); 
   for (int i=1;i<=Per;i++)
     {
      if (F=="U")
        {
         if (High[shift+i]>High[shift])return(-1);
         if (High[shift-i]>=High[shift])return(-1);
         
        }
      if (F=="L")
        {
         if (Low[shift+i]<Low[shift])return(-1);
         if (Low[shift-i]<=Low[shift])return(-1);
        }        
     }
   return(1);   
  }  
//------------------------------------------------------------------
int start()
  {
   int D1=1440, H4=240, H1=60, M15=15, M5=5,B, NBars, TF[4], i=0;
   double P;
   
   if (Period() == 1) {TF[0]=1; TF[1]=5; TF[2]=15; TF[3]=30;}
   if (Period() == 5) {TF[0]=5; TF[1]=15; TF[2]=30; TF[3]=60;}
   if (Period() == 15) {TF[0]=15; TF[1]=30; TF[2]=60; TF[3]=240;}
   if (Period() == 30) {TF[0]=30; TF[1]=60; TF[2]=240; TF[3]=1440;}
   if (Period() == 60) {TF[0]=60; TF[1]=240; TF[2]=1440; TF[3]=10080;}
   if (Period() == 240) {TF[0]=240; TF[1]=1440; TF[2]=10080; TF[3]=43200;}
   if (Period() == 1440) {TF[0]=1440; TF[1]=10080; TF[2]=43200; TF[3]=1;}
   if (Period() == 10080) {TF[0]=10080; TF[1]=43200; TF[2]=1; TF[3]=1;}
   if (Period() == 43200) {TF[0]=43200; TF[1]=1; TF[2]=1; TF[3]=1;}
   
 //  if (TF_M1)  {TF[i]=1; i++;}
//   if (TF_M5)  {TF[i]=5; i++;}
//   if (TF_M15) {TF[i]=15; i++;}
//   if (TF_M30) {TF[i]=30; i++;}
//   if (TF_H1)   {TF[i]=60; i++;}
//   if (TF_H4)   {TF[i]=240; i++;}
//   if (TF_D1)   {TF[i]=1440; i++;}
 

   B=Bars;
   if (Nday ==0 ) {NBars = Bars;}
 //  NBars=Nday*1440/Period();
   else {NBars = Nday;}
   P=discord*Point;

   for (int shift=NBars;shift>0;shift--)
      {
       if (Fractal("U",TF[0],shift)==1) ExtMapBuffer1[shift]=High[shift]+P;
       else ExtMapBuffer1[shift]=0;
       if (Fractal("L",TF[0],shift)==1) ExtMapBuffer2[shift]=Low[shift]-P;
       else ExtMapBuffer2[shift]=0;
       if (Fractal("U",TF[1],shift)==1) ExtMapBuffer3[shift]=High[shift]+P;
       else ExtMapBuffer3[shift]=0;
       if (Fractal("L",TF[1],shift)==1) ExtMapBuffer4[shift]=Low[shift]-P;
       else ExtMapBuffer4[shift]=0;
       if (Fractal("U",TF[2],shift)==1) ExtMapBuffer5[shift]=High[shift]+P;
       else ExtMapBuffer5[shift]=0;
       if (Fractal("L",TF[2],shift)==1) ExtMapBuffer6[shift]=Low[shift]-P;
       else ExtMapBuffer6[shift]=0;
       if (Fractal("U",TF[3],shift)==1) ExtMapBuffer7[shift]=High[shift]+P;
       else ExtMapBuffer7[shift]=0;
       if (Fractal("L",TF[3],shift)==1) ExtMapBuffer8[shift]=Low[shift]-P;
       else ExtMapBuffer8[shift]=0;
      }
   if (Comm) Comment(" D1 - êîðè÷íåâûé\n H4 - çåë¸íûé\n H1 - ñèíèé\nM15 - êðàñíûé ");
   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:



Custom Indicators Used:

Order Management characteristics:

Other Features: