TRUE Forex

Просмотр кода форекс индикатора !XPS v7 Murrey Math (3).mq4

// +----------------------------------------------------------------------------------------+ //
// |    .-._______                           XARD777                          _______.-.    | //
// |---( )_)______)                 Knowledge of the ancients                (______(_( )---| //
// |  (    ()___)                              \¦/                             (___()    )  | //
// |       ()__)                              (o o)                             (__()       | //
// |--(___()_)__________________________oOOo___(_)___oOOo_________________________(_()___)--| //
// |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____|_____| //
// |                                                                                   2011 | //
// |----------------------------------------------------------------------------------------| //
// |                 File:     !XPS v7 Murrey Math.mq4                                      | //
// | Programming language:     MQL4                                                         | //
// | Development platform:     MetaTrader 4                                                 | //
// |          End product:     THIS SOFTWARE IS FOR USE ONLY BY XARD777                     | //
// |                                                                                        | //
// |                                                         [Xard777 Proprietory Software] | //
// +----------------------------------------------------------------------------------------+ //

#property indicator_chart_window 

extern int  math.calc               = 96;//(XARD 1HR CALC...256DAYS PER YEAR / 8 = 32DAYS / 8 = 4DAYS / 1HR = 96) 
extern int  text.font.size          = 12;
extern bool show.description        = false;
extern bool show.lines              = true;
extern int  set.number.bars.wide    = 96;

// ------------------------------------------------------------------------------------------ //
//                            I N T E R N A L   V A R I A B L E S                             //
// ------------------------------------------------------------------------------------------ //
double  dmml = 0.,
        dvtl = 0.,
        sum  = 0.,
        v1x = 0., v1x.last= 0., v2x = 0., v2x.last=0.,
        mn = 0.,
        mx = 0.,
        difmxmn,
        x1 = 0.,
        x2 = 0.,
        x3 = 0.,
        x4 = 0.,
        x5 = 0.,
        x6 = 0.,       
        y1 = 0.,
        y2 = 0.,
        y3 = 0.,
        y4 = 0.,
        y5 = 0.,
        y6 = 0.,
        tx = 0.,        
        octave = 0.,
        fractal = 0.,
        range   = 0.,
        finalH  = 0.,
        finalL  = 0.,
        DecNos,
        mmlx[13],
        MathLog2,
        Octv = 0.;

string  ln_txt[13], ln_desc[13], buff_str = "", buff_str2 = "";
int     OctLinesCnt=13, mml_clr[13], mml_shft=0,  nTime=0,  CurPeriod=0,  nDigits=0, i=0,spaces[13];
                
// ------------------------------------------------------------------------------------------ //
//                             I N I T I A L I S A T I O N                                    //
// ------------------------------------------------------------------------------------------ //
string create_string(int characters)
{
   string spaces="";
   for(int i=0;i<characters;i++) spaces=" "+spaces;
   return(spaces);
}
int init() {
   
   MathLog2=MathLog(2);
   switch ( Period() )
         {
          case    1: math.calc =   math.calc*60;      tx = 10;  break;
          case    5: math.calc =   math.calc*12;      tx = 20;  break;
          case   15: math.calc =   math.calc*4;       tx = 20;  break;
          case   30: math.calc =   math.calc*2.;      tx = 20;  break;
          case   60: math.calc =   math.calc;         tx = 50;  break;
          case  240: math.calc =   math.calc*2.;      tx = 50;  break;
          case 1440: math.calc =   math.calc/1.333;   tx = 50;  break;
          case 10080:math.calc =   math.calc;         tx = 50;  break;
            default: math.calc =   math.calc;         tx = 50;  break;
         }
         
  // DAN : CANNOT HAVE CODE THAT NEEDS TO BE UPDATED IN THE INT() AREA AS CODE ONLY UPDATES IN THIS AREA WHEN INDICATOR OR
  // ea IS FIRST LOADED ONTO CHART OR WHEN TIMEFRAMES ARE PHYSICALLY CHANGED.  CODE THAT UPDATES NEEDS TO BE IN THE START() AREA OF THE CODE     
 /*  set.number.bars.wide=math.calc;
   
//---- indicators  
   ln_txt[0] = "[-2/8] ";     ln_desc[0]  = "Extreme Overshoot    ";       mml_clr[0]  = Red;
   ln_txt[1] = "[-1/8] ";     ln_desc[1]  = "Overshoot            ";       mml_clr[1]  = Orange;
   ln_txt[2] = "[0/8] ";      ln_desc[2]  = "Ultimate Support     ";       mml_clr[2]  = Aqua;
   ln_txt[3] = "[1/8] ";      ln_desc[3]  = "Weak Stall/Reverse ";         mml_clr[3]  = Yellow;
   ln_txt[4] = "[2/8] ";      ln_desc[4]  = "Pivot, Reverse       ";       mml_clr[4]  = HotPink;
   ln_txt[5] = "[3/8] ";      ln_desc[5]  = "BUY Premium Zone     ";       mml_clr[5]  = Lime;
   ln_txt[6] = "[4/8] ";      ln_desc[6]  = "Best New BUY/SELL    ";       mml_clr[6]  = Aqua;
   ln_txt[7] = "[5/8] ";      ln_desc[7]  = "SELL Premium Zone    ";       mml_clr[7]  = Lime;
   ln_txt[8] = "[6/8] ";      ln_desc[8]  = "Pivot, Reverse";              mml_clr[8]  = HotPink;
   ln_txt[9] = "[7/8] ";      ln_desc[9]  = "Weak Stall/Reverse   ";       mml_clr[9]  = Yellow;
   ln_txt[10]= "[8/8] ";      ln_desc[10] = "Ultimate Resistance  ";       mml_clr[10] = Aqua;
   ln_txt[11]= "[+1/8] ";     ln_desc[11] = "Overshoot";                   mml_clr[11] = Orange;
   ln_txt[12]= "[+2/8] ";     ln_desc[12] = "Extreme Overshoot    ";       mml_clr[12] = Red;
   
               // 0  1  2  3  4  5  6  7  8  9 10 11 12 
   int spaces[]={29,26,28,29,27,30,30,30,20,29,28,17,29};
   int font.adjustment=MathAbs(text.font.size-10);
   for(i=0;i<OctLinesCnt;i++)
      {
      ln_txt[i]=create_string(10) +ln_txt[i];
      if(show.description) ln_txt[i]=create_string(spaces[i]+font.adjustment) +ln_txt[i]+ln_desc[i];   
     
      buff_str = "mml_txt"+i;
      if(ObjectFind(buff_str) == -1)
         {
         ObjectCreate(buff_str, OBJ_TEXT, 0, Time[0], mml_shft);
         ObjectSetText(buff_str, ln_txt[i], text.font.size, "Arial", mml_clr[i]);
         
         }   
      
      /*if (show.lines) 
            {  
            buff_str = "mml"+i;
            if(ObjectFind(buff_str) == -1)
               {
               ObjectCreate(buff_str, OBJ_TREND, 0, Time[0]-spaces[i], mmlx[i],Time[0+set.number.bars.wide], mmlx[i]);
               ObjectSet(buff_str, OBJPROP_STYLE, STYLE_SOLID);
               ObjectSet(buff_str, OBJPROP_BACK, 1);
               ObjectSet(buff_str, OBJPROP_COLOR, mml_clr[i]);
               ObjectSet(buff_str, OBJPROP_RAY, 0);
               //ObjectMove(buff_str, 0, Time[0],  mmlx[i]);
               }  Think this will work when ticks coming in,  tzuman
           }
          
       }*/      
   return(0);
  }

// ------------------------------------------------------------------------------------------ //
//                            D E - I N I T I A L I S A T I O N                               //
// ------------------------------------------------------------------------------------------ //

int deinit()
{
for(i=0;i<OctLinesCnt;i++) {
    buff_str = "mml"+i;
    ObjectDelete(buff_str);
    buff_str = "mml_txt"+i;
    ObjectDelete(buff_str);
    }
  
//----
   return(0);
  }

// ------------------------------------------------------------------------------------------ //
//                                M A I N   P R O C E D U R E                                 //
// ------------------------------------------------------------------------------------------ //
 
