Navigation:Home > Content >

Two_Fractals-5_(2).mq4

Time: 2014-04-25 | Download file:Two_Fractals-5_(2).mq4

//+------------------------------------------------------------------+
//|                                                 Two_Fractals.mq4 |
//+------------------------------------------------------------------+
#property indicator_chart_window
extern bool   ShowSignal = true;
extern bool   DrawRecs=true;
extern string note0="Минимальное тело свечи в пп";
extern int    min_candle = 3;
extern string note1="Разница между длиной теней в пп";
extern int    Razn = 3;
extern string note2="Цвет и толщина прямоугольника";
extern color  BuyColor = Red;
extern color  SellColor = PowderBlue;
extern color  NoSignalColor = Orange;
extern int RectangleWidth = 5;
extern string note3=" =0 для просмотра всей истории";
extern int    Bars_Count = 600;
extern string SoundFile = "Trumpet";

extern string sep0 = "";
extern string note4 = "Следить за:";
extern string pair00 = "EURUSD";
extern string pair01 = "GBPUSD";
extern string pair02 = "NZDUSD";
extern string pair03 = "USDCHF";
extern string pair04 = "USDJPY";
extern string pair05 = "USDCAD";
extern string pair06 = "AUDUSD";
extern string pair07 = "EURGBP";
extern string pair08 = "EURCHF";
extern string pair09 = "EURJPY";
extern string pair10 = "GBPCHF";
extern string pair11 = "GBPJPY";
extern string pair12 = "";
extern string pair13 = "";
extern string pair14 = "";
extern string pair15 = "";
extern string pair16 = "";
extern string pair17 = "";
extern string pair18 = "";
extern string pair19 = "";
extern string pair20 = "";
extern string sep1= "";
extern string note5 = "Проверять ТФ:";
extern string TF1   = "1";
extern string TF2   = "5";
extern string TF3   = "15";
extern string TF4   = "30";
extern string TF5   = "60";
extern string TF6   = "240";
extern string TF7   = "1440";
extern string TF8   = "10080";
extern string TF9   = "43200";

string pairs[21], TFr[9];
int keys[20][9];
int delta, uf, lf;
double l_shadow, u_shadow;
bool HistoryViewer, draw, Play;
double high5, high4, high3, high2, high1, low5, low4, low3, low2, low1, open3, close3;
string signal, symbol;
color BS_color;
//+------------------------------------------------------------------+
int init()  {
  delta=Razn*Point;
  if(Bars_Count==0) Bars_Count=Bars;
  pairs[0]=pair00;
  pairs[1]=pair01;
  pairs[2]=pair02;
  pairs[3]=pair03;
  pairs[4]=pair04;
  pairs[5]=pair05;
  pairs[6]=pair06;
  pairs[7]=pair07;
  pairs[8]=pair08;
  pairs[9]=pair09;
  pairs[10]=pair10;
  pairs[11]=pair11;
  pairs[12]=pair12;
  pairs[13]=pair13;
  pairs[14]=pair14;
  pairs[15]=pair15;
  pairs[16]=pair16;
  pairs[17]=pair17;
  pairs[18]=pair18;
  pairs[19]=pair19;
  pairs[20]=pair20;
  TFr[0]=TF1;
  TFr[1]=TF2;
  TFr[2]=TF3;
  TFr[3]=TF4;
  TFr[4]=TF5;
  TFr[5]=TF6;
  TFr[6]=TF7;
  TFr[7]=TF8;
  TFr[8]=TF9;
  return(0);
}
//+------------------------------------------------------------------+
int deinit()  {  for(int a=0; aMathMax(MathMax(high4,high5), MathMax(high1,high2)) &&
          low3min_candle*Point)  { 
            l_shadow=MathMin(open3, close3)-low3;
            u_shadow=high3-MathMax(open3, close3);
            if(l_shadow-u_shadow>delta)   {  signal="продажа по 2-F";  BS_color=BuyColor;  }
            if(u_shadow-l_shadow>delta)   {  signal="покупка по 2-F";  BS_color= SellColor;     }
            if(MathAbs(l_shadow-u_shadow)<=delta) {  BS_color= NoSignalColor;  }
            if(ShowSignal)  { Alert(symbol,"   ",tf," мин  ", signal); Play = true;  }
            int    time1=iTime(symbol, tf, 4);
            double price1=iHigh(symbol, tf, 3);  
            int    time2=iTime(symbol, tf, 2);
            double price2=iLow(symbol, tf, 3);  
            if(DrawRecs)  DrawRec(StringConcatenate("DF_",i), time1,price1,time2,price2, BS_color);
        }
        keys[i][p]=time;
  } } } 
  return(0); 
}
//+------------------------------------------------------------------+
void DrawRec(string name, int time1, double price1, int time2, double price2, color color1)  {
   ObjectCreate(name, OBJ_RECTANGLE, 0, time1, price1, time2, price2, 0, 0);
   ObjectSet(name, OBJPROP_WIDTH, RectangleWidth);
   ObjectSet(name, OBJPROP_BACK, false);
   ObjectSet(name, OBJPROP_COLOR, color1);
}
//+------------------------------------------------------------------+
void DrawHistory()  {
   for(int i=0; iMathMax(MathMax(High[i+4],High[i+5]), MathMax(High[i+1],High[i+2])) &&
       Low[i+3]min_candle*Point)  { 
       l_shadow=NormalizeDouble(MathMin(Open[i+3], Close[i+3])-Low[i+3],Digits);
       u_shadow=NormalizeDouble(High[i+3]-MathMax(Open[i+3], Close[i+3]),Digits);
       if(l_shadow-u_shadow>delta)   {  signal="продажа";  color BS_colors=BuyColor;  }
       if(u_shadow-l_shadow>delta)   {  signal="покупка";        BS_colors= SellColor;     }
       if(MathAbs(l_shadow-u_shadow)<=delta) {  BS_colors= NoSignalColor;  }
       int    time1=Time[i+4];
       double price1=High[i+3]+5*Point;  
       int    time2=Time[i+2];
       double price2=Low[i+3]-5*Point;  
       if(DrawRecs)  DrawRec(StringConcatenate("DF_",i), time1,price1,time2,price2, BS_colors);
   } }
   HistoryViewer=true;
   return; 
}
//+------------------------------------------------------------------+
void InitialData(string para, int per)  {
  high5=iHigh(para, per, 5);
  high4=iHigh(para, per, 4);
  high3=iHigh(para, per, 3);
  high2=iHigh(para, per, 2);
  high1=iHigh(para, per, 1);

  low5=iLow(para, per, 5);
  low4=iLow(para, per, 4);
  low3=iLow(para, per, 3);
  low2=iLow(para, per, 2);
  low1=iLow(para, per, 1);
  
  open3= iOpen(para, per, 3);
  close3=iClose(para, per, 3);

  uf=0;  lf=0;
  draw=false;
}
//+------------------------------------------------------------------+

Recommend