TRUE Forex

Просмотр кода форекс индикатора !!X12-MT4 4XTRAP v2.mq4

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 DodgerBlue
#property indicator_color2 Crimson
#property indicator_color3 Lime
#property indicator_color4 Crimson
#property indicator_color5 Lime
#property indicator_color6 Crimson
#property indicator_color7 Lime
#property indicator_color8 DodgerBlue

double H1Buffer[];
double H4Buffer[];
double H3Buffer[];
double H2Buffer[];
double L2Buffer[];
double L3Buffer[];
double L4Buffer[];
double L1Buffer[];

string sL1="L1", sL2="L2" ,sH1="H1", sH2="H2";
string sL3="L3", sH3="H3", sL4="L4", sH4="H4";

int fontsize=8;

double L2, L3, L4, H2, H3, H4, H1, L1, x;

int DAYS=1.0;
int Daily_Range_Average;
extern int Start_Time=0.0;

double LL1, LL2, LL3, LL4, LH1, LH2, LH3, LH4;
double F1, F2, F3, F4;


int deinit()
  {

   ObjectDelete("L1");
   ObjectDelete("H1");
   ObjectDelete("L2");
   ObjectDelete("H2");
   ObjectDelete("L3");
   ObjectDelete("H3");
   ObjectDelete("L4");
   ObjectDelete("H4"); 
   
      ObjectDelete("R1");
      ObjectDelete("R2");
      ObjectDelete("R3");
      ObjectDelete("R4");
      
      ObjectDelete("S1");
      ObjectDelete("S2");
      ObjectDelete("S3");
      ObjectDelete("S4");  

   return(0);
  }

int init()
  {
   string short_name;

   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexStyle(5,DRAW_LINE);
   SetIndexStyle(6,DRAW_LINE);
   SetIndexStyle(7,DRAW_LINE);
   
   SetIndexBuffer(0, L1Buffer);
   SetIndexBuffer(1, L2Buffer);
   SetIndexBuffer(2, H2Buffer);
   SetIndexBuffer(3, L3Buffer);
   SetIndexBuffer(4, H3Buffer);
   SetIndexBuffer(5, L4Buffer);
   SetIndexBuffer(6, H4Buffer);
   SetIndexBuffer(7, H1Buffer);

   SetIndexDrawBegin(0,1);

   return(0);
  }