int start() {

      set.number.bars.wide=math.calc;
   
//---- indicators  
   ln_txt[0] = "[-2/8] ";     ln_desc[0]  = "Extreme Overshoot    ";       mml_clr[0]  = Red;
   ln_txt[1] = "[-1/8] ";     ln_desc[1]  = "Overshoot            ";       mml_clr[1]  = Orange;
   ln_txt[2] = "[0/8] ";      ln_desc[2]  = "Ultimate Support     ";       mml_clr[2]  = Aqua;
   ln_txt[3] = "[1/8] ";      ln_desc[3]  = "Weak Stall/Reverse ";         mml_clr[3]  = Yellow;
   ln_txt[4] = "[2/8] ";      ln_desc[4]  = "Pivot, Reverse       ";       mml_clr[4]  = HotPink;
   ln_txt[5] = "[3/8] ";      ln_desc[5]  = "BUY Premium Zone     ";       mml_clr[5]  = Lime;
   ln_txt[6] = "[4/8] ";      ln_desc[6]  = "Best New BUY/SELL    ";       mml_clr[6]  = Aqua;
   ln_txt[7] = "[5/8] ";      ln_desc[7]  = "SELL Premium Zone    ";       mml_clr[7]  = Lime;
   ln_txt[8] = "[6/8] ";      ln_desc[8]  = "Pivot, Reverse";              mml_clr[8]  = HotPink;
   ln_txt[9] = "[7/8] ";      ln_desc[9]  = "Weak Stall/Reverse   ";       mml_clr[9]  = Yellow;
   ln_txt[10]= "[8/8] ";      ln_desc[10] = "Ultimate Resistance  ";       mml_clr[10] = Aqua;
   ln_txt[11]= "[+1/8] ";     ln_desc[11] = "Overshoot";                   mml_clr[11] = Orange;
   ln_txt[12]= "[+2/8] ";     ln_desc[12] = "Extreme Overshoot    ";       mml_clr[12] = Red;
   
               // 0  1  2  3  4  5  6  7  8  9 10 11 12 
   int spaces[]={29,26,28,29,27,30,30,30,20,29,28,17,29};
   int font.adjustment=MathAbs(text.font.size-10);
   for(i=0;i<OctLinesCnt;i++)
      {
      ln_txt[i]=create_string(10) +ln_txt[i];
      if(show.description) ln_txt[i]=create_string(spaces[i]+font.adjustment) +ln_txt[i]+ln_desc[i];   
     
      buff_str = "mml_txt"+i;
      if(ObjectFind(buff_str) == -1)
         {
         ObjectCreate(buff_str, OBJ_TEXT, 0, Time[0], mml_shft);
         ObjectSetText(buff_str, ln_txt[i], text.font.size, "Arial", mml_clr[i]);
         
         }  }
// DAN : TRY PUTTING THIS CODE INTO THE INT() AREA IF YOU NEED IT TO BE LOCKED
   if( (nTime == Time[0]) || (CurPeriod == Period()) )                  //return(0); DAN : THIS return(0) AND THE ONE BELOW ARE CLOSING OFF THE CODE AND STOPPING THE REFRESH AS WELL 
   nTime    = Time[0];   CurPeriod= Period();

   v1x = Low[Lowest(NULL,0,MODE_CLOSE,math.calc,0)];
   v2x = High[Highest(NULL,0,MODE_CLOSE,math.calc,0)];
   
   if(MathAbs(v1x-v1x.last)<Point && MathAbs(v2x-v2x.last)<Point)       //return(0);   DAN : AND THIS return(0) //no change => no need to recalculate
   v1x.last=v1x;           v2x.last=v2x;
// DAN : EVERYTHING ABOVE HERE TO THE INT() AREA TO MY NOTE ABOVE TO LOCK THE CODE   
   if (StringFind (Symbol(), "JPY", 0) != -1){ DecNos = 2;}
   else if(Symbol()=="XAUUSD" || Symbol()=="XAGUSD"){ DecNos = 2; }
   else { DecNos = 4; } 
   
   fractal=Determine_Fractal();
      
   range=(v2x-v1x);
   sum=MathFloor(MathLog(fractal/range)/MathLog2);
   octave=fractal*(MathPow(0.5,sum));
   mn=MathFloor(v1x/octave)*octave;
   
   double increment= octave*0.3333;
   if(mn+octave+increment > v2x )    mx=mn+octave; 
   else                              mx=mn+(2.*octave);

   difmxmn=mx-mn;

// calculating xx
    if( (v1x>=(3.*difmxmn/16.+mn)) && (v2x<=(9.*difmxmn/16.+mn)) )                        x2=mn+difmxmn/2.; 
    else                                                                                  x2=0.;

    if( (v1x>=(mn-difmxmn/8.))&& (v2x<=(5.*difmxmn/8.+mn)) && (x2==0.) )                  x1=mn+difmxmn/2.; 
    else                                                                                  x1=0.;

    if( (v1x>=(mn+7*difmxmn/16.))&& (v2x<=(13.*difmxmn/16.+mn)) )                         x4=mn+3.*difmxmn/4.; 
    else                                                                                  x4=0.;

    if( (v1x>=(mn+3.*difmxmn/8.))&& (v2x<=(9.*difmxmn/8.+mn))&& (x4==0.) )                x5=mx; 
    else                                                                                  x5=0.;

    if( (v1x>=(mn+difmxmn/8.))&& (v2x<=(7.*difmxmn/8.+mn))&& (x1 + x2 + x4 + x5 == 0.) )  x3=mn+3.*difmxmn/4.; 
    else                                                                                  x3=0.;

    if( (x1+x2+x3+x4+x5) ==0. )                                                           x6=mx; 
    else                                                                                  x6=0.;
    
    finalH = x1+x2+x3+x4+x5+x6;
    
// calculating yy
    if( x1>0 )                                     y1=mn;               else  y1=0.;
    if( x2>0 )                                     y2=mn+difmxmn/4.;    else  y2=0.;
    if( x3>0 )                                     y3=mn+difmxmn/4.;    else  y3=0.;
    if( x4>0 )                                     y4=mn+difmxmn/2.;    else  y4=0.;
    if( x5>0 )                                     y5=mn+difmxmn/2.;    else  y5=0.;
    if( (finalH>0.) && ((y1+y2+y3+y4+y5)==0.) )    y6=mn;               else  y6=0.;
    finalL = y1+y2+y3+y4+y5+y6;

   for( i=0; i<OctLinesCnt; i++)      mmlx[i] = 0;
   dmml = (finalH-finalL)/8.;
   Octv = finalH/(fractal/128.);
   
   mmlx[0] =(finalL-dmml*2.); //-2/8
   for( i=1; i<OctLinesCnt; i++)     mmlx[i] = mmlx[i-1] + dmml;
   for( i=0; i<OctLinesCnt; i++ )
      {
        buff_str = "mml_txt"+i;
        string s=StringSubstr(ln_txt[i],6);
        ObjectSetText(buff_str, create_string(15) +ln_txt[i]+"  "+ DoubleToStr(mmlx[i],DecNos), text.font.size, "Arial Bold", mml_clr[i]);
        ObjectSet(buff_str, OBJPROP_BACK, 1);
        ObjectMove(buff_str, 0, Time[0],  mmlx[i]);
        
        if (show.lines) 
            {  
            buff_str = "mml"+i;
            if(ObjectFind(buff_str) == -1) {
               ObjectCreate(buff_str, OBJ_TREND, 0, Time[0]-spaces[i], mmlx[i],Time[0+set.number.bars.wide], mmlx[i]);
               ObjectSet(buff_str, OBJPROP_STYLE, STYLE_SOLID);
               ObjectSet(buff_str, OBJPROP_BACK, 1);
               ObjectSet(buff_str, OBJPROP_COLOR, mml_clr[i]);
               ObjectSet(buff_str, OBJPROP_RAY, 0);
               }
            ObjectMove(buff_str, 0, Time[0],  mmlx[i]);
            }   
        }
 
//---- End Of Program
  return(0);
  }
