//+------------------------------------------------------------------+
//|                    MoStAsHaR15 Forex © 2010                      |
//+------------------------------------------------------------------+

#property copyright "MoStAsHaR14 Forex"
#property indicator_separate_window
#property indicator_buffers 1

// ===================================================================

extern int P = 64;
extern int StepBack = 0;

extern bool SoundAlert = true;
extern bool DrawBox = true;
extern bool PipDif = true;
extern bool MidLines = false;

extern color No_Trade = Salmon;
extern color Ok_Trade = LightCyan;

double ExtBuffer[];

int pips,digits;
double Sup, Res;

double  dmml = 0,
        dvtl = 0,
        sum  = 0,
        v1 = 0,
        v2 = 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,
        octave = 0,
        fractal = 0,
        range   = 0,
        finalH  = 0,
        finalL  = 0,
        mml[13];

string  ln_txt[13],        
        buff_str = "";
        
int     
        bn_v1   = 0,
        bn_v2   = 0,
        OctLinesCnt = 13,
        mml_thk = 8,
        mml_clr[13],
        mml_shft = 3,
        nTime = 0,
        CurPeriod = 0,
        nDigits = 0,
        i = 0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() {
//---- indicators
   
   SetIndexBuffer(0,ExtBuffer);
   ExtBuffer[0] = 0;
   
   IndicatorShortName("MA");
   
   if(Symbol()=="GBPJPY" || Symbol()=="EURJPY" || Symbol()=="USDJPY" || Symbol()=="GOLD" || Symbol()=="USDMXN") pips = 100;
   if(Symbol()=="GBPUSD" || Symbol()=="EURUSD" || Symbol()=="NZDUSD" || Symbol()=="USDCHF"  ||
   Symbol()=="USDCAD" || Symbol()=="AUDUSD" || Symbol()=="EURUSD" || Symbol()=="EURCHF"  || Symbol()=="EURGBP"
   || Symbol()=="EURCAD" || Symbol()=="EURAUD" )pips = 10000;
   
   if(Symbol()=="GBPJPY" || Symbol()=="EURJPY" || Symbol()=="USDJPY" || Symbol()=="GOLD" || Symbol()=="USDMXN") digits = 3;
   if(Symbol()=="GBPUSD" || Symbol()=="EURUSD" || Symbol()=="NZDUSD" || Symbol()=="USDCHF"  ||
   Symbol()=="USDCAD" || Symbol()=="AUDUSD" || Symbol()=="EURUSD" || Symbol()=="EURCHF"  || Symbol()=="EURGBP"
   || Symbol()=="EURCAD" || Symbol()=="EURAUD" )digits = 5;
   
   ln_txt[0]  = "[-2/8]P";
   ln_txt[1]  = "[-1/8]P";
   ln_txt[2]  = "[0/8] - Ultimate Support";
   ln_txt[3]  = "[1/8] - Weak Reverse";
   ln_txt[4]  = "[2/8] - Strong Reverse";
   ln_txt[5]  = "[3/8] - Lower Range";
   ln_txt[6]  = "[4/8] - Pivotal Point";
   ln_txt[7]  = "[5/8] - Upper Rang";
   ln_txt[8]  = "[6/8] - Strong Reverse";
   ln_txt[9]  = "[7/8] - Weak Reverse";
   ln_txt[10] = "[8/8] - Ultimate Resistance";
   ln_txt[11] = "[+1/8]P";
   ln_txt[12] = "[+2/8]P";

   mml_shft = 50;
   mml_thk  = 3;

   mml_clr[0]  = Gold;        //  [-2]/8
   mml_clr[1]  = Yellow;        //  [-1]/8
   mml_clr[2]  = Blue;         //  [0]/8
   mml_clr[3]  = Magenta;      //  [1]/8
   mml_clr[4]  = Red;          //  [2]/8
   mml_clr[5]  = Green;       //  [3]/8
   mml_clr[6]  = Blue;         //  [4]/8
   mml_clr[7]  = Green;       //  [5]/8
   mml_clr[8]  = Red;          //  [6]/8
   mml_clr[9]  = Magenta;      //  [7]/8
   mml_clr[10] = Blue;         //  [8]/8
   mml_clr[11] = Yellow;        //  [+1]/8
   mml_clr[12] = Gold;        //  [+2]/8
//----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit() {
//---- TODO: add your code here
Comment(" ");   
for(i=0;i<OctLinesCnt;i++) {
    buff_str = "mml"+i;
    ObjectDelete(buff_str);
    buff_str = "mml_txt"+i;
    ObjectDelete(buff_str);
    
    ObjectDelete("Rectangle1");
    ObjectDelete("Rectangle2");
    ObjectDelete("Rectangle3");

    ObjectDelete("txt0");
    ObjectDelete("txt1");
    ObjectDelete("txt2");
    ObjectDelete("txt3");
    ObjectDelete("txt4");
    ObjectDelete("txt5");
    ObjectDelete("txt6");
    ObjectDelete("txt7");
    ObjectDelete("txt8");
    ObjectDelete("txt9");
    ObjectDelete("txt10");
    ObjectDelete("txt11");
    ObjectDelete("txt12");
    
    ObjectDelete("txt13");
    ObjectDelete("txt14");
    ObjectDelete("txt15");
    ObjectDelete("txt16");
    ObjectDelete("txt17");
    ObjectDelete("txt18");
    ObjectDelete("txt19");
    ObjectDelete("txt20");
    ObjectDelete("txt21");
    ObjectDelete("txt22");
    ObjectDelete("txt23");
    
    ObjectDelete("midLine_0");
    ObjectDelete("midLine_1");
    ObjectDelete("midLine_2");
    ObjectDelete("midLine_3");
    ObjectDelete("midLine_4");
    ObjectDelete("midLine_5");
    ObjectDelete("midLine_6");
    ObjectDelete("midLine_7");
    ObjectDelete("midLine_8");
    ObjectDelete("midLine_9");
    ObjectDelete("midLine_10");
    ObjectDelete("midLine_11");

    }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {

//---- TODO: add your code here

if( (nTime != Time[0]) || (CurPeriod != Period()) ) {
   
  //price
   bn_v1 = Lowest(NULL,0,MODE_LOW,P+StepBack,0);
   bn_v2 = Highest(NULL,0,MODE_HIGH,P+StepBack,0);

   v1 = Low[bn_v1];
   v2 = High[bn_v2];

//determine fractal.....
   if( v2<=250000 && v2>25000 )
   fractal=100000;
   else
     if( v2<=25000 && v2>2500 )
     fractal=10000;
     else
       if( v2<=2500 && v2>250 )
       fractal=1000;
       else
         if( v2<=250 && v2>25 )
         fractal=100;
         else
           if( v2<=25 && v2>12.5 )
           fractal=12.5;
           else
             if( v2<=12.5 && v2>6.25)
             fractal=12.5;
             else
               if( v2<=6.25 && v2>3.125 )
               fractal=6.25;
               else
                 if( v2<=3.125 && v2>1.5625 )
                 fractal=3.125;
                 else
                   if( v2<=1.5625 && v2>0.390625 )
                   fractal=1.5625;
                   else
                     if( v2<=0.390625 && v2>0)
                     fractal=0.1953125;
      
   range=(v2-v1);
   sum=MathFloor(MathLog(fractal/range)/MathLog(2));
   octave=fractal*(MathPow(0.5,sum));
   mn=MathFloor(v1/octave)*octave;
   if( (mn+octave)>v2 )
   mx=mn+octave; 
   else
     mx=mn+(2*octave);


// calculating xx
//x2
    if( (v1>=(3*(mx-mn)/16+mn)) && (v2<=(9*(mx-mn)/16+mn)) )
    x2=mn+(mx-mn)/2; 
    else x2=0;
//x1
    if( (v1>=(mn-(mx-mn)/8))&& (v2<=(5*(mx-mn)/8+mn)) && (x2==0) )
    x1=mn+(mx-mn)/2; 
    else x1=0;

//x4
    if( (v1>=(mn+7*(mx-mn)/16))&& (v2<=(13*(mx-mn)/16+mn)) )
    x4=mn+3*(mx-mn)/4; 
    else x4=0;

//x5
    if( (v1>=(mn+3*(mx-mn)/8))&& (v2<=(9*(mx-mn)/8+mn))&& (x4==0) )
    x5=mx; 
    else  x5=0;

//x3
    if( (v1>=(mn+(mx-mn)/8))&& (v2<=(7*(mx-mn)/8+mn))&& (x1==0) && (x2==0) && (x4==0) && (x5==0) )
    x3=mn+3*(mx-mn)/4; 
    else x3=0;

//x6
    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;

    for( i=0; i<OctLinesCnt; i++) {
         mml[i] = 0;
         }
         
   dmml = (finalH-finalL)/8;

   mml[0] =(finalL-dmml*2); //-2/8
   for( i=1; i<OctLinesCnt; i++) {
        mml[i] = mml[i-1] + dmml;
        }
   for( i=0; i<OctLinesCnt; i++ ){
        buff_str = "mml"+i;
        if(ObjectFind(buff_str) == -1) {
           ObjectCreate(buff_str, OBJ_HLINE, 0, Time[0], mml[i]);
           ObjectSet(buff_str, OBJPROP_STYLE, STYLE_SOLID);
           ObjectSet(buff_str, OBJPROP_COLOR, mml_clr[i]);
           ObjectSet(buff_str, OBJPROP_WIDTH, 2);
           ObjectMove(buff_str, 0, Time[0],  mml[i]);
           }
        else {
           ObjectMove(buff_str, 0, Time[0],  mml[i]);
           }
             
        buff_str = "mml_txt"+i;
        if(ObjectFind(buff_str) == -1) {
           ObjectCreate(buff_str, OBJ_TEXT, 0, Time[mml_shft], mml_shft);
           ObjectSetText(buff_str, ln_txt[i], 8, "Arial", mml_clr[i]);
           ObjectMove(buff_str, 0, Time[mml_shft],  mml[i]);
           }
        else {
           ObjectMove(buff_str, 0, Time[mml_shft],  mml[i]);
           }
        } // for( i=1; i<=OctLinesCnt; i++ ){

   nTime    = Time[0];
   CurPeriod= Period();

   }
 
    double mml0 = ObjectGet("mml0",OBJPROP_PRICE1);
    double mml1 = ObjectGet("mml1",OBJPROP_PRICE1);
    double mml2 = ObjectGet("mml2",OBJPROP_PRICE1);
    double mml3 = ObjectGet("mml3",OBJPROP_PRICE1);
    double mml4 = ObjectGet("mml4",OBJPROP_PRICE1);
    double mml5 = ObjectGet("mml5",OBJPROP_PRICE1);
    double mml6 = ObjectGet("mml6",OBJPROP_PRICE1);
    double mml7 = ObjectGet("mml7",OBJPROP_PRICE1);
    double mml8 = ObjectGet("mml8",OBJPROP_PRICE1);
    double mml9 = ObjectGet("mml9",OBJPROP_PRICE1);
    double mml10 = ObjectGet("mml10",OBJPROP_PRICE1);
    double mml11 = ObjectGet("mml11",OBJPROP_PRICE1);
    double mml12 = ObjectGet("mml12",OBJPROP_PRICE1);

    double mml_mid_0  = (mml0 + mml1)/2;
    double mml_mid_1  = (mml1 + mml2)/2;
    double mml_mid_2  = (mml2 + mml3)/2;
    double mml_mid_3  = (mml3 + mml4)/2;
    double mml_mid_4  = (mml4 + mml5)/2;
    double mml_mid_5  = (mml5 + mml6)/2;
    double mml_mid_6  = (mml6 + mml7)/2;
    double mml_mid_7  = (mml7 + mml8)/2;
    double mml_mid_8  = (mml8 + mml9)/2;
    double mml_mid_9  = (mml9 + mml10)/2;
    double mml_mid_10 = (mml10 + mml11)/2;
    double mml_mid_11 = (mml11 + mml12)/2;
    
    string dif_0  = DoubleToStr((mml0- Bid)*pips,0);
    string dif_1  = DoubleToStr((mml1- Bid)*pips,0);
    string dif_2  = DoubleToStr((mml2- Bid)*pips,0);
    string dif_3  = DoubleToStr((mml3- Bid)*pips,0);
    string dif_4  = DoubleToStr((mml4- Bid)*pips,0);
    string dif_5  = DoubleToStr((mml5- Bid)*pips,0);
    string dif_6  = DoubleToStr((mml6- Bid)*pips,0);
    string dif_7  = DoubleToStr((mml7- Bid)*pips,0);
    string dif_8  = DoubleToStr((mml8- Bid)*pips,0);
    string dif_9  = DoubleToStr((mml9- Bid)*pips,0);
    string dif_10 = DoubleToStr((mml10- Bid)*pips,0);
    string dif_11  = DoubleToStr((mml11- Bid)*pips,0);
    string dif_12  = DoubleToStr((mml12- Bid)*pips,0);
          
    string dif_mid_0 = DoubleToStr((mml_mid_0 - Bid)*pips,0);
    string dif_mid_1 = DoubleToStr((mml_mid_1 - Bid)*pips,0);
    string dif_mid_2 = DoubleToStr((mml_mid_2 - Bid)*pips,0);
    string dif_mid_3 = DoubleToStr((mml_mid_3 - Bid)*pips,0);
    string dif_mid_4 = DoubleToStr((mml_mid_4 - Bid)*pips,0);
    string dif_mid_5 = DoubleToStr((mml_mid_5 - Bid)*pips,0);
    string dif_mid_6 = DoubleToStr((mml_mid_6 - Bid)*pips,0);
    string dif_mid_7 = DoubleToStr((mml_mid_7 - Bid)*pips,0);
    string dif_mid_8 = DoubleToStr((mml_mid_8 - Bid)*pips,0);
    string dif_mid_9 = DoubleToStr((mml_mid_9 - Bid)*pips,0);
    string dif_mid_10 = DoubleToStr((mml_mid_10 - Bid)*pips,0);
    string dif_mid_11 = DoubleToStr((mml_mid_11 - Bid)*pips,0);

    ObjectDelete("Rectangle1");
    ObjectDelete("Rectangle2");
    ObjectDelete("Rectangle3");

    ObjectDelete("txt0");
    ObjectDelete("txt1");
    ObjectDelete("txt2");
    ObjectDelete("txt3");
    ObjectDelete("txt4");
    ObjectDelete("txt5");
    ObjectDelete("txt6");
    ObjectDelete("txt7");
    ObjectDelete("txt8");
    ObjectDelete("txt9");
    ObjectDelete("txt10");
    ObjectDelete("txt11");
    ObjectDelete("txt12");
    
    ObjectDelete("txt13");
    ObjectDelete("txt14");
    ObjectDelete("txt15");
    ObjectDelete("txt16");
    ObjectDelete("txt17");
    ObjectDelete("txt18");
    ObjectDelete("txt19");
    ObjectDelete("txt20");
    ObjectDelete("txt21");
    ObjectDelete("txt22");
    ObjectDelete("txt23");
    ObjectDelete("txt24");
    
    ObjectDelete("midLine_0");
    ObjectDelete("midLine_1");
    ObjectDelete("midLine_2");
    ObjectDelete("midLine_3");
    ObjectDelete("midLine_4");
    ObjectDelete("midLine_5");
    ObjectDelete("midLine_6");
    ObjectDelete("midLine_7");
    ObjectDelete("midLine_8");
    ObjectDelete("midLine_9");
    ObjectDelete("midLine_10");
    ObjectDelete("midLine_11");
    
   // Determining Bounding Murrey Lines  
   if((Bid-mml0) * (Bid-mml1) < 0)
    {
     Sup = mml0;
     Res = mml1;
    }
    
   if((Bid-mml1) * (Bid-mml2) < 0)
    {
     Sup = mml1;
     Res = mml2;
    }
   
   if((Bid-mml2) * (Bid-mml3) < 0)
    {
     Sup = mml2;
     Res = mml3;
    }  
   
   if((Bid-mml3) * (Bid-mml4) < 0)
    {
     Sup = mml3;
     Res = mml4;
    }
    
   if((Bid-mml4) * (Bid-mml5) < 0)
    {
     Sup = mml4;
     Res = mml5;
    }
   
   if((Bid-mml5) * (Bid-mml6) < 0)
    {
     Sup = mml5;
     Res = mml6;
    }

   if((Bid-mml6) * (Bid-mml7) < 0)
    {
     Sup = mml6;
     Res = mml7;
    }
   if((Bid-mml7) * (Bid-mml8) < 0)
    {
     Sup = mml7;
     Res = mml8;
    }
   if((Bid-mml8) * (Bid-mml9) < 0)
    {
     Sup = mml8;
     Res = mml9;
    }
   if((Bid-mml9) * (Bid-mml10) < 0)
    {
     Sup = mml9;
     Res = mml10;
    }
   if((Bid-mml10) * (Bid-mml11) < 0)
    {
     Sup = mml10;
     Res = mml11;
    }
   if((Bid-mml11) * (Bid-mml12) < 0)
    {
     Sup = mml11;
     Res = mml12;
    }

  if(DrawBox == True)
   {
    ObjectCreate("Rectangle1",OBJ_RECTANGLE,0,Time[0],mml10,Time[359],mml12);
    ObjectSet("Rectangle1",OBJPROP_SCALE,1.0);
    ObjectSet("Rectangle1",OBJPROP_COLOR,No_Trade);
    
    ObjectCreate("Rectangle2",OBJ_RECTANGLE,0,Time[0],mml0,Time[359],mml2);
    ObjectSet("Rectangle2",OBJPROP_SCALE,1.0);
    ObjectSet("Rectangle2",OBJPROP_COLOR,No_Trade);
    
    ObjectCreate("Rectangle3",OBJ_RECTANGLE,0,Time[0],mml2,Time[359],mml10);
    ObjectSet("Rectangle3",OBJPROP_SCALE,1.0);
    ObjectSet("Rectangle3",OBJPROP_COLOR,Ok_Trade);
   }
  
  if(PipDif == True)  
   {
    ObjectCreate("txt0",OBJ_TEXT,0,Time[27],mml0);
    ObjectSetText("txt0", dif_0 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt1",OBJ_TEXT,0,Time[27],mml1);
    ObjectSetText("txt1", dif_1 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt2",OBJ_TEXT,0,Time[27],mml2);
    ObjectSetText("txt2", dif_2 , 8, "Times New Roman", Blue);

    ObjectCreate("txt3",OBJ_TEXT,0,Time[27],mml3);
    ObjectSetText("txt3", dif_3 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt4",OBJ_TEXT,0,Time[27],mml4);
    ObjectSetText("txt4", dif_4 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt5",OBJ_TEXT,0,Time[27],mml5);
    ObjectSetText("txt5", dif_5 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt6",OBJ_TEXT,0,Time[27],mml6);
    ObjectSetText("txt6", dif_6 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt7",OBJ_TEXT,0,Time[27],mml7);
    ObjectSetText("txt7", dif_7 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt8",OBJ_TEXT,0,Time[27],mml8);
    ObjectSetText("txt8", dif_8 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt9",OBJ_TEXT,0,Time[27],mml9);
    ObjectSetText("txt9", dif_9 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt10",OBJ_TEXT,0,Time[27],mml10);
    ObjectSetText("txt10", dif_10 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt11",OBJ_TEXT,0,Time[27],mml11);
    ObjectSetText("txt11", dif_11 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt12",OBJ_TEXT,0,Time[27],mml12);
    ObjectSetText("txt12", dif_12 , 8, "Times New Roman", Blue);
   } 

  if(MidLines == True)  
   {
    ObjectCreate("midLine_0",OBJ_HLINE,0,0,mml_mid_0);
    ObjectSet("midLine_0", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_0", OBJPROP_STYLE, STYLE_DOT);    

    ObjectCreate("midLine_1",OBJ_HLINE,0,0,mml_mid_1);
    ObjectSet("midLine_1", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_1", OBJPROP_STYLE, STYLE_DOT);    

    ObjectCreate("midLine_2",OBJ_HLINE,0,0,mml_mid_2);
    ObjectSet("midLine_2", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_2", OBJPROP_STYLE, STYLE_DOT);    

    ObjectCreate("midLine_3",OBJ_HLINE,0,0,mml_mid_3);
    ObjectSet("midLine_3", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_3", OBJPROP_STYLE, STYLE_DOT);    

    ObjectCreate("midLine_4",OBJ_HLINE,0,0,mml_mid_4);
    ObjectSet("midLine_4", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_4", OBJPROP_STYLE, STYLE_DOT);    

    ObjectCreate("midLine_5",OBJ_HLINE,0,0,mml_mid_5);
    ObjectSet("midLine_5", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_5", OBJPROP_STYLE, STYLE_DOT);    

    ObjectCreate("midLine_6",OBJ_HLINE,0,0,mml_mid_6);
    ObjectSet("midLine_6", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_6", OBJPROP_STYLE, STYLE_DOT);    

    ObjectCreate("midLine_7",OBJ_HLINE,0,0,mml_mid_7);
    ObjectSet("midLine_7", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_7", OBJPROP_STYLE, STYLE_DOT);    

    ObjectCreate("midLine_8",OBJ_HLINE,0,0,mml_mid_8);
    ObjectSet("midLine_8", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_8", OBJPROP_STYLE, STYLE_DOT);    

    ObjectCreate("midLine_9",OBJ_HLINE,0,0,mml_mid_9);
    ObjectSet("midLine_9", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_9", OBJPROP_STYLE, STYLE_DOT);    

    ObjectCreate("midLine_10",OBJ_HLINE,0,0,mml_mid_10);
    ObjectSet("midLine_10", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_10", OBJPROP_STYLE, STYLE_DOT);    

    ObjectCreate("midLine_11",OBJ_HLINE,0,0,mml_mid_11);
    ObjectSet("midLine_11", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_11", OBJPROP_STYLE, STYLE_DOT);
    
   // Determining Bounding Murrey Lines  
   if((Bid-mml0) * (Bid-mml_mid_0) < 0)
    {
     Sup = mml0;
     Res = mml_mid_0;
    }
    
   if((Bid-mml_mid_0) * (Bid-mml1) < 0)
    {
     Sup = mml_mid_0;
     Res = mml1;
    }
   
   if((Bid-mml1) * (Bid-mml_mid_1) < 0)
    {
     Sup = mml1;
     Res = mml_mid_1;
    }  
   
   if((Bid-mml_mid_1) * (Bid-mml2) < 0)
    {
     Sup = mml_mid_1;
     Res = mml2;
    }
    
   if((Bid-mml2) * (Bid-mml_mid_2) < 0)
    {
     Sup = mml2;
     Res = mml_mid_2;
    }
   
   if((Bid-mml_mid_2) * (Bid-mml3) < 0)
    {
     Sup = mml_mid_2;
     Res = mml3;
    }

   if((Bid-mml3) * (Bid-mml_mid_3) < 0)
    {
     Sup = mml3;
     Res = mml_mid_3;
    }
   if((Bid-mml_mid_3) * (Bid-mml4) < 0)
    {
     Sup = mml_mid_3;
     Res = mml4;
    }
   if((Bid-mml4) * (Bid-mml_mid_4) < 0)
    {
     Sup = mml4;
     Res = mml_mid_4;
    }
   if((Bid-mml_mid_4) * (Bid-mml5) < 0)
    {
     Sup = mml_mid_4;
     Res = mml5;
    }
   if((Bid-mml5) * (Bid-mml_mid_5) < 0)
    {
     Sup = mml5;
     Res = mml_mid_5;
    }
   if((Bid-mml_mid_5) * (Bid-mml6) < 0)
    {
     Sup = mml_mid_5;
     Res = mml6;
    }
   if((Bid-mml6) * (Bid-mml_mid_6) < 0)
    {
     Sup = mml6;
     Res = mml_mid_6;
    }
   if((Bid-mml_mid_6) * (Bid-mml7) < 0)
    {
     Sup = mml_mid_6;
     Res = mml7;
    }
   if((Bid-mml7) * (Bid-mml_mid_7) < 0)
    {
     Sup = mml7;
     Res = mml_mid_7;
    }
   if((Bid-mml_mid_7) * (Bid-mml8) < 0)
    {
     Sup = mml_mid_7;
     Res = mml8;
    }
   if((Bid-mml8) * (Bid-mml_mid_8) < 0)
    {
     Sup = mml8;
     Res = mml_mid_8;
    }
   if((Bid-mml_mid_8) * (Bid-mml9) < 0)
    {
     Sup = mml_mid_8;
     Res = mml9;
    } 
   if((Bid-mml9) * (Bid-mml_mid_9) < 0)
    {
     Sup = mml9;
     Res = mml_mid_9;
    }
   if((Bid-mml10) * (Bid-mml_mid_10) < 0)
    {
     Sup = mml10;
     Res = mml_mid_10;
    }
   if((Bid-mml_mid_10) * (Bid-mml11) < 0)
    {
     Sup = mml_mid_10;
     Res = mml11;
    }
   if((Bid-mml11) * (Bid-mml_mid_11) < 0)
    {
     Sup = mml11;
     Res = mml_mid_11;
    }
   if((Bid-mml_mid_11) * (Bid-mml12) < 0)
    {
     Sup = mml_mid_11;
     Res = mml12;
    }
        
        if(PipDif == True)  
         {
          ObjectCreate("txt13",OBJ_TEXT,0,Time[27],mml_mid_0);
          ObjectSetText("txt13", dif_mid_0 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt14",OBJ_TEXT,0,Time[27],mml_mid_1);
          ObjectSetText("txt14", dif_mid_1 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt15",OBJ_TEXT,0,Time[27],mml_mid_2);
          ObjectSetText("txt15", dif_mid_2 , 8, "Times New Roman", Black);

          ObjectCreate("txt16",OBJ_TEXT,0,Time[27],mml_mid_3);
          ObjectSetText("txt16", dif_mid_3 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt17",OBJ_TEXT,0,Time[27],mml_mid_4);
          ObjectSetText("txt17", dif_mid_4 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt18",OBJ_TEXT,0,Time[27],mml_mid_5);
          ObjectSetText("txt18", dif_mid_5 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt19",OBJ_TEXT,0,Time[27],mml_mid_6);
          ObjectSetText("txt19", dif_mid_6 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt20",OBJ_TEXT,0,Time[27],mml_mid_7);
          ObjectSetText("txt20", dif_mid_7 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt21",OBJ_TEXT,0,Time[27],mml_mid_8);
          ObjectSetText("txt21", dif_mid_8 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt22",OBJ_TEXT,0,Time[27],mml_mid_9);
          ObjectSetText("txt22", dif_mid_9 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt23",OBJ_TEXT,0,Time[27],mml_mid_10);
          ObjectSetText("txt23", dif_mid_10 , 8, "Times New Roman", Black);

          ObjectCreate("txt24",OBJ_TEXT,0,Time[27],mml_mid_11);
          ObjectSetText("txt24", dif_mid_11 , 8, "Times New Roman", Black);
    
         } 
   }
                   
 Comment("MoStAsHaR15 FoReX - Murrey Advisor",
    "\n","Only use with 4Hr timeframe"); 
    
    if(ObjectGet("Rectangle1",OBJPROP_TIME1)!=Time[0])
     {
      
      ObjectDelete("Rectangle1");
      ObjectDelete("Rectangle2");
      ObjectDelete("Rectangle3");
      
      ObjectDelete("txt0");
      ObjectDelete("txt1");
      ObjectDelete("txt2");
      ObjectDelete("txt3");
      ObjectDelete("txt4");
      ObjectDelete("txt5");
      ObjectDelete("txt6");
      ObjectDelete("txt7");
      ObjectDelete("txt8");
      ObjectDelete("txt9");
      ObjectDelete("txt10");
      ObjectDelete("txt11");
      ObjectDelete("txt12");
      
  if(DrawBox == True)
   {
    ObjectCreate("Rectangle1",OBJ_RECTANGLE,0,Time[0],mml10,Time[359],mml12);
    ObjectSet("Rectangle1",OBJPROP_SCALE,1.0);
    ObjectSet("Rectangle1",OBJPROP_COLOR,Salmon);
    
    ObjectCreate("Rectangle2",OBJ_RECTANGLE,0,Time[0],mml0,Time[359],mml2);
    ObjectSet("Rectangle2",OBJPROP_SCALE,1.0);
    ObjectSet("Rectangle2",OBJPROP_COLOR,Salmon);
    
    ObjectCreate("Rectangle3",OBJ_RECTANGLE,0,Time[0],mml2,Time[359],mml10);
    ObjectSet("Rectangle3",OBJPROP_SCALE,1.0);
    ObjectSet("Rectangle3",OBJPROP_COLOR,LightGreen);
   }
  
  if(PipDif == True)  
   {
    ObjectCreate("txt0",OBJ_TEXT,0,Time[27],mml0);
    ObjectSetText("txt0", dif_0 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt1",OBJ_TEXT,0,Time[27],mml1);
    ObjectSetText("txt1", dif_1 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt2",OBJ_TEXT,0,Time[27],mml2);
    ObjectSetText("txt2", dif_2 , 8, "Times New Roman", Blue);

    ObjectCreate("txt3",OBJ_TEXT,0,Time[27],mml3);
    ObjectSetText("txt3", dif_3 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt4",OBJ_TEXT,0,Time[27],mml4);
    ObjectSetText("txt4", dif_4 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt5",OBJ_TEXT,0,Time[27],mml5);
    ObjectSetText("txt5", dif_5 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt6",OBJ_TEXT,0,Time[27],mml6);
    ObjectSetText("txt6", dif_6 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt7",OBJ_TEXT,0,Time[27],mml7);
    ObjectSetText("txt7", dif_7 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt8",OBJ_TEXT,0,Time[27],mml8);
    ObjectSetText("txt8", dif_8 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt9",OBJ_TEXT,0,Time[27],mml9);
    ObjectSetText("txt9", dif_9 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt10",OBJ_TEXT,0,Time[27],mml10);
    ObjectSetText("txt10", dif_10 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt11",OBJ_TEXT,0,Time[27],mml11);
    ObjectSetText("txt11", dif_11 , 8, "Times New Roman", Blue);
    
    ObjectCreate("txt12",OBJ_TEXT,0,Time[27],mml12);
    ObjectSetText("txt12", dif_12 , 8, "Times New Roman", Blue);
   }                         
      
     if(MidLines == True)  
   {
    ObjectCreate("midLine_0",OBJ_HLINE,0,0,mml_mid_0);
    ObjectSet("midLine_0", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_0", OBJPROP_STYLE, STYLE_SOLID);    

    ObjectCreate("midLine_1",OBJ_HLINE,0,0,mml_mid_1);
    ObjectSet("midLine_1", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_1", OBJPROP_STYLE, STYLE_SOLID);    

    ObjectCreate("midLine_2",OBJ_HLINE,0,0,mml_mid_2);
    ObjectSet("midLine_2", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_2", OBJPROP_STYLE, STYLE_SOLID);    

    ObjectCreate("midLine_3",OBJ_HLINE,0,0,mml_mid_3);
    ObjectSet("midLine_3", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_3", OBJPROP_STYLE, STYLE_SOLID);    

    ObjectCreate("midLine_4",OBJ_HLINE,0,0,mml_mid_4);
    ObjectSet("midLine_4", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_4", OBJPROP_STYLE, STYLE_SOLID);    

    ObjectCreate("midLine_5",OBJ_HLINE,0,0,mml_mid_5);
    ObjectSet("midLine_5", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_5", OBJPROP_STYLE, STYLE_SOLID);    

    ObjectCreate("midLine_6",OBJ_HLINE,0,0,mml_mid_6);
    ObjectSet("midLine_6", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_6", OBJPROP_STYLE, STYLE_SOLID);    

    ObjectCreate("midLine_7",OBJ_HLINE,0,0,mml_mid_7);
    ObjectSet("midLine_7", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_7", OBJPROP_STYLE, STYLE_SOLID);    

    ObjectCreate("midLine_8",OBJ_HLINE,0,0,mml_mid_8);
    ObjectSet("midLine_8", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_8", OBJPROP_STYLE, STYLE_SOLID);    

    ObjectCreate("midLine_9",OBJ_HLINE,0,0,mml_mid_9);
    ObjectSet("midLine_9", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_9", OBJPROP_STYLE, STYLE_SOLID);    

    ObjectCreate("midLine_10",OBJ_HLINE,0,0,mml_mid_10);
    ObjectSet("midLine_10", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_10", OBJPROP_STYLE, STYLE_SOLID);    

    ObjectCreate("midLine_11",OBJ_HLINE,0,0,mml_mid_11);
    ObjectSet("midLine_11", OBJPROP_COLOR, Gray);
    ObjectSet("midLine_11", OBJPROP_STYLE, STYLE_SOLID);    
        
        if(PipDif == True)  
         {
          ObjectCreate("txt13",OBJ_TEXT,0,Time[27],mml_mid_0);
          ObjectSetText("txt13", dif_mid_0 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt14",OBJ_TEXT,0,Time[27],mml_mid_1);
          ObjectSetText("txt14", dif_mid_1 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt15",OBJ_TEXT,0,Time[27],mml_mid_2);
          ObjectSetText("txt15", dif_mid_2 , 8, "Times New Roman", Black);

          ObjectCreate("txt16",OBJ_TEXT,0,Time[27],mml_mid_3);
          ObjectSetText("txt16", dif_mid_3 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt17",OBJ_TEXT,0,Time[27],mml_mid_4);
          ObjectSetText("txt17", dif_mid_4 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt18",OBJ_TEXT,0,Time[27],mml_mid_5);
          ObjectSetText("txt18", dif_mid_5 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt19",OBJ_TEXT,0,Time[27],mml_mid_6);
          ObjectSetText("txt19", dif_mid_6 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt20",OBJ_TEXT,0,Time[27],mml_mid_7);
          ObjectSetText("txt20", dif_mid_7 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt21",OBJ_TEXT,0,Time[27],mml_mid_8);
          ObjectSetText("txt21", dif_mid_8 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt22",OBJ_TEXT,0,Time[27],mml_mid_9);
          ObjectSetText("txt22", dif_mid_9 , 8, "Times New Roman", Black);
    
          ObjectCreate("txt23",OBJ_TEXT,0,Time[27],mml_mid_10);
          ObjectSetText("txt23", dif_mid_10 , 8, "Times New Roman", Black);

          ObjectCreate("txt24",OBJ_TEXT,0,Time[27],mml_mid_11);
          ObjectSetText("txt24", dif_mid_11 , 8, "Times New Roman", Black);
    
         } 
   }
   
      WindowRedraw();
     }
     
  // Murrey Advisor
      
   string difs = DoubleToStr(((Bid-Sup)/Point)/10,0);
   string difr = DoubleToStr(((Res-Bid)/Point)/10,0);
   
   // Indicator Calculations
   double ADXM_0,ADXM_1,ADXP_0,ADXP_1,ADXN_0,ADXN_1;
   
   ADXM_0 = iADX(NULL,0,14,PRICE_CLOSE,MODE_MAIN,0);
   ADXM_1 = iADX(NULL,0,14,PRICE_CLOSE,MODE_MAIN,1);
   
   ADXP_0 = iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,0);
   ADXP_1 = iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,1);

   ADXN_0 = iADX(NULL,0,14,PRICE_CLOSE,MODE_MINUSDI,0);
   ADXN_1 = iADX(NULL,0,14,PRICE_CLOSE,MODE_MINUSDI,1);

   // Print Out (Separate Window)
   
        //01 Trade Pair
        ObjectCreate("MA", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("MA",StringSubstr(Symbol(),0),12, "Arial Bold", Yellow);
        ObjectSet("MA", OBJPROP_CORNER, 0);
        ObjectSet("MA", OBJPROP_XDISTANCE, 25);
        ObjectSet("MA", OBJPROP_YDISTANCE, 2);
        
        //02 Market Price
        string  curprice = DoubleToStr(Close[0],digits);

        ObjectCreate("37vc", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("37vc","Current Price:",10, "Arial", White);
        ObjectSet("37vc", OBJPROP_CORNER, 0);
        ObjectSet("37vc", OBJPROP_XDISTANCE, 25);
        ObjectSet("37vc", OBJPROP_YDISTANCE, 20);        
        ObjectCreate("37vb", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("37vb",curprice,10, "Arial Bold", Yellow);
        ObjectSet("37vb", OBJPROP_CORNER, 0);
        ObjectSet("37vb", OBJPROP_XDISTANCE, 170);
        ObjectSet("37vb", OBJPROP_YDISTANCE, 20);        

        //03 Resistance
        string restxt = DoubleToStr(Res,digits);
        
        ObjectCreate("TSR6", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR6","Current Resistance:", 10, "Arial ", White);
        ObjectSet("TSR6", OBJPROP_CORNER, 0);
        ObjectSet("TSR6", OBJPROP_XDISTANCE, 25);
        ObjectSet("TSR6", OBJPROP_YDISTANCE, 35);
        ObjectCreate("TSR7", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR7",restxt,10, "Arial", Red);
        ObjectSet("TSR7", OBJPROP_CORNER, 0);
        ObjectSet("TSR7", OBJPROP_XDISTANCE, 170);
        ObjectSet("TSR7", OBJPROP_YDISTANCE, 35);

               
        //04 Support
        string suptxt = DoubleToStr(Sup,digits);
        
        ObjectCreate("TSR4", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR4","Current Support:", 10, "Arial ", White);
        ObjectSet("TSR4", OBJPROP_CORNER, 0);
        ObjectSet("TSR4", OBJPROP_XDISTANCE, 25);
        ObjectSet("TSR4", OBJPROP_YDISTANCE, 50);
        ObjectCreate("TSR5", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR5",suptxt,10, "Arial", Lime);
        ObjectSet("TSR5", OBJPROP_CORNER, 0);
        ObjectSet("TSR5", OBJPROP_XDISTANCE, 170);
        ObjectSet("TSR5", OBJPROP_YDISTANCE, 50);
        
        //05 Pips till Resistance
        ObjectCreate("TSR10", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR10","Pips till Resistance:", 10, "Arial ", White);
        ObjectSet("TSR10", OBJPROP_CORNER, 0);
        ObjectSet("TSR10", OBJPROP_XDISTANCE, 25);
        ObjectSet("TSR10", OBJPROP_YDISTANCE, 65);
        ObjectCreate("TSR11", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR11",difr,10, "Arial", Red);
        ObjectSet("TSR11", OBJPROP_CORNER, 0);
        ObjectSet("TSR11", OBJPROP_XDISTANCE, 170);
        ObjectSet("TSR11", OBJPROP_YDISTANCE, 65);
                
        //06 Pips till Support
        ObjectCreate("TSR8", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR8","Pips till Support:", 10, "Arial", White);
        ObjectSet("TSR8", OBJPROP_CORNER, 0);
        ObjectSet("TSR8", OBJPROP_XDISTANCE, 25);
        ObjectSet("TSR8", OBJPROP_YDISTANCE, 80);
        ObjectCreate("TSR9", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR9",difs,10, "Arial", Lime);
        ObjectSet("TSR9", OBJPROP_CORNER, 0);
        ObjectSet("TSR9", OBJPROP_XDISTANCE, 170);
        ObjectSet("TSR9", OBJPROP_YDISTANCE, 80);
        
        //07 LONG STATUS
        ObjectCreate("TSR12", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR12","LONG STATUS", 12, "Arial Bold", Lime);
        ObjectSet("TSR12", OBJPROP_CORNER, 0);
        ObjectSet("TSR12", OBJPROP_XDISTANCE, 240);
        ObjectSet("TSR12", OBJPROP_YDISTANCE, 2);
               
        //08 EMA(5,C) > EMA(6,O)
        double EMA5C = iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,1);
        double EMA6O = iMA(NULL,0,6,0,MODE_EMA,PRICE_OPEN,1);
        int cond_2_num_b = EMA5C > EMA6O + 5 * Point;
        string cond_2_tf_b = "False";
        color cond_2_clr_b = Red;
        if (cond_2_num_b == 1)
         {
          cond_2_tf_b = "True";
          cond_2_clr_b = Lime;
         } 
        ObjectCreate("TSR16", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR16","EMA(5,C) > EMA(6,O)(+5p):",10, "Arial", White);
        ObjectSet("TSR16", OBJPROP_CORNER, 0);
        ObjectSet("TSR16", OBJPROP_XDISTANCE, 240);
        ObjectSet("TSR16", OBJPROP_YDISTANCE, 20);     
        ObjectCreate("TSR17", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR17",cond_2_tf_b, 10, "Arial", cond_2_clr_b);
        ObjectSet("TSR17", OBJPROP_CORNER, 0);
        ObjectSet("TSR17", OBJPROP_XDISTANCE, 430);
        ObjectSet("TSR17", OBJPROP_YDISTANCE, 20);

        //09 Current Open > Support
        int cond_3_num_b = Open[0] > Sup + 3 * Point;
        string cond_3_tf_b = "False";
        color cond_3_clr_b = Red;
        if (cond_3_num_b == 1)
         {
          cond_3_tf_b = "True";
          cond_3_clr_b = Lime;
         } 
        ObjectCreate("TSR19", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR19","Current Open > Sup (+3p):", 10, "Arial ", White);
        ObjectSet("TSR19", OBJPROP_CORNER, 0);
        ObjectSet("TSR19", OBJPROP_XDISTANCE, 240);
        ObjectSet("TSR19", OBJPROP_YDISTANCE, 35);
        ObjectCreate("TSR20", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR20",cond_3_tf_b,10, "Arial", cond_3_clr_b);
        ObjectSet("TSR20", OBJPROP_CORNER, 0);
        ObjectSet("TSR20", OBJPROP_XDISTANCE, 430);
        ObjectSet("TSR20", OBJPROP_YDISTANCE, 35);
        
        //10 POSITIVE ADX
        int cond_4_num_b = ADXM_0 > 21 && ADXM_0 > ADXM_1 && ADXP_0 > ADXN_0 + 3;
        string cond_4_tf_b = "False";
        color cond_4_clr_b = Red;
        if (cond_4_num_b == 1)
         {
          cond_4_tf_b = "True";
          cond_4_clr_b = Lime;
         } 
        ObjectCreate("TSR21", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR21","Positive & Increasing ADX: ",10, "Arial", White);
        ObjectSet("TSR21", OBJPROP_CORNER, 0);
        ObjectSet("TSR21", OBJPROP_XDISTANCE, 240);
        ObjectSet("TSR21", OBJPROP_YDISTANCE, 50);
        ObjectCreate("TSR22", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR22",cond_4_tf_b,10, "Arial",cond_4_clr_b);
        ObjectSet("TSR22", OBJPROP_CORNER, 0);
        ObjectSet("TSR22", OBJPROP_XDISTANCE, 430);
        ObjectSet("TSR22", OBJPROP_YDISTANCE, 50);
        
        //11 H[0,1] < Res by 10pips min
        int cond_5_num_b = High[0] < Res - 10 * Point && High[1] < Res - 10 * Point;
        string cond_5_tf_b = "False";
        color cond_5_clr_b = Red;
        if (cond_5_num_b == 1)
         {
          cond_5_tf_b = "True";
          cond_5_clr_b = Lime;
         } 
        ObjectCreate("TSR23", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR23","H[0,1] < Res (-10p):", 10, "Arial", White);
        ObjectSet("TSR23", OBJPROP_CORNER, 0);
        ObjectSet("TSR23", OBJPROP_XDISTANCE, 240);
        ObjectSet("TSR23", OBJPROP_YDISTANCE, 65);
        ObjectCreate("TSR24", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR24",cond_5_tf_b ,10, "Arial", cond_5_clr_b);
        ObjectSet("TSR24", OBJPROP_CORNER, 0);
        ObjectSet("TSR24", OBJPROP_XDISTANCE, 430);
        ObjectSet("TSR24", OBJPROP_YDISTANCE, 65);
           
        //12 Below 8/8 Level
        int cond_6_num_b = Res <= mml10;
        string cond_6_tf_b = "False";
        color cond_6_clr_b = Red;
        if (cond_6_num_b == 1)
         {
          cond_6_tf_b = "True";
          cond_6_clr_b = Lime;
         } 
        ObjectCreate("TSR23v", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR23v","Below 8/8 Level:", 10, "Arial", White);
        ObjectSet("TSR23v", OBJPROP_CORNER, 0);
        ObjectSet("TSR23v", OBJPROP_XDISTANCE, 240);
        ObjectSet("TSR23v", OBJPROP_YDISTANCE, 80);
        ObjectCreate("TSR24v", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR24v",cond_6_tf_b ,10, "Arial", cond_6_clr_b);
        ObjectSet("TSR24v", OBJPROP_CORNER, 0);
        ObjectSet("TSR24v", OBJPROP_XDISTANCE, 430);
        ObjectSet("TSR24v", OBJPROP_YDISTANCE, 80);

        //13 SHORT STATUS
        ObjectCreate("TSR25", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR25","SHORT STATUS", 12, "Arial Bold", Red);
        ObjectSet("TSR25", OBJPROP_CORNER, 0);
        ObjectSet("TSR25", OBJPROP_XDISTANCE, 500);
        ObjectSet("TSR25", OBJPROP_YDISTANCE, 2);
       
        //14 EMA(5,C) < EMA(6,O)
        int cond_2_num_s = EMA5C < EMA6O - 5 * Point;
        string cond_2_tf_s = "False";
        color cond_2_clr_s = Red;
        if (cond_2_num_s == 1)
         {
          cond_2_tf_s = "True";
          cond_2_clr_s = Lime;
         } 
        ObjectCreate("16", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("16","EMA(5,C) < EMA(6,O)(-5p):",10, "Arial", White);
        ObjectSet("16", OBJPROP_CORNER, 0);
        ObjectSet("16", OBJPROP_XDISTANCE, 500);
        ObjectSet("16", OBJPROP_YDISTANCE, 20);     
        ObjectCreate("17", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("17",cond_2_tf_s, 10, "Arial", cond_2_clr_s);
        ObjectSet("17", OBJPROP_CORNER, 0);
        ObjectSet("17", OBJPROP_XDISTANCE, 690);
        ObjectSet("17", OBJPROP_YDISTANCE, 20);

        //15 Current Open < Resistance
        int cond_3_num_s = Open[0] < Res - 3 * Point;
        string cond_3_tf_s = "False";
        color cond_3_clr_s = Red;
        if (cond_3_num_s == 1)
         {
          cond_3_tf_s = "True";
          cond_3_clr_s = Lime;
         } 
        ObjectCreate("19", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("19","Current Open < Res (-3p):", 10, "Arial ", White);
        ObjectSet("19", OBJPROP_CORNER, 0);
        ObjectSet("19", OBJPROP_XDISTANCE, 500);
        ObjectSet("19", OBJPROP_YDISTANCE, 35);
        ObjectCreate("20", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("20",cond_3_tf_s,10, "Arial", cond_3_clr_s);
        ObjectSet("20", OBJPROP_CORNER, 0);
        ObjectSet("20", OBJPROP_XDISTANCE, 690);
        ObjectSet("20", OBJPROP_YDISTANCE, 35);
        
        //16 NEGATIVE ADX
        int cond_4_num_s = ADXM_0 > 21 && ADXM_0 > ADXM_1 && ADXN_0 > ADXP_0 + 3;
        string cond_4_tf_s = "False";
        color cond_4_clr_s = Red;
        if (cond_4_num_s == 1)
         {
          cond_4_tf_s = "True";
          cond_4_clr_s = Lime;
         } 
        ObjectCreate("21", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("21","Negative & Increasing ADX :",10, "Arial", White);
        ObjectSet("21", OBJPROP_CORNER, 0);
        ObjectSet("21", OBJPROP_XDISTANCE, 500);
        ObjectSet("21", OBJPROP_YDISTANCE, 50);
        ObjectCreate("22", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("22",cond_4_tf_s,10, "Arial",cond_4_clr_s);
        ObjectSet("22", OBJPROP_CORNER, 0);
        ObjectSet("22", OBJPROP_XDISTANCE, 690);
        ObjectSet("22", OBJPROP_YDISTANCE, 50);
        
        //17 L[0,1] > Sup by 10pips min
        double low_00 = Low[0];
        double low_01 = Low[1];
        int cond_5_num_s = low_00 > Sup + 10 * Point && low_01 > Sup + 10 * Point;
        string cond_5_tf_s = "False";
        color cond_5_clr_s = Red;
        if (cond_5_num_s == 1)
         {
          cond_5_tf_s = "True";
          cond_5_clr_s = Lime;
         } 
        ObjectCreate("23", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("23","L[0,1] > Sup (+10p):", 10, "Arial", White);
        ObjectSet("23", OBJPROP_CORNER, 0);
        ObjectSet("23", OBJPROP_XDISTANCE, 500);
        ObjectSet("23", OBJPROP_YDISTANCE, 65);
        ObjectCreate("24", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("24",cond_5_tf_s ,10, "Arial", cond_5_clr_s);
        ObjectSet("24", OBJPROP_CORNER, 0);
        ObjectSet("24", OBJPROP_XDISTANCE, 690);
        ObjectSet("24", OBJPROP_YDISTANCE, 65);
        
        //18 Above 0/8 Level
        int cond_6_num_s = Sup >= mml2;
        string cond_6_tf_s = "False";
        color cond_6_clr_s = Red;
        if (cond_6_num_s == 1)
         {
          cond_6_tf_s = "True";
          cond_6_clr_s = Lime;
         } 
        ObjectCreate("TSR23vx", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR23vx","Above 0/8 Level:", 10, "Arial", White);
        ObjectSet("TSR23vx", OBJPROP_CORNER, 0);
        ObjectSet("TSR23vx", OBJPROP_XDISTANCE, 500);
        ObjectSet("TSR23vx", OBJPROP_YDISTANCE, 80);
        ObjectCreate("TSR24vx", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("TSR24vx",cond_6_tf_s ,10, "Arial", cond_6_clr_s);
        ObjectSet("TSR24vx", OBJPROP_CORNER, 0);
        ObjectSet("TSR24vx", OBJPROP_XDISTANCE, 690);
        ObjectSet("TSR24vx", OBJPROP_YDISTANCE, 80);
        
        //19 Advisor Recommendations
        // HOLD
        ExtBuffer[0] = 0;
        string advisor = "HOLD!";
        int AlertCount = 0;
        color advisor_clr = Orange;
        
        static datetime TimeStamp;
        // LONG
        if(cond_2_num_b + cond_3_num_b + cond_4_num_b + cond_5_num_b + cond_6_num_b == 5)
          {
           ExtBuffer[0] = 1;
           advisor = "Go Long";
           advisor_clr = Lime;
           if(SoundAlert == True)
             {
              if(TimeStamp != Time[0])
               {
                Alert(Symbol(), ":",advisor);
                AlertCount = 1;
                TimeStamp = Time[0];
               }
             }      
          }
        // SHORT
        if(cond_2_num_s + cond_3_num_s + cond_4_num_s + cond_5_num_s + cond_6_num_s == 5)
          {
           ExtBuffer[0] = 2;
           advisor = "Go Short";
           advisor_clr = Red;
           if(SoundAlert == True)
             {
              if(TimeStamp != Time[0])
               {
                Alert(Symbol(), ":",advisor);
                AlertCount = 1;
                TimeStamp = Time[0];
               }
             }      
          }
           
        ObjectCreate("25", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("25",advisor, 12, "Arial Bold", advisor_clr);
        ObjectSet("25", OBJPROP_CORNER, 0);
        ObjectSet("25", OBJPROP_XDISTANCE, 100);
        ObjectSet("25", OBJPROP_YDISTANCE, 2);

        //20 Daily Range Statistics
        double high_0 = iMA(NULL,1440,1,0,MODE_SMA,PRICE_HIGH,0);
        double low_0  = iMA(NULL,1440,1,0,MODE_SMA,PRICE_LOW,0);
        
        double high_1 = iMA(NULL,1440,1,0,MODE_SMA,PRICE_HIGH,1);
        double low_1  = iMA(NULL,1440,1,0,MODE_SMA,PRICE_LOW,1);
        
        double high_2 = iMA(NULL,1440,1,0,MODE_SMA,PRICE_HIGH,2);
        double low_2  = iMA(NULL,1440,1,0,MODE_SMA,PRICE_LOW,2);
        
        double high_3d = iMA(NULL,1440,3,0,MODE_SMA,PRICE_HIGH,1);
        double low_3d  = iMA(NULL,1440,3,0,MODE_SMA,PRICE_LOW,1);

        double high_w = iMA(NULL,1440,7,0,MODE_SMA,PRICE_HIGH,1);
        double low_w  = iMA(NULL,1440,7,0,MODE_SMA,PRICE_LOW,1);
        
        double high_m = iMA(NULL,1440,30,0,MODE_SMA,PRICE_HIGH,1);
        double low_m  = iMA(NULL,1440,30,0,MODE_SMA,PRICE_LOW,1);
        
        string range_0  = DoubleToStr(pips*(high_0 - low_0),0);
        string range_1  = DoubleToStr(pips*(high_1 - low_1),0);
        string range_2  = DoubleToStr(pips*(high_2 - low_2),0);
        string range_3d = DoubleToStr(pips*(high_3d - low_3d),0);        
        string range_w  = DoubleToStr(pips*(high_w - low_w),0);
        string range_m  = DoubleToStr(pips*(high_m - low_m),0);
        
        ObjectCreate("26", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("26","Daily Range Statistics", 12, "Arial Bold", Yellow);
        ObjectSet("26", OBJPROP_CORNER, 0);
        ObjectSet("26", OBJPROP_XDISTANCE, 770);
        ObjectSet("26", OBJPROP_YDISTANCE, 2);
        
        //21 Todays's Range
        ObjectCreate("27", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("27","Todays Range :",10, "Arial", White);
        ObjectSet("27", OBJPROP_CORNER, 0);
        ObjectSet("27", OBJPROP_XDISTANCE, 770);
        ObjectSet("27", OBJPROP_YDISTANCE, 20);
        ObjectCreate("28", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("28",range_0,10, "Arial",Orange);
        ObjectSet("28", OBJPROP_CORNER, 0);
        ObjectSet("28", OBJPROP_XDISTANCE, 930);
        ObjectSet("28", OBJPROP_YDISTANCE, 20);

        //22 Yesterday's Range
        ObjectCreate("29", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("29","Yesterdays Range :",10, "Arial", White);
        ObjectSet("29", OBJPROP_CORNER, 0);
        ObjectSet("29", OBJPROP_XDISTANCE, 770);
        ObjectSet("29", OBJPROP_YDISTANCE, 35);
        ObjectCreate("30", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("30",range_1,10, "Arial",Orange);
        ObjectSet("30", OBJPROP_CORNER, 0);
        ObjectSet("30", OBJPROP_XDISTANCE, 930);
        ObjectSet("30", OBJPROP_YDISTANCE, 35);

        //23 Day Before Range
        ObjectCreate("32", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("32","Day Before Range :",10, "Arial", White);
        ObjectSet("32", OBJPROP_CORNER, 0);
        ObjectSet("32", OBJPROP_XDISTANCE, 770);
        ObjectSet("32", OBJPROP_YDISTANCE, 50);
        ObjectCreate("31", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("31",range_2,10, "Arial",Orange);
        ObjectSet("31", OBJPROP_CORNER, 0);
        ObjectSet("31", OBJPROP_XDISTANCE, 930);
        ObjectSet("31", OBJPROP_YDISTANCE, 50);

        //24 Weekly Range Average
        ObjectCreate("33", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("33","Weekly Range Average :",10, "Arial", White);
        ObjectSet("33", OBJPROP_CORNER, 0);
        ObjectSet("33", OBJPROP_XDISTANCE, 770);
        ObjectSet("33", OBJPROP_YDISTANCE, 65);
        ObjectCreate("34", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("34",range_w,10, "Arial",Orange);
        ObjectSet("34", OBJPROP_CORNER, 0);
        ObjectSet("34", OBJPROP_XDISTANCE, 930);
        ObjectSet("34", OBJPROP_YDISTANCE, 65);

        //25 Monthly Range Average
        ObjectCreate("35", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("35","Monthly Range Average :",10, "Arial", White);
        ObjectSet("35", OBJPROP_CORNER, 0);
        ObjectSet("35", OBJPROP_XDISTANCE, 770);
        ObjectSet("35", OBJPROP_YDISTANCE, 80);
        ObjectCreate("36", OBJ_LABEL, WindowFind("MA"), 0, 0);
        ObjectSetText("36",range_m,10, "Arial",Orange);
        ObjectSet("36", OBJPROP_CORNER, 0);
        ObjectSet("36", OBJPROP_XDISTANCE, 930);
        ObjectSet("36", OBJPROP_YDISTANCE, 80);
        
 
   
//---- End Of Program
  return(0);
  }
//+------------------------------------------------------------------+