Индикаторы: MTF_Fractal

 

MTF_Fractal:

Еще одна разновидность фракталов.

Author: John Smith

 

автор- Keris2112; можно добавить if (TimeFrame <= Period()) TimeFrame = Period() :

//+------------------------------------------------------------------+
//|                                                 Fractals_MTF.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Keris2112"
#property link      "http://www.forex-tsd.com"
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- 
extern int TimeFrame=60;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//---- 
int init()
  {
   SetIndexBuffer(0,ExtMapBuffer1);   SetIndexStyle(0,DRAW_ARROW);   SetIndexArrow(0,119);
   SetIndexBuffer(1,ExtMapBuffer2);   SetIndexStyle(1,DRAW_ARROW);   SetIndexArrow(1,119);
//---- 
   TimeFrame=MathMax(TimeFrame,Period());
   switch(TimeFrame)
     {
      case 1 : string TimeFrameStr="M1 "; break;
      case 5 : TimeFrameStr="M5 "; break;
      case 15 : TimeFrameStr="M15 "; break;
      case 30 : TimeFrameStr="M30 "; break;
      case 60 : TimeFrameStr="H1 "; break;
      case 240 : TimeFrameStr="H4 "; break;
      case 1440 : TimeFrameStr="D1 "; break;
      case 10080 : TimeFrameStr="W1 "; break;
      case 43200 : TimeFrameStr="MN "; break;
      default : TimeFrameStr="TF0 ";
     }
   IndicatorShortName("Fractals "+TimeFrameStr);
  }
   return(0);
//+---
int start()
  {
   datetime TimeArray[];
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
   int i,y,limit,counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars+TimeFrame/Period();
   for(i=0,y=0;i<limit;i++)
     {
      if (Time[i]<TimeArray[y]) y++;
      ExtMapBuffer1[i]=iFractals(NULL,TimeFrame,1,y);
      ExtMapBuffer2[i]=iFractals(NULL,TimeFrame,2,y);
     }
   //----
   return(0);
  }
//+------------------------------------------------------------------+
 
Мне очень пригодился этот индикатор, спасибо. Есть ли возможность добавить сигнал при появлении фрактала? Очень было бы полезно.
Причина обращения: