Navigation:Home > Content >

XPS_MATH_TWO.mq4

Time: 2011-03-08 | Download file:XPS_MATH_TWO.mq4

// +----------------------------------------------------------------------------------------+ //
// |    .-._______                           XARD777                          _______.-.    | //
// |---( )_)______)                 Knowledge of the ancients                (______(_( )---| //
// |  (    ()___)                              \¦/                             (___()    )  | //
// |       ()__)                              (o o)                             (__()       | //
// |--(___()_)__________________________oOOo___(_)___oOOo_________________________(_()___)--| //
// |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____|_____| //
// |                                                                                   2011 | //
// |----------------------------------------------------------------------------------------| //
// |                 File:     !XPS MATH TWO.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

// ------------------------------------------------------------------------------------------ //
//                            E X T E R N A L   V A R I A B L E S                             //
// ------------------------------------------------------------------------------------------ //

color midcolx = Aqua;

double s1[];
int Px = 96;//On a 1hr chart 4days equal 24hrs x 4 = 96bars for period
int FWx = 192;//192;//show 2 x 4days on the chart = 8days viewing
int StepBackx = 0;

bool   show.linesx=true;
bool   show.franka.linesx=true;
bool   show.timeleft=false;
bool   show.symbol.price=false;
int    win = 0;
int    Adjust_Side_to_side = 10;
int    Shift_UP_DN = 0;

bool   showcomments=false;
//+------------------------------------------------------------------+
bool       bml.33x.lines=false;
color      bml.33x.color=DarkSlateGray;
int        bml.33x.style=0;
//+------
bool       bml.50.lines=false;
color      bml.50.color=DarkSlateGray;
int        bml.50.style=1;
//+------------------------------------------------------------------+ 
bool color.framex=false;
color MM1Colorx = C'7,40,80';
color MM2Colorx = C'100,5,60';
color MM3Colorx = C'7,40,80';

// ------------------------------------------------------------------------------------------ //
//                            I N T E R N A L   V A R I A B L E S                             //
// ------------------------------------------------------------------------------------------ //

#define FF1x "FF1x"
#define FF2x "FF2x"
#define FF3x "FF3x"
#define FF4x "FF4x"
#define FF5x "FF5x"

int l996 = 0;
int l1004 = 0;
 
double  bml.33x[26], bml.50[12];
double  dmml = 0,
        dvtl = 0,
        sum  = 0,
        v1x = 0,
        v2x = 0,
        mn = 0,
        mx = 0,
        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];
        
string  ln_txt[13], ln_tx[13],       
        buff_str = "", buff_str2 = "", buff_str3 = "", buff_str4 = "";
        
int bn_v1x=0, bn_v2x=0, OctLinesCnt=13, mml_thk=8, mml_clr[13], mml_shft=3, nTime=0, CurPeriod=0, x33 = 0, x50 = 0,
    nDigits=0, frametemp=0, i=0, gb=0, gb.T=0, mP=0, lperiod=0, d=0,ts=0, mml_wdth[13],
    bml.33.Cnt = 26, bml.50.Cnt = 12;

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

int init() {


   switch ( Period() )
         {
          case    1: Px =   Px*60; FWx =  FWx*60; tx = 10;  break;
          case    5: Px =   Px*12; FWx =  FWx*12; tx = 20;  break;
          case   15: Px =   Px*4;  FWx =  FWx*4;  tx = 20;  break;
          case   30: Px =   Px*2;  FWx =  FWx*2;  tx = 20;  break;
          case   60: Px =   Px;    FWx =  FWx;    tx = 50;  break;
          case  240: Px =   Px/2;  FWx =  FWx;    tx = 50;  break;
          case 1440: Px =   Px/2;  FWx =  FWx;    tx = 50;  break;
          case 10080:Px =   Px;    FWx =  FWx;    tx = 50;  break;
            default: Px =   Px;    FWx =  FWx;    tx = 50;  break;
         }

//---- indicators
   ln_txt[0]  = "                   [-2/8] ";
   ln_txt[1]  = "                   [-1/8] ";
   ln_txt[2]  = "                   [0/8] ";
   ln_txt[3]  = "                   [1/8] ";
   ln_txt[4]  = "                   [2/8] ";
   ln_txt[5]  = "                   [3/8] ";
   ln_txt[6]  = "                   [4/8] ";
   ln_txt[7]  = "                   [5/8] ";
   ln_txt[8]  = "                   [6/8] ";
   ln_txt[9]  = "                   [7/8] ";
   ln_txt[10] = "                   [8/8] ";
   ln_txt[11] = "                   [+1/8] ";
   ln_txt[12] = "                   [+2/8] ";
//+------------------------------------------------------------------+    
   mml_wdth[0] = 0;
   mml_wdth[1] = 0;
   mml_wdth[2] = 0;
   mml_wdth[3] = 0;
   mml_wdth[4] = 0;
   mml_wdth[5] = 0;
   mml_wdth[6] = 0;
   mml_wdth[7] = 0;
   mml_wdth[8] = 0;
   mml_wdth[9] = 0;
   mml_wdth[10] = 0;
   mml_wdth[11] = 0;
   mml_wdth[12] = 0;
//+------------------------------------------------------------------+   
   ln_tx[0]  = "";
   ln_tx[1]  = "";
   ln_tx[2]  = "";
   ln_tx[3]  = "";
   ln_tx[4]  = "";
   ln_tx[5]  = "";
   ln_tx[6]  = "";
   ln_tx[7]  = "";
   ln_tx[8]  = "";
   ln_tx[9]  = "";
   ln_tx[10] = "";
   ln_tx[11] = "";
   ln_tx[12] = "";
//+------------------------------------------------------------------+ 
   mml_shft = 0;//original was 3
   mml_thk  = 3;
//+------------------------------------------------------------------+  
   mml_clr[0]  = CLR_NONE;//Red;
   mml_clr[1]  = CLR_NONE;//Orange;
   mml_clr[2]  = CLR_NONE;//Aqua;
   mml_clr[3]  = CLR_NONE;//Yellow;
   mml_clr[4]  = CLR_NONE;//HotPink;
   mml_clr[5]  = CLR_NONE;//Lime;
   mml_clr[6]  = CLR_NONE;//midcolx;
   mml_clr[7]  = CLR_NONE;//Lime;
   mml_clr[8]  = CLR_NONE;//HotPink;
   mml_clr[9]  = CLR_NONE;//Yellow;
   mml_clr[10] = CLR_NONE;//Aqua;
   mml_clr[11] = CLR_NONE;//Orange;
   mml_clr[12] = CLR_NONE;//Red;
//+------------------------------------------------------------------+ 
/*  bn_v1 = Lowest(NULL,0,MODE_LOW,0);
  bn_v2 = Highest(NULL,0,MODE_HIGH,0);

  v1 = Low[bn_v1];
  v2 = High[bn_v2];*/

   return(0);
  }

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

int deinit() {
//---- TODO: add your code here
Comment(" ");   
//+------------------------------------------------------------------+ 
for(i=0;i25000)      fractal = 100000;
  if(v2x<=25000    && v2x>2500)       fractal = 10000;
  if(v2x<=2500     && v2x>250)        fractal = 1000;
  if(v2x<=250      && v2x>25)         fractal = 100;
  if(v2x<=25       && v2x>12.5)       fractal = 12.5;
  if(v2x<=12.5     && v2x>6.25)       fractal = 12.5;
  if(v2x<=6.25     && v2x>3.125)      fractal = 6.25;
  if(v2x<=3.125    && v2x>1.5625)     fractal = 3.125;
  if(v2x<=1.5625   && v2x>0.390625)   fractal = 1.5625;
  if(v2x<=0.390625 && v2x>0)          fractal = 0.1953125;
//+------------------------------------------------------------------+       
   range=(v2x-v1x);
   sum=MathFloor(MathLog(fractal/range)/MathLog(2));
   octave=fractal *(MathPow(0.5,sum));
   mn=MathFloor(v1x/octave)*octave;
   if( (mn+octave+(octave*0.3333) )> v2x ) 
   mx=mn+octave; 
   else
   mx=mn+(2*octave);
//+------------------------------------------------------------------+ 
  //xx
  if(    (v1x >= (3*(mx-mn)/16+mn))  
      && (v2x <= (9*(mx-mn)/16+mn))    ) 
      x2 = mn+(mx-mn)/2; else x2 = 0;
  //x1
  if(    (v1x >= (mn-(mx-mn)/8))     
      && (v2x <= (5*(mx-mn)/8+mn)) 
      && (x2 == 0)                    ) 
      x1 = mn+(mx-mn)/2; else x1=0;
  //x4
  if(    (v1x >= (mn+7*(mx-mn)/16))  
      && (v2x <= (13*(mx-mn)/16+mn))   ) 
      x4 = mn+3*(mx-mn)/4; else x4 = 0;
  //x5
  if(    (v1x >= (mn+3*(mx-mn)/8))   
      && (v2x <= (9*(mx-mn)/8+mn)) 
      && (x4 == 0)                    ) 
      x5 = mx; else x5 = 0;
  //x3
  if(    (v1x >= (mn+(mx-mn)/8))     
      && (v2x <= (7*(mx-mn)/8+mn)) 
      && (x1 == 0) 
      && (x2 == 0) 
      && (x4 == 0) 
      && (x5 == 0)                    ) 
      x3 = mn+3*(mx-mn)/4; else x3 = 0;
  //x6 when we have no sbj, du {}
  if((x1+x2+x3+x4+x5)==0) x6 = mx; else x6 = 0;

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

  finalL = y1+y2+y3+y4+y5+y6;  
//+------------------------------------------------------------------+ 
double xo = (finalH-finalL);
double xmm = xo/8;
//+------------------------------------------------------------------+ 
    for( i=0; i        

Recommend