int start()

  {
   int    counted_bars=IndicatorCounted();

   int limit, i;
   
   double daily_high[20];
   double daily_low[20];
   double yesterday_close;
   double phigh,plow;
   int p=1;

   ArrayResize(daily_high,DAYS);
   ArrayResize(daily_low,DAYS);
   ArrayInitialize(daily_high,0);
   ArrayInitialize(daily_low,0);

   ArrayCopySeries(daily_low,  MODE_LOW, Symbol(), PERIOD_D1);
   ArrayCopySeries(daily_high, MODE_HIGH,Symbol(), PERIOD_D1);
   
   plow=daily_low[1];
   phigh=daily_high[1];

   for(p=1;p<DAYS;p++)
   {
      if(plow>daily_low[p])
      {
         plow =daily_low[p];
      }
   }

   for(p=1;p<DAYS;p++)
   {
      if(phigh<daily_high[p])
      {
         phigh =daily_high[p];
      }
   }


if (counted_bars==0)
   {
   x=Period();
   if (x>240) return(-1);
   ObjectCreate("L2", OBJ_TEXT, 0, 0, 0); ObjectSetText("L2", "                 Sell TP1",fontsize,"Arial", White);
   ObjectCreate("H2", OBJ_TEXT, 0, 0, 0); ObjectSetText("H2", "                 Buy TP1", fontsize,"Arial", White);
   ObjectCreate("L3", OBJ_TEXT, 0, 0, 0); ObjectSetText("L3", "                 Sell TP2",fontsize,"Arial", White);
   ObjectCreate("H3", OBJ_TEXT, 0, 0, 0); ObjectSetText("H3", "                 Buy TP2", fontsize,"Arial", White);
   ObjectCreate("L4", OBJ_TEXT, 0, 0, 0); ObjectSetText("L4", "                 Sell TP3",fontsize,"Arial", White);
   ObjectCreate("H4", OBJ_TEXT, 0, 0, 0); ObjectSetText("H4", "                 Buy TP3", fontsize,"Arial", White);
   ObjectCreate("L1", OBJ_TEXT, 0, 0, 0); ObjectSetText("L1", "                 SELL",    fontsize,"Arial", White);
   ObjectCreate("H1", OBJ_TEXT, 0, 0, 0); ObjectSetText("H1", "                 BUY",     fontsize,"Arial", White);
   }
   if(counted_bars<0) return(-1);
     limit=(Bars-counted_bars)-1;

   for (i=limit; i>=0;i--)
   { 
   if (TimeDay(Time[i])!=TimeDay(Time[i+1]))
   { 
   
   Daily_Range_Average=(phigh-plow)/Point;
   
   F1=(Daily_Range_Average*0.382*Point);
   F2=(Daily_Range_Average*0.882*Point);
   F3=(Daily_Range_Average*1.382*Point);
   F4=(Daily_Range_Average*1.882*Point);
/*
   F1=(Daily_Range_Average*0.382*Point);
   F2=(Daily_Range_Average*0.764*Point);
   F3=(Daily_Range_Average*1.146*Point);
   F4=(Daily_Range_Average*1.528*Point);
*/
    H1=F1 + Open[i-Start_Time];
    H2=F2 + Open[i-Start_Time];
    H3=F3 + Open[i-Start_Time];
    H4=F4 + Open[i-Start_Time];
    
    L1=Open[i-Start_Time] - F1;
    L2=Open[i-Start_Time] - F2;
    L3=Open[i-Start_Time] - F3;
    L4=Open[i-Start_Time] - F4;   
    
   ObjectMove("L1", 0, Time[i-Start_Time], L1);
   ObjectMove("H1", 0, Time[i-Start_Time], H1);
   ObjectMove("L2", 0, Time[i-Start_Time], L2);
   ObjectMove("H2", 0, Time[i-Start_Time], H2);
   ObjectMove("L3", 0, Time[i-Start_Time], L3);
   ObjectMove("H3", 0, Time[i-Start_Time], H3);
   ObjectMove("L4", 0, Time[i-Start_Time], L4);
   ObjectMove("H4", 0, Time[i-Start_Time], H4);

   }
    
    L1Buffer[i-Start_Time]=L1;
    L2Buffer[i-Start_Time]=L2;
    L3Buffer[i-Start_Time]=L3;
    L4Buffer[i-Start_Time]=L4;
    H1Buffer[i-Start_Time]=H1;
    H2Buffer[i-Start_Time]=H2;
    H3Buffer[i-Start_Time]=H3;
    H4Buffer[i-Start_Time]=H4;

   }

   ObjectDelete("R1");
   ObjectCreate("R1", OBJ_TREND, 0, Time[0], L1Buffer[0], Time[23], L1Buffer[0]);
   ObjectSet("R1", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("R1", OBJPROP_WIDTH, 3);
   ObjectSet("R1", OBJPROP_COLOR, DodgerBlue);  ObjectSet("R1", OBJPROP_BACK, 1);
   ObjectSet("R1", OBJPROP_RAY, 0); ObjectMove("R1", 0, Time[0],  L1Buffer[0]);
   
   ObjectDelete("R2");
   ObjectCreate("R2", OBJ_TREND, 0, Time[0], L2Buffer[0], Time[23], L2Buffer[0]);
   ObjectSet("R2", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("R2", OBJPROP_WIDTH, 3);
   ObjectSet("R2", OBJPROP_COLOR, Crimson);  ObjectSet("R2", OBJPROP_BACK, 1);
   ObjectSet("R2", OBJPROP_RAY, 0); ObjectMove("R2", 0, Time[0],  L2Buffer[0]);
   
   ObjectDelete("R3");
   ObjectCreate("R3", OBJ_TREND, 0, Time[0], L3Buffer[0], Time[23], L3Buffer[0]);
   ObjectSet("R3", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("R3", OBJPROP_WIDTH, 3);
   ObjectSet("R3", OBJPROP_COLOR, Crimson);  ObjectSet("R3", OBJPROP_BACK, 1);
   ObjectSet("R3", OBJPROP_RAY, 0); ObjectMove("R3", 0, Time[0],  L3Buffer[0]);
   
   ObjectDelete("R4");
   ObjectCreate("R4", OBJ_TREND, 0, Time[0], L4Buffer[0], Time[23], L4Buffer[0]);
   ObjectSet("R4", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("R4", OBJPROP_WIDTH, 3);
   ObjectSet("R4", OBJPROP_COLOR, Crimson);  ObjectSet("R4", OBJPROP_BACK, 1);
   ObjectSet("R4", OBJPROP_RAY, 0); ObjectMove("R4", 0, Time[0],  L4Buffer[0]);
   
   ObjectDelete("S1");
   ObjectCreate("S1", OBJ_TREND, 0, Time[0], H1Buffer[0], Time[23], H1Buffer[0]);
   ObjectSet("S1", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("S1", OBJPROP_WIDTH, 3);
   ObjectSet("S1", OBJPROP_COLOR, DodgerBlue);  ObjectSet("S1", OBJPROP_BACK, 1);
   ObjectSet("S1", OBJPROP_RAY, 0); ObjectMove("S1", 0, Time[0],  H1Buffer[0]);
   
   ObjectDelete("S2");
   ObjectCreate("S2", OBJ_TREND, 0, Time[0], H2Buffer[0], Time[23], H2Buffer[0]);
   ObjectSet("S2", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("S2", OBJPROP_WIDTH, 3);
   ObjectSet("S2", OBJPROP_COLOR, Lime);  ObjectSet("S2", OBJPROP_BACK, 1);
   ObjectSet("S2", OBJPROP_RAY, 0); ObjectMove("S2", 0, Time[0],  H2Buffer[0]);
   
   ObjectDelete("S3");
   ObjectCreate("S3", OBJ_TREND, 0, Time[0], H3Buffer[0], Time[23], H3Buffer[0]);
   ObjectSet("S3", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("S3", OBJPROP_WIDTH, 3);
   ObjectSet("S3", OBJPROP_COLOR, Lime);  ObjectSet("S3", OBJPROP_BACK, 1);
   ObjectSet("S3", OBJPROP_RAY, 0); ObjectMove("S3", 0, Time[0],  H3Buffer[0]);
   
   ObjectDelete("S4");
   ObjectCreate("S4", OBJ_TREND, 0, Time[0], H4Buffer[0], Time[23], H4Buffer[0]);
   ObjectSet("S4", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("S4", OBJPROP_WIDTH, 3);
   ObjectSet("S4", OBJPROP_COLOR, Lime);  ObjectSet("S4", OBJPROP_BACK, 1);
   ObjectSet("S4", OBJPROP_RAY, 0); ObjectMove("S4", 0, Time[0],  H4Buffer[0]);

   return(0);
  }
//+------------------------------------------------------------------+

Комментарии к исходному коду форекс индикатора !!X12-MT4 4XTRAP v2.mq4
В целях безопасности и борьбы со спамом в тексте комментариев запрещено размещать html-теги и ссылки. Благодарим за понимание.

  • X
  • 0% загружено
« индикатор !!X10-MT4 RSI #2.mq4
индикатор !!X12-MT4 4XTRAP.mq4 »