double Determine_Fractal()
{
   if( v2x<=250000. && v2x>25000. )   return(100000.);
   if( v2x<=25000. && v2x>2500. )     return(10000.);
   if( v2x<=2500. && v2x>250. )       return(1000.);
   if( v2x<=250. && v2x>25. )         return(100.);
   if( v2x<=25. && v2x>12.5 )         return(12.5);
   if( v2x<=12.5 && v2x>6.25)         return(12.5);
   if( v2x<=6.25 && v2x>3.125 )       return(6.25);
   if( v2x<=3.125 && v2x>1.5625 )     return(3.125);
   if( v2x<=1.5625 && v2x>0.390625 )  return(1.5625);
   if( v2x<=0.390625 && v2x>0)        return(0.1953125);
   return(-1.);
}                     
// ------------------------------------------------------------------------------------------ //
//                                     E N D   P R O G R A M                                  //
// ------------------------------------------------------------------------------------------ //
/*                                                         
                                        ud$$$**BILLION$bc.                          
                                    u@**"        PROJECT$$Nu                       
                                  J                ""#$$$$$$r                     
                                 @                       $$$$b                    
                               .F                        ^*3$$$                   
                              :% 4                         J$$$N                  
                              $  :F                       :$$$$$                  
                             4F  9                       J$$$$$$$                 
                             4$   k             4$$$$bed$$$$$$$$$                 
                             $$r  'F            $$$$$$$$$$$$$$$$$r                
                             $$$   b.           $$$$$$$$$$$$$$$$$N                
                             $$$$$k 3eeed$$b    XARD777."$$$$$$$$$                
              .@$**N.        $$$$$" $$$$$$F'L $$$$$$$$$$$  $$$$$$$                
              :$$L  'L       $$$$$ 4$$$$$$  * $$$$$$$$$$F  $$$$$$F         edNc   
             @$$$$N  ^k      $$$$$  3$$$$*%   $F4$$$$$$$   $$$$$"        d"  z$N  
             $$$$$$   ^k     '$$$"   #$$$F   .$  $$$$$c.u@$$$          J"  @$$$$r 
             $$$$$$$b   *u    ^$L            $$  $$$$$$$$$$$$u@       $$  d$$$$$$ 
              ^$$$$$$.    "NL   "N. z@*     $$$  $$$$$$$$$$$$$P      $P  d$$$$$$$ 
                 ^"*$$$$b   '*L   9$E      4$$$  d$$$$$$$$$$$"     d*   J$$$$$r   
                      ^$$$$u  '$.  $$$L     "#" d$$$$$$".@$$    .@$"  z$$$$*"     
                        ^$$$$. ^$N.3$$$       4u$$$$$$$ 4$$$  u$*" z$$$"          
                          '*$$$$$$$$ *$b      J$$$$$$$b u$$P $"  d$$P             
                             #$$$$$$ 4$ 3*$"$*$ $"$'c@@$$$$ .u@$$$P               
                               "$$$$  ""F~$ $uNr$$$^&J$$$$F $$$$#                 
                                 "$$    "$$$bd$.$W$$$$$$$$F $$"     
                                   ?k         ?$$$$$$$$$$$F'*                     
                                    9$$bL     z$$$$$$$$$$$F                       
                                     $$$$    $$$$$$$$$$$$$                        
                                      '#$$c  '$$$$$$$$$"            
                                       .@"#$$$$$$$$$$$$b                          
                                     z*      $$$$$$$$$$$$N.                       
                                   e"      z$$"  #$$$k  '*$$.                     
                                .u*      u@$P"      '#$$c   "$$c                   
                        u@$*"""       d$$"            "$$$u  ^*$$b.               
                      :$F           J$P"                ^$$$c   '"$$$$$$bL        
                     d$$  ..      @$#                      #$$b         '#$       
                     9$$$$$$b   4$$                          ^$$k         '$      
                      "$$6""$b u$$                             '$    d$$$$$P      
                        '$F $$$$$"                              ^b  ^$$$$b$       
                         '$W$$$$"                                'b@$$$$"         
                                                                  ^$$$*/

Комментарии к исходному коду форекс индикатора !XPS v7 Murrey Math (3).mq4
В целях безопасности и борьбы со спамом в тексте комментариев запрещено размещать html-теги и ссылки. Благодарим за понимание.

  • X
  • 0% загружено
« индикатор !XPS v7 MOMENTUM TREND.mq4
индикатор !XPS v7 OSCILLATOR v2.mq4 »