From 0 to 100, 100, 100

Once a bona fide turn has taken place, all you have to do is accelerate three times. Or decelerate, depending on the direction.

From 100 to 0, 0, 0

#property copyright "Copyright © 2019, Macdulio" 
#property link      "https://forexfore.blog" 
#property description "V1.0"
#property description "LEMA 30N RF Zero to 100"
#property description "All the moving average pairs"
#property description "you will ever need for trading."
#property description "For further information turn to"
#property description "my blog or my book,"
#property description "Computer Aided Trading"
#property strict;
#property indicator_chart_window
#property indicator_buffers 34
#property indicator_color1 Crimson
#property indicator_color2 Blue
#define  NL    "\n"
extern int lookback = 500;
extern double zero = 6.0;
extern double hundred = 94.0;
extern double FSize=32;
extern bool plot_Spark_Sones = true;
extern bool plot_polarities = true;
extern bool plot_ricochets = false;
extern bool plot_losing_status = true;
extern bool plot_Hull = false;
extern bool plot_Hull_Arrows = false;
extern bool plot_fluctuation_brackets = false;
double FMax = FSize*6/5;
int sample=828;
int       Range_n=34;
int shift = 5;
double ExtMapBuffer[];
double conso[], conso2[];
  double iHi[];
  double iLo[]; 
  double iHi2[];
  double iLo2[];
    double iHi3[];
  double iLo3[];    
    double iHi4[];
  double iLo4[];    
      double iHi5[];
  double iLo5[];  
        double iHi6[];
  double iLo6[];  
double HiBuffer[],LoBuffer[];
double plus[],minus[],vbrl[],vbru[];
double sup[],sdn[],RSI2[],stoch[];
double ExtUpFractalsBuffer[];
double ExtDownFractalsBuffer[];
int fodir[];
double buy[];
double sell[];
double ramp[];
double UR[];
double DR[];
double URE[];
double BE[];
double SE[];
double SE60[];
double BU[];
double BU60[];
  int Hi20[];
  int Lo20[]; 
  double HPR[];
  double LPR[];
  double LCR[];
  double HCR[];
  double bline[];
  double sline[];
  double guardrailu[],guardraild[],guardraildplus[],guardraildminus[];
  double pbrainu[],pbraind[];
   double lowest_price[];
  double highest_price[]; 
  double triu[], trid[];
  extern int HULL = 33;  
  double HighBuffer[],HighBuffer2[];
double LowBuffer[],LowBuffer2[];
double dt14, db14, pacing;
  double HULLU[], HULLD[], MHULL[], inner[], HU[], HD[];
int init()
  {
  
        SetIndexBuffer(0,HighBuffer);
   SetIndexBuffer(1,LowBuffer);   
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,4,clrRed);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,4,clrRed);
  
  
          SetIndexBuffer(2,HighBuffer2);
   SetIndexBuffer(3,LowBuffer2);   
   SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,4,clrGreen);
   SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,4,clrGreen);
  
  
   SetIndexBuffer(29,iHi);
   SetIndexStyle(29,DRAW_LINE,2,8,Blue);
   SetIndexLabel(29, "Highest(" + DoubleToStr(Range_n,0)+")");

   SetIndexBuffer(30,iLo);
   SetIndexStyle(30,DRAW_LINE,2,8,Blue);
   SetIndexLabel(30, "Lowest(" + DoubleToStr(Range_n,0)+")");
   
   SetIndexBuffer(31,bline);
   SetIndexStyle(31,DRAW_LINE,2,5,clrNONE);
 //  SetIndexArrow(2,221);
   SetIndexLabel(31, "Bline(" + DoubleToStr(Range_n,0)+")");
   
   SetIndexBuffer(32,sline);   
   SetIndexStyle(32,DRAW_LINE,2,5,clrNONE);
   SetIndexLabel(32, "Sline(" + DoubleToStr(Range_n,0)+")");
 //  SetIndexArrow(3,222);

   
   SetIndexStyle(4,DRAW_ARROW,EMPTY,7,DarkGreen);
   SetIndexArrow(4,217);
   SetIndexBuffer(4,LCR);
   SetIndexEmptyValue(4,0.0);
   
   SetIndexStyle(5,DRAW_ARROW,EMPTY,7,Yellow);
   SetIndexArrow(5,218);
   SetIndexBuffer(5,HCR);
   SetIndexEmptyValue(5,0.0);

   SetIndexStyle(6,DRAW_ARROW,EMPTY,3,Cyan);
   SetIndexArrow(6,233);
   SetIndexBuffer(6,BE);
   SetIndexEmptyValue(6,0.0);


   SetIndexBuffer(7,iHi2);
   SetIndexStyle(7,DRAW_LINE,2,8,Magenta);
   SetIndexLabel(7, "Highest(" + DoubleToStr(Range_n,0)+")");

   SetIndexBuffer(8,iLo2);
   SetIndexStyle(8,DRAW_LINE,2,8,Magenta);
   SetIndexLabel(8, "Lowest(" + DoubleToStr(Range_n,0)+")");



   SetIndexBuffer(9,iHi3);
   SetIndexStyle(9,DRAW_LINE,2,8,Peru);
 //  SetIndexLabel(9, "Highest(" + DoubleToStr(Range_n,0)+")");

   SetIndexBuffer(10,iLo3);
   SetIndexStyle(10,DRAW_LINE,2,8,Peru);
 //  SetIndexLabel(10, "Lowest(" + DoubleToStr(Range_n,0)+")");


   SetIndexBuffer(11,iHi4);
   SetIndexStyle(11,DRAW_LINE,2,8,MediumSpringGreen);
 //  SetIndexLabel(9, "Highest(" + DoubleToStr(Range_n,0)+")");

   SetIndexBuffer(12,iLo4);
   SetIndexStyle(12,DRAW_LINE,2,8,MediumSpringGreen);
 //  SetIndexLabel(10, "Lowest(" + DoubleToStr(Range_n,0)+")");



   SetIndexBuffer(13,conso2);
   SetIndexStyle(13,DRAW_LINE,2,12,clrNONE);
 //  SetIndexLabel(11, "Lowest(" + DoubleToStr(Range_n,0)+")");

   SetIndexBuffer(14,conso);
   SetIndexStyle(14,DRAW_LINE,2,5,clrNONE);
  // SetIndexLabel(12, "Lowest(" + DoubleToStr(Range_n,0)+")");


   SetIndexBuffer(15,iHi5);
   SetIndexStyle(15,DRAW_LINE,2,8,clrMaroon);


   SetIndexBuffer(16,iLo5);
   SetIndexStyle(16,DRAW_LINE,2,8,clrMaroon);


   SetIndexBuffer(17,iHi6);
   SetIndexStyle(17,DRAW_LINE,2,8,DeepPink);


   SetIndexBuffer(18,iLo6);
   SetIndexStyle(18,DRAW_LINE,2,8,DeepPink);


 SetIndexBuffer(19,guardrailu);
   SetIndexStyle(19,DRAW_LINE,2,12,clrChartreuse);
    SetIndexBuffer(20,guardraild);
   SetIndexStyle(20,DRAW_LINE,2,12,clrChartreuse);
   
   
 SetIndexBuffer(21,pbrainu);
   SetIndexStyle(21,DRAW_LINE,2,12,Purple);
    SetIndexBuffer(22,pbraind);
   SetIndexStyle(22,DRAW_LINE,2,12,Purple);
   
   SetIndexBuffer(23,triu);
   SetIndexStyle(23,DRAW_LINE,2,12,White);
    SetIndexBuffer(24,trid);
   SetIndexStyle(24,DRAW_LINE,2,12,White);
  
       SetIndexBuffer(33,inner);
   SetIndexStyle(33,DRAW_LINE,3,6,clrNONE);
  
  
     SetIndexBuffer(25,HULLU);
   SetIndexStyle(25,DRAW_LINE,3,6,Navy);
   
       SetIndexBuffer(26,HULLD);
   SetIndexStyle(26,DRAW_LINE,3,6,Yellow);
   
   
    SetIndexStyle(27,DRAW_ARROW,EMPTY,5,Yellow);
       SetIndexBuffer(27,HD);
   SetIndexArrow(27,242);

 //  SetIndexEmptyValue(27,0.0);

   SetIndexStyle(28,DRAW_ARROW,EMPTY,5,Cyan);
      SetIndexBuffer(28,HU);
   SetIndexArrow(28,241);


    SetIndexBuffer(29,guardraildplus);
   SetIndexStyle(29,DRAW_LINE,2,6,clrLime);

SetIndexBuffer(30,guardraildminus);
   SetIndexStyle(30,DRAW_LINE,2,6,clrLime);


 //  SetIndexEmptyValue(28,0.0);
   
   
  
//----
   return(0);
  }


int start()
  {
   int    i,j ;     
  

  double xHi[];
  double xLo[];  
  int SPRD[];  
   
  
  string symbol = Symbol();
  ArrayResize(fodir, 300);
ArrayInitialize(fodir, 0);   
  ArrayResize(plus, 500);   
ArrayInitialize(plus, EMPTY_VALUE); 
ArrayResize(minus, 500);   
ArrayInitialize(minus, EMPTY_VALUE);
  ArrayResize(vbru, 200);   
ArrayInitialize(vbru, EMPTY_VALUE);
ArrayResize(vbrl, 200);   
ArrayInitialize(vbrl, EMPTY_VALUE);
  ArrayResize(buy, Bars);
  ArrayResize(sell, Bars);
  ArrayResize(ramp, Bars);
  ArrayInitialize(buy, 0);
  ArrayInitialize(sell, 0);
  ArrayInitialize(ramp, 0);      
  ArrayResize(iHi, Bars);
  ArrayResize(iLo, Bars);
  ArrayInitialize(iHi, EMPTY_VALUE);
  ArrayInitialize(iLo, EMPTY_VALUE);
  ArrayResize(iHi2, Bars);
  ArrayResize(iLo2, Bars);
  ArrayInitialize(iHi2, EMPTY_VALUE);
  ArrayInitialize(iLo2, EMPTY_VALUE);     
  ArrayResize(iHi3, Bars);
  ArrayResize(iLo3, Bars);
  ArrayInitialize(iHi3, EMPTY_VALUE);
  ArrayInitialize(iLo3, EMPTY_VALUE);   
    ArrayResize(iHi4, Bars);
  ArrayResize(iLo4, Bars);
  ArrayInitialize(iHi4, EMPTY_VALUE);
  ArrayInitialize(iLo4, EMPTY_VALUE);     
   ArrayResize(iHi5, Bars);
  ArrayResize(iLo5, Bars);
  ArrayInitialize(iHi5, EMPTY_VALUE);
  ArrayInitialize(iLo5, EMPTY_VALUE);   
   ArrayResize(iHi6, Bars);
  ArrayResize(iLo6, Bars);
  ArrayInitialize(iHi6, EMPTY_VALUE);
  ArrayInitialize(iLo6, EMPTY_VALUE);          
  ArrayResize(xHi, Bars);
  ArrayResize(xLo, Bars);
  ArrayInitialize(xHi, 0);
  ArrayInitialize(xLo, 0);   
  ArrayResize(UR, Bars); 
  ArrayInitialize(UR, 0);    
  ArrayResize(DR, Bars); 
  ArrayInitialize(DR, 0);       
  ArrayResize(URE, Bars); 
  ArrayInitialize(URE, 0);
  ArrayResize(SE, Bars); 
  ArrayInitialize(SE, 0);  
  ArrayResize(BE, Bars); 
  ArrayInitialize(BE, 0);   
  ArrayResize(BU, Bars); 
  ArrayInitialize(BU, 0);     
  ArrayResize(SE60, Bars); 
  ArrayInitialize(SE60, 0);      
  ArrayResize(BU60, Bars); 
  ArrayInitialize(BU60, 0);     
  ArrayResize(SPRD, Bars); 
  ArrayInitialize(SPRD, 0);    
  ArrayResize(Hi20, Bars);
  ArrayResize(Lo20, Bars);
  ArrayInitialize(Hi20, 0);
  ArrayInitialize(Lo20, 0);       
   
  ArrayResize(LPR, Bars); 
  ArrayInitialize(LPR, 0); 
  ArrayResize(HPR, Bars); 
  ArrayInitialize(HPR, 0); 
  
  
  ArrayResize(LCR, Bars); 
  ArrayInitialize(LCR, 0); 
  ArrayResize(HCR, Bars); 
  ArrayInitialize(HCR, 0);
  ArrayResize(ExtUpFractalsBuffer, Bars);   
 ArrayInitialize(ExtUpFractalsBuffer, EMPTY_VALUE);  
  ArrayResize(ExtDownFractalsBuffer, Bars);   
 ArrayInitialize(ExtDownFractalsBuffer, EMPTY_VALUE);  
  
  ArrayResize(bline, Bars); 
  ArrayInitialize(bline, 0); 
  ArrayResize(sline, Bars); 
  ArrayInitialize(sline, 0); 
  ArrayResize(ExtMapBuffer, Bars); 
  ArrayInitialize(ExtMapBuffer, 0); 
  
    ArrayResize(HighBuffer, Bars); 
  ArrayInitialize(HighBuffer, EMPTY_VALUE);   
      ArrayResize(LowBuffer, Bars); 
  ArrayInitialize(LowBuffer, EMPTY_VALUE); 
     ArrayResize(HighBuffer2, Bars); 
  ArrayInitialize(HighBuffer2, EMPTY_VALUE);   
      ArrayResize(LowBuffer2, Bars); 
  ArrayInitialize(LowBuffer2, EMPTY_VALUE); 
  
    ArrayResize(guardrailu, Bars); 
  ArrayInitialize(guardrailu, EMPTY_VALUE);   
   ArrayResize(guardraild, Bars); 
  ArrayInitialize(guardraild, EMPTY_VALUE);  
    ArrayResize(guardraildplus, Bars); 
  ArrayInitialize(guardraildplus, EMPTY_VALUE);   
     ArrayResize(guardraildminus, Bars); 
  ArrayInitialize(guardraildminus, EMPTY_VALUE);  
  
  ArrayResize(conso, Bars); 
  ArrayInitialize(conso, EMPTY_VALUE);   
   ArrayResize(conso2, Bars); 
  ArrayInitialize(conso2, EMPTY_VALUE);  
      ArrayResize(HU, Bars); 
  ArrayInitialize(HU, EMPTY_VALUE);   
   ArrayResize(HD, Bars); 
  ArrayInitialize(HD, EMPTY_VALUE);   
    ArrayResize(HULLU, Bars); 
  ArrayInitialize(HULLU, EMPTY_VALUE);   
   ArrayResize(HULLD, Bars); 
  ArrayInitialize(HULLD, EMPTY_VALUE);  
    ArrayResize(MHULL, Bars); 
  ArrayInitialize(MHULL, EMPTY_VALUE);  
      ArrayResize(inner, Bars); 
  ArrayInitialize(inner, EMPTY_VALUE);  
 ArrayResize(sup, 500);   
ArrayInitialize(sup, 0); 
ArrayResize(sdn, 500);   
ArrayInitialize(sdn, 0); 
ArrayResize(RSI2, Bars);
ArrayInitialize(RSI2, 0);
ArrayResize(stoch, Bars);
ArrayInitialize(stoch, 0);       
//--------------------------------------------------------------------

//  highest_price[0] =  High[iHighest(NULL, 0, MODE_HIGH, 3,1)];
//   lowest_price[0] =  Low[iLowest(NULL, 0, MODE_LOW, 3,1)];


dt14 = iHigh(symbol,240,iHighest(symbol,240,MODE_HIGH,1590));
db14 = iLow(symbol,240,iLowest(symbol,240,MODE_LOW,1590));
pacing = (dt14-db14)*.1;

bool embeddedoversold = (iClose(symbol,1440,1)<db14+2*pacing && iClose(symbol,1440,2)<db14+2*pacing && iClose(symbol,1440,3)<db14+2*pacing);
bool embeddedoverbought = (iClose(symbol,1440,1)>dt14-2*pacing && iClose(symbol,1440,2)>dt14-2*pacing && iClose(symbol,1440,3)>dt14-2*pacing);


string addon;
if (embeddedoversold) addon = "-";
else if (embeddedoverbought) addon = "+";
else addon = "0";

int    nCountedBars, o, n, bar;
   bool   bFound;
   double dCurrent;
   nCountedBars=IndicatorCounted();
//---- last counted bar will be recounted    
   if(nCountedBars<=2)
      i=Bars-nCountedBars-3;
   if(nCountedBars>2)
     {
      nCountedBars--;
      i=500;
     }
//----Up and Down Fractals
   while(i>=2)
     {
      //----Fractals up
      bFound=false;
      dCurrent=High[i];
      if(dCurrent>High[i+1]  && dCurrent>High[i-1] && dCurrent>High[i-2])
       //&& dCurrent>High[i+2]
        {
         bFound=true;
         ExtUpFractalsBuffer[i]=dCurrent;
        }
      //----6 bars Fractal
      if(!bFound && (Bars-i-1)>=3)
        {
         if(dCurrent==High[i+1] && dCurrent>High[i+2]  
         //&& dCurrent>High[i+3]
            && dCurrent>High[i-1] && dCurrent>High[i-2])
           {
            bFound=true;
            ExtUpFractalsBuffer[i]=dCurrent;
           }
        }        
      //----7 bars Fractal
      if(!bFound && (Bars-i-1)>=4)
        {  
         if(dCurrent>=High[i+1]  && dCurrent>High[i+3] && dCurrent>High[i+4] &&  dCurrent==High[i+2]
            && dCurrent>High[i-1] && dCurrent>High[i-2])
           {
            bFound=true;
            ExtUpFractalsBuffer[i]=dCurrent;
           }
        }  
      //----8 bars Fractal                          
      if(!bFound && (Bars-i-1)>=5)
        {  
         if(dCurrent>=High[i+1] && dCurrent==High[i+2] && dCurrent==High[i+3] && dCurrent>High[i+4]  &&
         
        //&& dCurrent>High[i+5]
            dCurrent>High[i-1] && dCurrent>High[i-2])
           {
            bFound=true;
            ExtUpFractalsBuffer[i]=dCurrent;
           }
        }
      //----9 bars Fractal                                        
      if(!bFound && (Bars-i-1)>=6)
        {  
         if(dCurrent>=High[i+1] && dCurrent==High[i+2] && dCurrent>=High[i+3] && dCurrent==High[i+4] && dCurrent>High[i+5]  && dCurrent>High[i-1] && dCurrent>High[i-2])
           //&&             dCurrent>High[i+6]
           {
            bFound=true;
            ExtUpFractalsBuffer[i]=dCurrent;
           }
        }                                    
      //----Fractals down
      bFound=false;
      dCurrent=Low[i];
      if(dCurrent<Low[i+1]  && dCurrent<Low[i-1] && dCurrent<Low[i-2])
        //&& dCurrent<Low[i+2]
        {
         bFound=true;
         ExtDownFractalsBuffer[i]=dCurrent;
        }
      //----6 bars Fractal
      if(!bFound && (Bars-i-1)>=3)
        {
         if(dCurrent==Low[i+1] && dCurrent<Low[i+2]  &&
            dCurrent<Low[i-1] && dCurrent<Low[i-2])
           //&& dCurrent<Low[i+3]
           {
            bFound=true;
            ExtDownFractalsBuffer[i]=dCurrent;
           }                      
        }        
      //----7 bars Fractal
      if(!bFound && (Bars-i-1)>=4)
        {  
         if(dCurrent<=Low[i+1] && dCurrent==Low[i+2] && dCurrent<Low[i+3]  &&
            dCurrent<Low[i-1] && dCurrent<Low[i-2])
          //&& dCurrent<Low[i+4]  
           {
            bFound=true;
            ExtDownFractalsBuffer[i]=dCurrent;
           }                      
        }  
      //----8 bars Fractal                          
      if(!bFound && (Bars-i-1)>=5)
        {  
         if(dCurrent<=Low[i+1] && dCurrent==Low[i+2] && dCurrent==Low[i+3] && dCurrent<Low[i+4]  &&
            dCurrent<Low[i-1] && dCurrent<Low[i-2])
           //&& dCurrent<Low[i+5] 
           {
            bFound=true;
            ExtDownFractalsBuffer[i]=dCurrent;
           }                      
        }
      //----9 bars Fractal                                        
      if(!bFound && (Bars-i-1)>=6)
        {  
         if(dCurrent<=Low[i+1] && dCurrent==Low[i+2] && dCurrent<=Low[i+3] && dCurrent==Low[i+4] && dCurrent<Low[i+5]  && dCurrent<Low[i-1] && dCurrent<Low[i-2])
           //&&             dCurrent<Low[i+6]
           {
            bFound=true;
            ExtDownFractalsBuffer[i]=dCurrent;
           }                      
        }                                    
      i--;
     }

for (i = 300 ; i >= 0; i--){ 
   RSI2[i]=iRSI(symbol,0,2,PRICE_MEDIAN,i);
   stoch[i]=iStochastic(symbol,0,8,3,3,MODE_SMA,1,MODE_SIGNAL,i);
}   

for (i=240; i>=1; i--){

if(stoch[i+1]<23 && RSI2[i+1]<16  && RSI2[i+3]>5 && !(stoch[i]<5 && RSI2[i]<5)&& 
ExtDownFractalsBuffer[i+1]!=EMPTY_VALUE) sdn[i+1]=iLow(symbol,30,i+1); 
if(stoch[i+1]<23 && RSI2[i+1]<16  && !(stoch[i]<5 && RSI2[i]<5)&& 
ExtDownFractalsBuffer[i+1]!=EMPTY_VALUE)sdn[i+1]=iLow(symbol,30,i+1); 
if(stoch[i+1]<44 && stoch[i+1]>5 && RSI2[i+1]>5 && !(stoch[i]>15 && RSI2[i]>15) && 
ExtDownFractalsBuffer[i+1]!=EMPTY_VALUE) sdn[i+1]=iLow(symbol,30,i+1);
if(stoch[i+1]<5 && RSI2[i+1]<5 && !(stoch[i]>15 && RSI2[i]>15) && 
ExtDownFractalsBuffer[i+1]!=EMPTY_VALUE) sdn[i+1]=iLow(symbol,30,i+1);
if( ((stoch[i+1]>64 && stoch[i]<85 && RSI2[i+2]>85) ||  (stoch[i+1]>72 && stoch[i+1]<75 )  ||  (stoch[i]>44 && stoch[i+1]<35 && stoch[i-1]<44  && RSI2[i+1]>85 )) && RSI2[i+1]>70 && !(stoch[i-1]>95 && RSI2[i-1]>95) && 
ExtUpFractalsBuffer[i+1]!=EMPTY_VALUE && !sup[i+2]) sup[i+1]=iHigh(symbol,30,i+1);
if(stoch[i+1]>64 && stoch[i+2]<64 && RSI2[i+1]>85 && !(stoch[i]>70 && RSI2[i]>95) && 
ExtUpFractalsBuffer[i+2]!=EMPTY_VALUE && !sup[i+2]) sup[i+1]=iHigh(symbol,30,i+1);
if(stoch[i+1]>85 && RSI2[i+1]>85 && !(stoch[i]>85 && RSI2[i]>95) &&  
ExtUpFractalsBuffer[i+1]!=EMPTY_VALUE && !sup[i+2]) sup[i+1]=iHigh(symbol,30,i+1);
        
minus[i]=minus[i+1];
plus[i]=plus[i+1];     

     if (sdn[i+1]!=0) minus[i]=Low[i+1]-110*Point+FSize/2*10*Point;
     if (sup[i+1]!=0) plus[i]=High[i+1]+100*Point-FSize/2*10*Point; 
 }



deletetxt1("Rack");
if (Period()<=1440) {
   for (i = lookback ; i >= 0; i--) {
   
  
   iHi[i]=EMPTY_VALUE;
   iLo[i]=EMPTY_VALUE;
   guardrailu[i] = EMPTY_VALUE;
   guardraild[i] = EMPTY_VALUE;
   
   HULLU[i]=EMPTY_VALUE;
   HULLD[i]=EMPTY_VALUE;
   MHULL[i]=EMPTY_VALUE;
   inner[i]=EMPTY_VALUE;
   HU[i]=EMPTY_VALUE;
   HD[i]=EMPTY_VALUE;
   
   
//     highest_price[i] =  iHigh(NULL,0,iHighest(NULL, 0, MODE_HIGH, 2,i+3));
 //  lowest_price[i] =  iLow(NULL,0,iLowest(NULL, 0, MODE_LOW, 2,i+3));
    if (i<lookback) iHi[i]=iMA(NULL,0,828,0,MODE_EMA, PRICE_HIGH,i);
    if (i<lookback) iLo[i]=iMA(NULL,0,828,0,MODE_EMA, PRICE_LOW,i);
    if (i<lookback) iHi2[i]=iMA(NULL,0,1556,0,MODE_EMA, PRICE_HIGH,i);
    if (i<lookback) iLo2[i]=iMA(NULL,0,1556,0,MODE_EMA, PRICE_LOW,i);
 if (i<lookback) iHi3[i]=iMA(NULL,0,sample*48,0,MODE_EMA, PRICE_HIGH,i);
    if (i<lookback) iLo3[i]=iMA(NULL,0,sample*48,0,MODE_EMA, PRICE_LOW,i);
     if (i<lookback) iHi4[i]=iMA(NULL,0,414,0,MODE_EMA, PRICE_HIGH,i);
    if (i<lookback) iLo4[i]=iMA(NULL,0,414,0,MODE_EMA, PRICE_LOW,i);

     if (i<lookback) iHi5[i]=iMA(NULL,0,135,0,MODE_EMA, PRICE_HIGH,i);
    if (i<lookback) iLo5[i]=iMA(NULL,0,135,0,MODE_EMA, PRICE_LOW,i);
    
        if (i<lookback) iHi6[i]=iMA(NULL,0,sample*8,0,MODE_EMA, PRICE_HIGH,i);
    if (i<lookback) iLo6[i]=iMA(NULL,0,sample*8,0,MODE_EMA, PRICE_LOW,i);
    
   if (Period()==30){ 
    
    guardrailu[i] =  iMA(symbol,0,414,0,MODE_EMA, PRICE_HIGH,i)+FMax*10*Point;
    
    guardraild[i] =  iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i)-FMax*10*Point;
    
     guardraildplus[i] =  guardraild[i]+90*Point;
     guardraildminus[i] =  guardraild[i]-90*Point;
    
    
    pbrainu[i] =  iMA(symbol,0,414,0,MODE_EMA, PRICE_HIGH,i)+3*FMax*10*Point;
    pbraind[i] =  iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i)-3*FMax*10*Point;
    
 triu[i] =  iMA(symbol,0,414,0,MODE_EMA, PRICE_HIGH,i)+5*FMax*10*Point;
    trid[i] =  iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i)-5*FMax*10*Point;}

inner[i]=2*iMA(NULL,0,HULL/2,8,MODE_LWMA,PRICE_MEDIAN,i)- iMA(NULL,0,HULL,8,MODE_LWMA,PRICE_MEDIAN,i);

MHULL[i] = iMA(NULL,0,MathRound(MathSqrt(HULL)),8,MODE_LWMA,inner[i],i);

if (i<200){
//Low[i+9]<minus[i+9] && Low[i+8]<minus[i+8] && Low[i+7]<minus[i+7] && 
          if (Low[i+6]<minus[i+6] && Low[i+5]<minus[i+5] && Low[i+4]<minus[i+4] && Low[i+3]<minus[i+3]  && Low[i+2]<minus[i+2] && iLow(symbol,0,i+1)>minus[i+1] && i>=1 ){
           if (iLow(symbol,0,i+2)<minus[i+2]) if (plot_losing_status){ {ObjectCreate("Rack"+i, OBJ_RECTANGLE, 0, Time[i+2], Low[i+1], Time[i], iLow(Symbol(),0,iLowest(Symbol(),0,MODE_LOW,8,i+2)));
           ObjectSet("Rack"+i,OBJPROP_BACK,1);
            ObjectSetInteger(0,"Rack"+i,OBJPROP_COLOR,clrGreen); } fodir[i]=1; }}
//High[i+8]>plus[i+8] && High[i+7]>plus[i+7] &&                  
              if ( High[i+6]>plus[i+6] && High[i+5]>plus[i+5] && High[i+4]>plus[i+4] && High[i+3]>plus[i+3] && High[i+2]>plus[i+2] && High[i+3]>plus[i+3] && High[i+2]>plus[i+2] && iHigh(symbol,0,i+1)<plus[i+1] && i>=1 ){
         if (iHigh(symbol,0,i+2)>plus[i+2])if (plot_losing_status){ {ObjectCreate("Rack"+i, OBJ_RECTANGLE, 0, Time[i+2], High[i+1], Time[i], iHigh(Symbol(),0,iHighest(Symbol(),0,MODE_HIGH,8,i+2)));
          ObjectSet("Rack"+i,OBJPROP_BACK,1);
            ObjectSetInteger(0,"Rack"+i,OBJPROP_COLOR,clrMagenta);} } fodir[i]=-1;  }}


if (plot_Hull){
if (MHULL[i]<MHULL[i+1] && MHULL[i]!=0) HULLD[i]=MHULL[i];
else if (MHULL[i]>MHULL[i+1] && MHULL[i]!=0) HULLU[i]=MHULL[i];
}

if (plot_Hull_Arrows){
   
if (HULLU[i+6]!=EMPTY_VALUE && HULLU[i+3]!=EMPTY_VALUE && HULLU[i+4]!=EMPTY_VALUE && HULLU[i+5]!=EMPTY_VALUE && HULLD[i]!=EMPTY_VALUE && HULLD[i+1]!=EMPTY_VALUE && Period()==30) HD[i]=HULLD[i]+FSize/4*10*Point;
else HD[i]=EMPTY_VALUE;
if   (HULLD[i+6]!=EMPTY_VALUE && HULLD[i+3]!=EMPTY_VALUE && HULLD[i+4]!=EMPTY_VALUE && HULLD[i+5]!=EMPTY_VALUE && HULLU[i]!=EMPTY_VALUE && HULLU[i+1]!=EMPTY_VALUE && Period()==30 ) HU[i]=HULLU[i]-FSize/4*10*Point;
else HU[i]=EMPTY_VALUE;}

if (plot_Spark_Sones){

 ///Maroon Above Green River
     if ( iMA(symbol,0,135,0,MODE_EMA, PRICE_LOW,i)>iMA(symbol,0,414,0,MODE_EMA, PRICE_HIGH,i) && iMA(symbol,0,135,0,MODE_EMA, PRICE_LOW,i)-iMA(symbol,0,414,0,MODE_EMA, PRICE_HIGH,i)<FSize/1.4*10*Point
           && LowComparison(i,30) == False) {HighBuffer2[i]=iMA(symbol,0,135,0,MODE_EMA, PRICE_LOW,i); LowBuffer2[i]=iMA(symbol,0,414,0,MODE_EMA, PRICE_HIGH,i);}
 
 ///Maroon Below Green River
     if ( iMA(symbol,0,135,0,MODE_EMA, PRICE_HIGH,i)<iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i) && iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i)-iMA(symbol,0,135,0,MODE_EMA, PRICE_HIGH,i)<FSize/1.4*10*Point
            && HighComparison(i,30) == False) {HighBuffer[i]=iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i); LowBuffer[i]=iMA(symbol,0,135,0,MODE_EMA, PRICE_HIGH,i);}
     }
     
     }
     
   for (i = 120 ; i >= 0; i--) {
     bline[i]=EMPTY_VALUE;
     sline[i]=EMPTY_VALUE;
     if (i<108) bline[i]=iHi[i]+ MathAbs(((iHi[i]-iHi[i+36])/36)*60);
    // MathAbs((iHi[i]-iHi[i+36])/36*60);
     if (i<108) sline[i]=iLo[i]-MathAbs(((iLo[i+36]-iLo[i])/36)*60);
  //   MathAbs((iLo[i+36]-iLo[i])/36*60);
     }


   for (i = 100 ; i >=0 ; i--) {
     if ((Open[i]>sline[i] &&  Bid<=sline[i]) && Close[i+2]>sline[i+2] ) sell[i]=sline[i];
    // MathAbs((iHi[i]-iHi[i+36])/36*60);
    if (sell[i]>0 && sell[i+1]==0 && Low[iLowest(NULL, 0, MODE_LOW, 3,i+1)]<sline[i]) HCR[i]=Low[iLowest(NULL, 0, MODE_LOW, 2,i+3)]+.001;
        if ((Close[i]>bline[i]&&Low[i+1]<bline[i+1])  ||  (Close[i+1]<sline[i+1] && Close[i+2]<sline[i+2] && Ask>=sline[i])) buy[i]=bline[i];
    if (buy[i]>0 && buy[i+1]==0 && High[iHighest(NULL, 0, MODE_HIGH, 3,i+1)]>bline[i]) LCR[i]=High[iHighest(NULL, 0, MODE_HIGH, 2,i+3)]-.001;    
  //   MathAbs((iLo[i+36]-iLo[i])/36*60);
     }


   
   
      for (i = 0 ; i <= 420; i++) {
      //conso[i]=EMPTY_VALUE;
    //  Print("MathAbs((ChoppinessIndex(14,i)-ChoppinessIndex(14,i+5))<1) ",i,"]:", MathAbs((ChoppinessIndex(14,i)-ChoppinessIndex(14,i+5)))); 
               if ((MathAbs((ChoppinessIndex(14,i)-ChoppinessIndex(14,i+4))>6) && MathAbs((ChoppinessIndex(14,i)-ChoppinessIndex(14,i+8))>6) && Period()==30)
                   ||  (MathAbs((ChoppinessIndex(7,i)-ChoppinessIndex(7,i+2))>5) && MathAbs((ChoppinessIndex(7,i)-ChoppinessIndex(7,i+4))>5) && Period()>30 ))
                   
                {
                     for (j=i; j <= i+3; j++){
                        conso[j]=(High[i]+High[i+1]+High[i+2]+High[i+3]+Low[i]+Low[i+1]+Low[i+2]+Low[i+3])/8;  conso2[j]=conso[j];}}
     }

   
   }

deletetxt1("Rake");
deletetxt1("Fake");
deletetxt1("ZERO");
deletetxt1("HUNDRA");

if (Period()==30){  
for(i = 240; i >= 0; i--){     


if (i>=0 && RSI2[i+1]>hundred && RSI2[i]<RSI2[i+1]){
               ObjectCreate("HUNDRA"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+250*Point);
                 ObjectSetText("HUNDRA"+i, "100", 53, "Arial Black", clrPink);
                 ObjectCreate("HUNDRAz"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+250*Point);
                 ObjectSetText("HUNDRAz"+i, " 100", 53, "Arial Black", clrNavy);}    


if (i==0 && RSI2[i]>hundred){
               ObjectCreate("HUNDRA"+i,OBJ_TEXT, 0, Time[i], High[i]+250*Point);
                 ObjectSetText("HUNDRA"+i, "100", 53, "Arial Black", clrPink);
                 ObjectCreate("HUNDRAz"+i,OBJ_TEXT, 0, Time[i], High[i]+250*Point);
                 ObjectSetText("HUNDRAz"+i, " 100", 53, "Arial Black", clrPowderBlue);}    




if (i>=0 && RSI2[i+1]<zero && RSI2[i]>RSI2[i+1]){
               ObjectCreate("ZERO"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-5*Point);
                 ObjectSetText("ZERO"+i, "0", 53, "Arial Black", clrPink);
                 ObjectCreate("ZEROz"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-5*Point);
                 ObjectSetText("ZEROz"+i, " 0", 53, "Arial Black", clrNavy);}    


if (i==0 && RSI2[i]<zero){
               ObjectCreate("ZERO"+i,OBJ_TEXT, 0, Time[i], Low[i]-5*Point);
                 ObjectSetText("ZERO"+i, "0", 53, "Arial Black", clrPink);
                 ObjectCreate("ZEROz"+i,OBJ_TEXT, 0, Time[i], Low[i]-5*Point);
                 ObjectSetText("ZEROz"+i, " 0", 53, "Arial Black", PowderBlue);}    


if (plot_ricochets){
    
                 
///////RAKE

////Maroon                 
//Low[i+2]>Low[i+1] 
if ( Low[i+1]< iMA(symbol,0,135,0,MODE_EMA, PRICE_HIGH,i+1)+40*Point && Low[i+1]> iMA(symbol,0,135,0,MODE_EMA, PRICE_HIGH,i+1)-20*Point
     && Close[i+1]> iMA(symbol,0,135,0,MODE_EMA, PRICE_HIGH,i+1)+50*Point && Low[i]>Low[i+1] &&
     !(Low[i+3]>Low[i+2] && Low[i+2]< iMA(symbol,0,135,0,MODE_EMA, PRICE_CLOSE,i+2)+30*Point && Low[i+2]> iMA(symbol,0,135,0,MODE_EMA, PRICE_HIGH,i+2)-80*Point
     && Close[i+2]> iMA(symbol,0,135,0,MODE_EMA, PRICE_CLOSE,i+2)+50*Point && Low[i+1]>Low[i+2])){
                 ObjectCreate("Rakei"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-10*Point);
                 ObjectSetText("Rakei"+i, "R", 33, "Arial Black", clrYellow);
                 ObjectCreate("Raker"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-10*Point);
                 ObjectSetText("Raker"+i, " R", 33, "Arial Black", clrBlack);}
        

///////2H Lema

if (Low[i+2]>Low[i+1] && Low[i+1]< iMA(symbol,0,1556,0,MODE_EMA, PRICE_HIGH,i+1)-30*Point && Low[i+1]> iMA(symbol,0,1556,0,MODE_EMA, PRICE_HIGH,i+1)+20*Point
     && Close[i+1]> iMA(symbol,0,1556,0,MODE_EMA, PRICE_HIGH,i+1)+50*Point && Low[i]>Low[i+1] &&
     !(Low[i+3]>Low[i+2] && Low[i+2]< iMA(symbol,30,1556,0,MODE_EMA, PRICE_CLOSE,i+2)+30*Point && Low[i+2]> iMA(symbol,0,1556,0,MODE_EMA, PRICE_HIGH,i+2)-80*Point
     && Close[i+2]> iMA(symbol,0,1556,0,MODE_EMA, PRICE_CLOSE,i+2)+50*Point && Low[i+1]>Low[i+2])){
                 ObjectCreate("Rakei"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-10*Point);
                 ObjectSetText("Rakei"+i, "R", 33, "Arial Black", clrYellow);
                 ObjectCreate("Raker"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-10*Point);
                 ObjectSetText("Raker"+i, " R", 33, "Arial Black", clrBlack);}


//////19872

if (Low[i+2]>Low[i+1] && Low[i+1]< iMA(symbol,0,19872,0,MODE_EMA, PRICE_HIGH,i+1)-30*Point && Low[i+1]> iMA(symbol,0,19872,0,MODE_EMA, PRICE_HIGH,i+1)+20*Point
     && Close[i+1]> iMA(symbol,0,19872,0,MODE_EMA, PRICE_HIGH,i+1)+50*Point && Low[i]>Low[i+1] &&
     !(Low[i+3]>Low[i+2] && Low[i+2]< iMA(symbol,0,19872,0,MODE_EMA, PRICE_CLOSE,i+2)+30*Point && Low[i+2]> iMA(symbol,0,19872,0,MODE_EMA, PRICE_HIGH,i+2)-80*Point
     && Close[i+2]> iMA(symbol,0,19872,0,MODE_EMA, PRICE_CLOSE,i+2)+50*Point && Low[i+1]>Low[i+2])){
                 ObjectCreate("Rakei"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-40*Point);
                 ObjectSetText("Rakei"+i, "R", 33, "Arial Black", clrYellow);
                 ObjectCreate("Raker"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-40*Point);
                 ObjectSetText("Raker"+i, " R", 33, "Arial Black", clrBlack);}


//////39744

if (Low[i+2]>Low[i+1] && Low[i+1]< iMA(symbol,0,39744,0,MODE_EMA, PRICE_HIGH,i+1)-30*Point && Low[i+1]> iMA(symbol,0,39744,0,MODE_EMA, PRICE_HIGH,i+1)+20*Point
     && Close[i+1]> iMA(symbol,0,39744,0,MODE_EMA, PRICE_HIGH,i+1)+50*Point && Low[i]>Low[i+1] &&
     !(Low[i+3]>Low[i+2] && Low[i+2]< iMA(symbol,0,39744,0,MODE_EMA, PRICE_CLOSE,i+2)+30*Point && Low[i+2]> iMA(symbol,0,39744,0,MODE_EMA, PRICE_HIGH,i+2)-80*Point
     && Close[i+2]> iMA(symbol,0,39744,0,MODE_EMA, PRICE_CLOSE,i+2)+50*Point && Low[i+1]>Low[i+2])){
                 ObjectCreate("Rakei"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-40*Point);
                 ObjectSetText("Rakei"+i, "R", 33, "Arial Black", clrMagenta);
                 ObjectCreate("Raker"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-40*Point);
                 ObjectSetText("Raker"+i, " R", 33, "Arial Black", clrBlack);}

////30m Lema 
if (Low[i+2]>Low[i+1] && Low[i+1]< iMA(symbol,0,828,0,MODE_EMA, PRICE_HIGH,i+1)-30*Point && Low[i+1]> iMA(symbol,0,828,0,MODE_EMA, PRICE_HIGH,i+1)+20*Point
     && Close[i+1]> iMA(symbol,0,828,0,MODE_EMA, PRICE_HIGH,i+1)+50*Point && Low[i]>Low[i+1] &&
     !(Low[i+3]>Low[i+2] && Low[i+2]< iMA(symbol,0,828,0,MODE_EMA, PRICE_CLOSE,i+2)+30*Point && Low[i+2]> iMA(symbol,0,828,0,MODE_EMA, PRICE_HIGH,i+2)-80*Point
     && Close[i+2]> iMA(symbol,0,828,0,MODE_EMA, PRICE_CLOSE,i+2)+50*Point && Low[i+1]>Low[i+2])){
                 ObjectCreate("Rakei"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-10*Point);
                 ObjectSetText("Rakei"+i, "R", 33, "Arial Black", clrYellow);
                 ObjectCreate("Raker"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-10*Point);
                 ObjectSetText("Raker"+i, " R", 33, "Arial Black", clrBlack);} 

////Green River
if (Low[i+2]>Low[i+1] && Low[i+1]< iMA(symbol,0,414,0,MODE_EMA, PRICE_HIGH,i+1)-30*Point && Low[i+1]> iMA(symbol,0,414,0,MODE_EMA, PRICE_HIGH,i+1)+20*Point
     && Close[i+1]> iMA(symbol,0,414,0,MODE_EMA, PRICE_HIGH,i+1)+50*Point && Low[i]>Low[i+1] &&
     !(Low[i+3]>Low[i+2] && Low[i+2]< iMA(symbol,0,414,0,MODE_EMA, PRICE_CLOSE,i+2)+30*Point && Low[i+2]> iMA(symbol,0,414,0,MODE_EMA, PRICE_HIGH,i+2)-80*Point
     && Close[i+2]> iMA(symbol,0,414,0,MODE_EMA, PRICE_CLOSE,i+2)+50*Point && Low[i+1]>Low[i+2])){
                 ObjectCreate("Rakei"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-10*Point);
                 ObjectSetText("Rakei"+i, "R", 33, "Arial Black", clrYellow);
                 ObjectCreate("Raker"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]-10*Point);
                 ObjectSetText("Raker"+i, " R", 33, "Arial Black", clrBlack);}  
 




                 


//////////////////Rebound from above


///Maroon
 if (High[i+2]<High[i+1] && High[i+1]< iMA(symbol,0,135,0,MODE_EMA, PRICE_LOW,i+1)+30*Point && High[i+1]> iMA(symbol,0,135,0,MODE_EMA, PRICE_LOW,i+1)-20*Point
     && Close[i+1]< iMA(symbol,0,135,0,MODE_EMA, PRICE_LOW,i+1)+50*Point && High[i]<High[i+1] &&
     !(High[i+3]<High[i+2] && High[i+2]< iMA(symbol,0,135,0,MODE_EMA, PRICE_LOW,i+2)+30*Point && High[i+2]> iMA(symbol,0,135,0,MODE_EMA, PRICE_LOW,i+2)-20*Point
     && Close[i+2]< iMA(symbol,0,135,0,MODE_EMA, PRICE_LOW,i+2)+50*Point && High[i+1]<High[i+2])){
               ObjectCreate("Raken"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+20*Point);
                 ObjectSetText("Raken"+i, "R", 33, "Arial Black", clrBlack);
                 ObjectCreate("Rakez"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+20*Point);
                 ObjectSetText("Rakez"+i, " R", 33, "Arial Black", clrYellow);}

/////2H Lema
 if (High[i+2]<High[i+1] && High[i+1]< iMA(symbol,0,1556,0,MODE_EMA, PRICE_LOW,i+1)+30*Point && High[i+1]> iMA(symbol,0,1556,0,MODE_EMA, PRICE_LOW,i+1)-20*Point
     && Close[i+1]< iMA(symbol,0,1556,0,MODE_EMA, PRICE_LOW,i+1)+50*Point && High[i]<High[i+1] &&
     !(High[i+3]<High[i+2] && High[i+2]< iMA(symbol,0,1556,0,MODE_EMA, PRICE_LOW,i+2)+30*Point && High[i+2]> iMA(symbol,0,1556,0,MODE_EMA, PRICE_LOW,i+2)-20*Point
     && Close[i+2]< iMA(symbol,0,1556,0,MODE_EMA, PRICE_LOW,i+2)+50*Point && High[i+1]<High[i+2])){
               ObjectCreate("Raken"+i,OBJ_TEXT, 0, Time[i+2], High[i+2]+20*Point);
                 ObjectSetText("Raken"+i, "R", 33, "Arial Black", clrBlack);
                 ObjectCreate("Rakez"+i,OBJ_TEXT, 0, Time[i+2], High[i+2]+20*Point);
                 ObjectSetText("Rakez"+i, " R", 33, "Arial Black", clrYellow);}

                 
////19872       
 if (High[i+2]<High[i+1] && High[i+1]< iMA(symbol,0,19872,0,MODE_EMA, PRICE_LOW,i+1)+30*Point && High[i+1]> iMA(symbol,0,19872,0,MODE_EMA, PRICE_LOW,i+1)-20*Point
     && Close[i+1]< iMA(symbol,0,19872,0,MODE_EMA, PRICE_LOW,i+1)+50*Point && High[i]<High[i+1] &&
     !(High[i+3]<High[i+2] && High[i+2]< iMA(symbol,0,19872,0,MODE_EMA, PRICE_LOW,i+2)+30*Point && High[i+2]> iMA(symbol,0,19872,0,MODE_EMA, PRICE_LOW,i+2)-20*Point
     && Close[i+2]< iMA(symbol,0,19872,0,MODE_EMA, PRICE_LOW,i+2)+50*Point && High[i+1]<High[i+2])){
               ObjectCreate("Raken"+i,OBJ_TEXT, 0, Time[i+2], High[i+2]+20*Point);
                 ObjectSetText("Raken"+i, "R", 33, "Arial Black", clrBlack);
                 ObjectCreate("Rakez"+i,OBJ_TEXT, 0, Time[i+2], High[i+2]+20*Point);
                 ObjectSetText("Rakez"+i, " R", 33, "Arial Black", clrYellow);}               
                 
/////39744
    if (High[i+2]<High[i+1] && High[i+1]< iMA(symbol,0,39744,0,MODE_EMA, PRICE_LOW,i+1)+30*Point && High[i+1]> iMA(symbol,0,39744,0,MODE_EMA, PRICE_LOW,i+1)-20*Point
     && Close[i+1]< iMA(symbol,0,39744,0,MODE_EMA, PRICE_LOW,i+1)+50*Point && High[i]<High[i+1] &&
     !(High[i+3]<High[i+2] && High[i+2]< iMA(symbol,0,39744,0,MODE_EMA, PRICE_LOW,i+2)+30*Point && High[i+2]> iMA(symbol,0,39744,0,MODE_EMA, PRICE_LOW,i+2)-20*Point
     && Close[i+2]< iMA(symbol,0,39744,0,MODE_EMA, PRICE_LOW,i+2)+50*Point && High[i+1]<High[i+2])){
               ObjectCreate("Raken"+i,OBJ_TEXT, 0, Time[i+2], High[i+2]+20*Point);
                 ObjectSetText("Raken"+i, "R", 33, "Arial Black", clrBlack);
                 ObjectCreate("Rakez"+i,OBJ_TEXT, 0, Time[i+2], High[i+2]-20*Point);
                 ObjectSetText("Rakez"+i, " R", 33, "Arial Black", clrMagenta);}                    
                 
////30m Lema      
  if (High[i+2]<High[i+1] && High[i+1]< iMA(symbol,0,828,0,MODE_EMA, PRICE_LOW,i+1)+30*Point && High[i+1]> iMA(symbol,0,828,0,MODE_EMA, PRICE_LOW,i+1)-20*Point
     && Close[i+1]< iMA(symbol,0,828,0,MODE_EMA, PRICE_LOW,i+1)+50*Point && High[i]<High[i+1] &&
     !(High[i+3]<High[i+2] && High[i+2]< iMA(symbol,0,828,0,MODE_EMA, PRICE_LOW,i+2)+30*Point && High[i+2]> iMA(symbol,0,828,0,MODE_EMA, PRICE_LOW,i+2)-20*Point
     && Close[i+2]< iMA(symbol,0,828,0,MODE_EMA, PRICE_LOW,i+2)+50*Point && High[i+1]<High[i+2])){
                ObjectCreate("Raken"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+20*Point);
                 ObjectSetText("Raken"+i, "R", 33, "Arial Black", clrBlack);
                 ObjectCreate("Rakez"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+20*Point);
                 ObjectSetText("Rakez"+i, " R", 33, "Arial Black", clrYellow);}               


////Green River     
   if (High[i+2]<High[i+1] && High[i+1]< iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i+1)+30*Point && High[i+1]> iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i+1)-20*Point
     && Close[i+1]< iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i+1)+50*Point && High[i]<High[i+1] &&
     !(High[i+3]<High[i+2] && High[i+2]< iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i+2)+30*Point && High[i+2]> iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i+2)-20*Point
     && Close[i+2]< iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i+2)+50*Point && High[i+1]<High[i+2])){
               ObjectCreate("Raken"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Raken"+i, "R", 33, "Arial Black", clrBlack);
                 ObjectCreate("Rakez"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Rakez"+i, " R", 33, "Arial Black", clrYellow);}   


////Lower Guard Rail
 if (High[i+2]<High[i+1] && High[i+1]< iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i+1)-FMax*10*Point+30*Point && High[i+1]> iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i+1)-20*Point
     && Close[i+1]< iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i+1)-FMax*10*Point+50*Point && High[i]<High[i+1] &&
     !(High[i+3]<High[i+2] && High[i+2]< iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i+2)-FMax*10*Point+30*Point && High[i+2]> iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i+2)-20*Point
     && Close[i+2]< iMA(symbol,0,414,0,MODE_EMA, PRICE_LOW,i+2)-FMax*10*Point+50*Point && High[i+1]<High[i+2])){
                ObjectCreate("Rakent"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Rakent"+i, "R", 33, "Arial Black", clrBlack);
                 ObjectCreate("Rakezt"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Rakezt"+i, " R", 33, "Arial Black", clrYellow);}   
}


 ////////////////
//Fake
/////////////////
    
    ////Maroon                 

       if ( High[i+1]> iMA(symbol,30,135,0,MODE_EMA, PRICE_HIGH,i+1)-30*Point && High[i+1]< iMA(symbol,30,135,0,MODE_EMA, PRICE_HIGH,i+1)+80*Point
     && Close[i+1]< iMA(symbol,30,135,0,MODE_EMA, PRICE_HIGH,i+1)-30*Point && High[i]<High[i+1]
     && Low[i+1]<Low[i+2] && Low[i+5]<iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,i+5)
     && Low[i+3]<iMA(symbol,30,135,0,MODE_EMA, PRICE_HIGH,i+3)
    && !(High[i+2]> iMA(symbol,30,135,0,MODE_EMA, PRICE_HIGH,i+2)-30*Point && High[i+2]< iMA(symbol,30,135,0,MODE_EMA, PRICE_HIGH,i+2)+80*Point
    && Close[i+2]< iMA(symbol,30,135,0,MODE_EMA, PRICE_HIGH,i+2)-50*Point && High[i+1]<High[i+2])
    ) {
                 ObjectCreate("Fakei"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+50*Point);
                 ObjectSetText("Fakei"+i, "F", 33, "Arial Black", clrYellow);
                 ObjectCreate("Faker"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+50*Point);
                 ObjectSetText("Faker"+i, " F", 33, "Arial Black", clrBlue);
                 fodir[i]=-1;
                 }
        

///////2H Lema

 if (Low[i+2]<Low[i+1] && High[i+1]> iMA(symbol,30,1556,0,MODE_EMA, PRICE_HIGH,i+1)-30*Point && High[i+1]< iMA(symbol,30,1556,0,MODE_EMA, PRICE_HIGH,i+1)+20*Point
     && Close[i+1]< iMA(symbol,30,1556,0,MODE_EMA, PRICE_HIGH,i+1)-50*Point && High[i]<High[i+1]
     && !(High[i+2]> iMA(symbol,30,1556,0,MODE_EMA, PRICE_HIGH,i+2)-30*Point && High[i+2]< iMA(symbol,30,1556,0,MODE_EMA, PRICE_HIGH,i+2)+20*Point
     && Close[i+2]< iMA(symbol,30,1556,0,MODE_EMA, PRICE_HIGH,i+2)-50*Point && High[i+1]<High[i+2])){
                 ObjectCreate("Fakei"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Fakei"+i, "F", 33, "Arial Black", clrYellow);
                 ObjectCreate("Faker"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Faker"+i, " F", 33, "Arial Black", clrBlack);
                 fodir[i]=-1;}


//////19872

if (Low[i+2]<Low[i+1] && High[i+1]> iMA(symbol,30,19872,0,MODE_EMA, PRICE_HIGH,i+1)-30*Point && High[i+1]< iMA(symbol,30,19872,0,MODE_EMA, PRICE_HIGH,i+1)+20*Point
     && Close[i+1]< iMA(symbol,30,19872,0,MODE_EMA, PRICE_HIGH,i+1)-10*Point && High[i]<High[i+1]
     && !(High[i+2]> iMA(symbol,30,19872,0,MODE_EMA, PRICE_HIGH,i+2)-30*Point && High[i+2]< iMA(symbol,30,19872,0,MODE_EMA, PRICE_HIGH,i+2)+20*Point
     && Close[i+2]< iMA(symbol,30,19872,0,MODE_EMA, PRICE_HIGH,i+2)-10*Point && High[i+1]<High[i+2])){
                 ObjectCreate("Fakei"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Fakei"+i, "F", 33, "Arial Black", clrYellow);
                 ObjectCreate("Faker"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Faker"+i, " F", 33, "Arial Black", clrBlack);
                 fodir[i]=-1;}


//////39744

if (Low[i+2]<Low[i+1] && High[i+1]> iMA(symbol,30,39744,0,MODE_EMA, PRICE_HIGH,i+1)-30*Point && High[i+1]< iMA(symbol,30,39744,0,MODE_EMA, PRICE_HIGH,i+1)+20*Point
     && Close[i+1]< iMA(symbol,30,39744,0,MODE_EMA, PRICE_HIGH,i+1)-10*Point && High[i]<High[i+1]
     && !(High[i+2]> iMA(symbol,30,39744,0,MODE_EMA, PRICE_HIGH,i+2)-30*Point && High[i+2]< iMA(symbol,30,39744,0,MODE_EMA, PRICE_HIGH,i+2)+20*Point
     && Close[i+2]< iMA(symbol,30,39744,0,MODE_EMA, PRICE_HIGH,i+2)-10*Point && High[i+1]<High[i+2])){
                 ObjectCreate("Fakei"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Fakei"+i, "F", 33, "Arial Black", clrMagenta);
                 ObjectCreate("Faker"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Faker"+i, " F", 33, "Arial Black", clrBlack);
                 fodir[i]=-1;}

////30m Lema 
if (Low[i+2]<Low[i+1] && High[i+1]> iMA(symbol,30,828,0,MODE_EMA, PRICE_HIGH,i+1)-30*Point && High[i+1]< iMA(symbol,30,828,0,MODE_EMA, PRICE_HIGH,i+1)+20*Point
     && Close[i+1]< iMA(symbol,30,828,0,MODE_EMA, PRICE_HIGH,i+1)-10*Point && High[i]<High[i+1]
     && !(High[i+2]> iMA(symbol,30,828,0,MODE_EMA, PRICE_HIGH,i+2)-30*Point && High[i+2]< iMA(symbol,30,828,0,MODE_EMA, PRICE_HIGH,i+2)+20*Point
     && Close[i+2]< iMA(symbol,30,828,0,MODE_EMA, PRICE_HIGH,i+2)-10*Point && High[i+1]<High[i+2])){
                 ObjectCreate("Fakei"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Fakei"+i, "F", 33, "Arial Black", clrYellow);
                 ObjectCreate("Faker"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Faker"+i, " F", 33, "Arial Black", clrBlack);
                 fodir[i]=-1;} 

////Green River
if (High[i+2]<High[i+1] && High[i+1]> iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+1)-35*Point && High[i+1]< iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+1)+20*Point
     && Close[i+1]< iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+1)-50*Point && High[i]<High[i+1] 
     && (Low[i+3]<iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+3)  || Low[i+4]<iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+4) ||  Low[i+5]<iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+5))
     && !(High[i+2]> iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+2)-35*Point && High[i+2]< iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+2)+20*Point
     && Close[i+2]< iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+2)-50*Point && High[i+1]<High[i+2])
         
      ){
                 ObjectCreate("Fakei"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Fakei"+i, "F", 33, "Arial Black", clrYellow);
                 ObjectCreate("Faker"+i,OBJ_TEXT, 0, Time[i+1], High[i+1]+40*Point);
                 ObjectSetText("Faker"+i, " F", 33, "Arial Black", clrBlack);
                 fodir[i]=-1;}  
                 
////Lower Guard Rail
  if (High[i+2]>High[i+1] && High[i+1]< iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+1)-FMax*10*Point+100*Point && High[i+1]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+1)-FMax*10*Point-20*Point
     && Close[i+1]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+1)-FMax*10*Point+50*Point && Low[i]>Low[i+1]
     && Low[i+2]<iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+1)-FMax*10*Point
     && !(Low[i+2]< iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)-FMax*10*Point+30*Point && Low[i+2]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)-FMax*10*Point-20*Point
     && Close[i+2]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)-FMax*10*Point+50*Point && Low[i+1]>Low[i+2])
     && (Open[i+2]<iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)-FMax*10*Point  || Open[i+1]<iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)-FMax*10*Point)
     ){
                ObjectCreate("Fakeii"+i,OBJ_TEXT, 0, Time[i+2], High[i+2]+50*Point);
                 ObjectSetText("Fakeii"+i, "F", 33, "Arial Black", clrYellow);
                 ObjectCreate("Fakeri"+i,OBJ_TEXT, 0, Time[i+2], High[i+2]+50*Point);
                 ObjectSetText("Fakeri"+i, " F", 33, "Arial Black", clrBlue);
                 fodir[i]=-1;}  



////Upper Guard Rail
  if (High[i+2]>High[i+1] 
  && High[i+1]< iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+1)+FMax*10*Point+100*Point && High[i+1]> iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+1)+FMax*10*Point-20*Point
     && Close[i+1]< iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+1)+FMax*10*Point+50*Point && Low[i]<Low[i+1]
     && Low[i+2]<iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+1)+FMax*10*Point
 //    && !(Low[i+2]< iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)+FMax*10*Point+30*Point && Low[i+2]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)+FMax*10*Point-20*Point
//     && Close[i+2]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)+FMax*10*Point+50*Point && Low[i+1]>Low[i+2])
){
                ObjectCreate("Fakeiii"+i,OBJ_TEXT, 0, Time[i+2], High[i+2]+40*Point);
                 ObjectSetText("Fakeiii"+i, "F", 33, "Arial Black", clrYellow);
                 ObjectCreate("Fakerii"+i,OBJ_TEXT, 0, Time[i+2], High[i+2]+40*Point);
                 ObjectSetText("Fakerii"+i, " F", 33, "Arial Black", clrNavy);
                 fodir[i]=-1;
                 }  
                 
                 
////Upper PHaze Rail
  if (High[i+2]<High[i+1] &&
   High[i+1]< iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+1)+3*FMax*10*Point+100*Point && High[i+1]> iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+1)+3*FMax*10*Point-20*Point
     && Close[i+1]< iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+1)+3*FMax*10*Point+50*Point && Low[i+1]<Low[i+2]
     && Low[i+2]<iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,i+1)+3*FMax*10*Point
     && !(Low[i+2]< iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)+3*FMax*10*Point+30*Point && Low[i+2]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)+3*FMax*10*Point-20*Point
     && Close[i+2]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)+3*FMax*10*Point+50*Point && Low[i+1]>Low[i+2])
){
                ObjectCreate("Fakeiiii"+i,OBJ_TEXT, 0, Time[i+2], High[i+2]+50*Point);
                 ObjectSetText("Fakeiiii"+i, "F", 33, "Arial Black", clrYellow);
                 ObjectCreate("Fakeriii"+i,OBJ_TEXT, 0, Time[i+2], High[i+2]+50*Point);
                 ObjectSetText("Fakeriii"+i, " F", 33, "Arial Black", clrNavy);
                 fodir[i]=-1;}                   



/////////////////////////////////


///Maroon
//High[i+2]>High[i+1] &&
 if ( Low[i+1]< iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,i+1)+30*Point && Low[i+1]> iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,i+1)-70*Point
     && Close[i+1]> iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,i+1)-10*Point && Low[i]>Low[i+1] 
     && (High[i+2]> iMA(symbol,30,135,0,MODE_EMA, PRICE_HIGH,i+2)-10*Point  || High[i+3]> iMA(symbol,30,135,0,MODE_EMA, PRICE_HIGH,i+3)-10*Point )
     && !(Low[i+2]< iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,i+2)+30*Point && Low[i+2]> iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,i+2)-70*Point
     && Close[i+2]> iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,i+2)-10*Point && Low[i+1]>Low[i+2] )
     
//    && !(Low[i+2]< iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,i+2)+30*Point && Low[i+2]> iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,i+2)-50*Point
//     && Close[i+2]> iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,i+2)+30*Point && Low[i+1]<Low[i+2])
     
     ){
               ObjectCreate("Faken"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]+10*Point);
                 ObjectSetText("Faken"+i, "F", 33, "Arial Black", clrBlack);
                 ObjectCreate("Fakez"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]+10*Point);
                 ObjectSetText("Fakez"+i, " F", 33, "Arial Black", clrYellow);
                 fodir[i]=1;}

/////2H Lema

 if (High[i]>High[i+1] && Low[i+1]< iMA(symbol,30,1556,0,MODE_EMA, PRICE_LOW,i+1)+20*Point && Low[i+1]> iMA(symbol,30,1556,0,MODE_EMA, PRICE_LOW,i+1)-40*Point
     && Close[i+1]> iMA(symbol,30,1556,0,MODE_EMA, PRICE_LOW,i+1)+10*Point && Low[i]>Low[i+1]
     && !(Low[i+2]< iMA(symbol,30,1556,0,MODE_EMA, PRICE_LOW,i+2)+20*Point && Low[i+2]> iMA(symbol,30,1556,0,MODE_EMA, PRICE_LOW,i+2)-40*Point
     && Close[i+2]> iMA(symbol,30,1556,0,MODE_EMA, PRICE_LOW,i+2)+50*Point && Low[i+1]>Low[i+2])){
               ObjectCreate("Faken"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]+10*Point);
                 ObjectSetText("Faken"+i, "F", 33, "Arial Black", clrBlack);
                 ObjectCreate("Fakez"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]+10*Point);
                 ObjectSetText("Fakez"+i, " F", 33, "Arial Black", clrYellow);
                 fodir[i]=1;}
                 
////19872       
  if (High[i+2]>High[i+1] && Low[i+1]< iMA(symbol,30,19872,0,MODE_EMA, PRICE_LOW,i+1)+20*Point && Low[i+1]> iMA(symbol,30,19872,0,MODE_EMA, PRICE_LOW,i+1)-30*Point
     && Close[i+1]> iMA(symbol,30,19872,0,MODE_EMA, PRICE_LOW,i+1)+10*Point && Low[i]>Low[i+1]
     && !(Low[i+2]< iMA(symbol,30,19872,0,MODE_EMA, PRICE_LOW,i+2)+20*Point && Low[i+2]> iMA(symbol,30,19872,0,MODE_EMA, PRICE_LOW,i+2)-30*Point
     && Close[i+2]> iMA(symbol,30,19872,0,MODE_EMA, PRICE_LOW,i+2)+50*Point && Low[i+1]>Low[i+2])){
               ObjectCreate("Faken"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]+10*Point);
                 ObjectSetText("Faken"+i, "F", 33, "Arial Black", clrBlack);
                 ObjectCreate("Fakez"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]+10*Point);
                 ObjectSetText("Fakez"+i, " F", 33, "Arial Black", clrYellow);
                 fodir[i]=1;}               
                 
/////39744
  if (Low[i+1]< iMA(symbol,30,39744,0,MODE_EMA, PRICE_LOW,i+1)+20*Point && Low[i+1]> iMA(symbol,30,39744,0,MODE_EMA, PRICE_LOW,i+1)-30*Point
     && Close[i+1]> iMA(symbol,30,39744,0,MODE_EMA, PRICE_LOW,i+1)+50*Point && Low[i]>Low[i+1]
     && !(Low[i+2]< iMA(symbol,30,39744,0,MODE_EMA, PRICE_LOW,i+2)+20*Point && Low[i+2]> iMA(symbol,30,39744,0,MODE_EMA, PRICE_LOW,i+2)-30*Point
     && Close[i+2]> iMA(symbol,30,39744,0,MODE_EMA, PRICE_LOW,i+2)+50*Point && Low[i+1]>Low[i+2])){
               ObjectCreate("Faken"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]+10*Point);
                 ObjectSetText("Faken"+i, "F", 33, "Arial Black", clrBlack);
                 ObjectCreate("Fakez"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]+10*Point);
                 ObjectSetText("Fakez"+i, " F", 33, "Arial Black", clrMagenta);
                 fodir[i]=1;}                      
                 
////30m Lema      
  if (High[i+2]>High[i+1] && Low[i+1]< iMA(symbol,30,828,0,MODE_EMA, PRICE_LOW,i+1)+20*Point && Low[i+1]> iMA(symbol,30,828,0,MODE_EMA, PRICE_LOW,i+1)-30*Point
     && Close[i+1]> iMA(symbol,30,828,0,MODE_EMA, PRICE_LOW,i+1)+10*Point && High[i]>High[i+1]
     && !(Low[i+2]< iMA(symbol,30,828,0,MODE_EMA, PRICE_LOW,i+2)+20*Point && Low[i+2]> iMA(symbol,30,828,0,MODE_EMA, PRICE_LOW,i+2)-30*Point
     && Close[i+2]> iMA(symbol,30,828,0,MODE_EMA, PRICE_LOW,i+2)+10*Point && Low[i+1]>Low[i+2])){
               ObjectCreate("Faken"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]+10*Point);
                 ObjectSetText("Faken"+i, "F", 33, "Arial Black", clrBlack);
                 ObjectCreate("Fakez"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]+10*Point);
                 ObjectSetText("Fakez"+i, " F", 33, "Arial Black", clrYellow);
                 fodir[i]=1;}               


////Green River     
  if (High[i+2]>High[i+1] && Low[i+1]< iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+1)-30*Point && Low[i+1]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+1)-90*Point
     && Close[i+1]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+1)+10*Point && Low[i]>Low[i+1]
     && !(Low[i+2]< iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)-30*Point && Low[i+2]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)-90*Point
     && Close[i+2]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)+50*Point && Low[i+1]>Low[i+2])){
               ObjectCreate("Faken"+i,OBJ_TEXT, 0, Time[i+2], Low[i+2]+10*Point);
                 ObjectSetText("Faken"+i, "F", 33, "Arial Black", clrBlack);
                 ObjectCreate("Fakez"+i,OBJ_TEXT, 0, Time[i+2], Low[i+2]+10*Point);
                 ObjectSetText("Fakez"+i, " F", 33, "Arial Black", clrYellow);
                 fodir[i]=1;} 
                 

////Lower Guard Rail
  if (Low[i+2]>Low[i+1] && Low[i+1]< iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+1)-FMax*10*Point && Low[i+1]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+1)-FMax*10*Point-60*Point
     && Close[i+1]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+1)-FMax*10*Point && Low[i]>Low[i+1]
  //   && Low[i+2]<iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+1)-FMax*10*Point
     && !(Low[i+3]>Low[i+2] && Low[i+2]< iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)-FMax*10*Point && Low[i+2]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)-FMax*10*Point-60*Point
     && Close[i+2]> iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)-FMax*10*Point && Low[i+1]>Low[i+2])
    // && (Open[i+2]>iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)-FMax*10*Point  || Open[i+1]>iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,i+2)-FMax*10*Point)
     ){
                 ObjectCreate("Faken"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]+10*Point);
                 ObjectSetText("Faken"+i, "F", 33, "Arial Black", clrBlack);
                 ObjectCreate("Fakez"+i,OBJ_TEXT, 0, Time[i+1], Low[i+1]+10*Point);
                 ObjectSetText("Fakez"+i, " F", 33, "Arial Black", clrYellow);
                 fodir[i]=1;} 
                        
                 
   }                        
                 


}

deletetxt1("LEMA");


if (Period()==30){

///downside fake-out boxes








if (MathAbs(Open[0]-iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0)-FMax*10*Point)<800*Point && Open[4]>iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0)-FMax*10*Point)
 ObjectCreate("LEMAGRL", OBJ_RECTANGLE, 0,  Time[15], iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0)-FMax*10*Point-60*Point, Time[25], iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0)-FMax*10*Point-120*Point);
  ObjectSetInteger(0,"LEMAGRL",OBJPROP_COLOR,clrCyan);
  ObjectSet("LEMAGRL",OBJPROP_BACK,0);
  ObjectSet("LEMAGRL",OBJPROP_WIDTH,5);

if (MathAbs(Open[0]-iMA(symbol,30,1556,0,MODE_EMA, PRICE_LOW,0))<800*Point && Open[4]>iMA(symbol,30,1556,0,MODE_EMA, PRICE_LOW,0))
 ObjectCreate("LEMA1556L", OBJ_RECTANGLE, 0,  Time[15], iMA(symbol,30,1556,0,MODE_EMA, PRICE_LOW,0)-10*Point, Time[25], iMA(symbol,30,1556,0,MODE_EMA, PRICE_LOW,0)-60*Point);
  ObjectSetInteger(0,"LEMA1556L",OBJPROP_COLOR,clrCyan);
  ObjectSet("LEMA1556L",OBJPROP_BACK,0);
  ObjectSet("LEMA1556L",OBJPROP_WIDTH,5);


if (MathAbs(Open[0]-iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0))<800*Point && Open[4]>iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0))
 ObjectCreate("LEMA414L", OBJ_RECTANGLE, 0,  Time[15], iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0)-10*Point, Time[25], iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0)-60*Point);
  ObjectSetInteger(0,"LEMA414L",OBJPROP_COLOR,clrCyan);
  ObjectSet("LEMA414L",OBJPROP_BACK,0);
  ObjectSet("LEMA414L",OBJPROP_WIDTH,5);


if (MathAbs(Open[0]-iMA(symbol,30,828,0,MODE_EMA, PRICE_LOW,0))<800*Point && Open[4]>iMA(symbol,30,828,0,MODE_EMA, PRICE_LOW,0))
 ObjectCreate("LEMA828L", OBJ_RECTANGLE, 0,  Time[15], iMA(symbol,30,828,0,MODE_EMA, PRICE_LOW,0)-10*Point, Time[25], iMA(symbol,30,828,0,MODE_EMA, PRICE_LOW,0)-60*Point);
  ObjectSetInteger(0,"LEMA828L",OBJPROP_COLOR,clrCyan);
  ObjectSet("LEMA828L",OBJPROP_BACK,0);
  ObjectSet("LEMA828L",OBJPROP_WIDTH,5);


if (MathAbs(Open[0]-iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,0))<800*Point && Open[4]>iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,0))
 ObjectCreate("LEMA135L", OBJ_RECTANGLE, 0,  Time[15], iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,0)-10*Point, Time[25], iMA(symbol,30,135,0,MODE_EMA, PRICE_LOW,0)-60*Point);
  ObjectSetInteger(0,"LEMA135L",OBJPROP_COLOR,clrCyan);
  ObjectSet("LEMA135L",OBJPROP_BACK,0);
  ObjectSet("LEMA135L",OBJPROP_WIDTH,5);



///upside fake-out boxes

if (MathAbs(Open[0]-iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+FMax*10*Point)<800*Point && Open[3]<iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+FMax*10*Point)
 ObjectCreate("LEMAGRU", OBJ_RECTANGLE, 0,  Time[15], iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+FMax*10*Point+60*Point, Time[25], iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+FMax*10*Point+120*Point);
  ObjectSetInteger(0,"LEMAGRU",OBJPROP_COLOR,clrOrangeRed);
  ObjectSet("LEMAGRU",OBJPROP_BACK,0);
  ObjectSet("LEMAGRU",OBJPROP_WIDTH,5);
  

if (MathAbs(Open[0]-iMA(symbol,30,1556,0,MODE_EMA, PRICE_HIGH,0))<800*Point && Open[3]<iMA(symbol,30,1556,0,MODE_EMA, PRICE_HIGH,0))
 ObjectCreate("LEMA1556U", OBJ_RECTANGLE, 0,  Time[15], iMA(symbol,30,1556,0,MODE_EMA, PRICE_HIGH,0)+60*Point, Time[25], iMA(symbol,30,1556,0,MODE_EMA, PRICE_HIGH,0)+10*Point);
  ObjectSetInteger(0,"LEMA1556U",OBJPROP_COLOR,clrOrangeRed);
  ObjectSet("LEMA1556U",OBJPROP_BACK,0);
  ObjectSet("LEMA1556U",OBJPROP_WIDTH,5);  


if (MathAbs(Open[0]-iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0))<800*Point && Open[3]<iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0))
 ObjectCreate("LEMA414U", OBJ_RECTANGLE, 0,  Time[15], iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+60*Point, Time[25], iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+10*Point);
  ObjectSetInteger(0,"LEMA414U",OBJPROP_COLOR,clrOrangeRed);
  ObjectSet("LEMA414U",OBJPROP_BACK,0);
  ObjectSet("LEMA414U",OBJPROP_WIDTH,5);


if (MathAbs(Open[0]-iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0))<800*Point && Open[3]<iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0))
 ObjectCreate("LEMA414U", OBJ_RECTANGLE, 0,  Time[15], iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+60*Point, Time[25], iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+10*Point);
  ObjectSetInteger(0,"LEMA414U",OBJPROP_COLOR,clrOrangeRed);
  ObjectSet("LEMA414U",OBJPROP_BACK,0);
  ObjectSet("LEMA414U",OBJPROP_WIDTH,5);


if (MathAbs(Open[0]-iMA(symbol,30,828,0,MODE_EMA, PRICE_HIGH,0))<800*Point && Open[3]<iMA(symbol,30,828,0,MODE_EMA, PRICE_HIGH,0))
 ObjectCreate("LEMA828U", OBJ_RECTANGLE, 0,  Time[15], iMA(symbol,30,828,0,MODE_EMA, PRICE_HIGH,0)+60*Point, Time[25], iMA(symbol,30,828,0,MODE_EMA, PRICE_HIGH,0)+10*Point);
  ObjectSetInteger(0,"LEMA828U",OBJPROP_COLOR,clrOrangeRed);
  ObjectSet("LEMA828U",OBJPROP_BACK,0);
  ObjectSet("LEMA828U",OBJPROP_WIDTH,5);


if (MathAbs(Open[0]-iMA(symbol,30,135,0,MODE_EMA, PRICE_HIGH,0))<800*Point && Open[3]<iMA(symbol,30,135,0,MODE_EMA, PRICE_HIGH,0))
 ObjectCreate("LEMA135U", OBJ_RECTANGLE, 0,  Time[15], iMA(symbol,30,135,0,MODE_EMA, PRICE_HIGH,0)+60*Point, Time[25], iMA(symbol,30,135,0,MODE_EMA, PRICE_HIGH,0)+10*Point);
  ObjectSetInteger(0,"LEMA135U",OBJPROP_COLOR,clrOrangeRed);
  ObjectSet("LEMA135U",OBJPROP_BACK,0);
  ObjectSet("LEMA135U",OBJPROP_WIDTH,5);





}




if (plot_fluctuation_brackets){
deletetxt1("Fluct"); 
deletetxt1("Der"); 
deletetxt1("Abigail");
deletetxt1("NOBR");

n=1;  
   while (n<Bars){
      if ( RSI2[n]<44 &&  RSI2[n]< RSI2[n-1] &&  RSI2[n]< RSI2[n+1]) break;
      n++;
   }


if (n<Bars  && Period()<=240) { ObjectDelete(0,"Fluct");
     if (n<7) ObjectCreate(0,"Fluct",OBJ_TREND,0,Time[n],Low[n],Time[1],Low[n]+FSize*10*Point,0,0);
     else ObjectCreate(0,"Fluct",OBJ_TREND,0,Time[n],Low[n],Time[n-7],Low[n]+FSize*10*Point,0,0);
    ObjectSetInteger(0,"Fluct",OBJPROP_RAY_RIGHT,false);
         ObjectSet("Fluct",OBJPROP_COLOR,clrWhite);
         ObjectSet("Fluct",OBJPROP_WIDTH,1); 
       
       
                 if (n<7) ObjectCreate("Abigail"+n, OBJ_RECTANGLE, 0,  Time[8], (Low[n]+FSize*10*Point), Time[0], Low[n]+FSize*10*Point+FSize/5*10*Point);
                  else ObjectCreate("Abigail"+n, OBJ_RECTANGLE, 0,  Time[n], (Low[n]+FSize*10*Point), Time[0], Low[n]+FSize*10*Point+FSize/5*10*Point);
  ObjectSetInteger(0,"Abigail"+n,OBJPROP_COLOR,clrOrange);
  ObjectSet("Abigail"+n,OBJPROP_BACK,0);
  ObjectSet("Abigail"+n,OBJPROP_WIDTH,5);
       
       
                        if (n<7) ObjectCreate("Abigail"+o, OBJ_RECTANGLE, 0,  Time[8], (Low[n]+FSize*10*Point), Time[0], Low[n]+FSize*10*Point+FSize/5*10*Point);
                  else ObjectCreate("Abigail"+o, OBJ_RECTANGLE, 0,  Time[n], (Low[n]+FSize*10*Point), Time[0], Low[n]+FSize*10*Point+FSize/5*10*Point);
  ObjectSetInteger(0,"Abigail"+o,OBJPROP_COLOR,clrMagenta);
  ObjectSet("Abigail"+o,OBJPROP_BACK,1);
  ObjectSet("Abigail"+o,OBJPROP_WIDTH,5);
  
  
//  ObjectCreate("Abigail"+o+o, OBJ_RECTANGLE, 0,  Time[32], (Low[n]+FSize*10*Point), Time[4], Low[n]+FSize*10*Point+FSize/5*10*Point);
//  ObjectSetInteger(0,"Abigail"+o+o,OBJPROP_COLOR,clrOrange);
//  ObjectSet("Abigail"+o+o,OBJPROP_BACK,0);
//  ObjectSet("Abigail"+o+o,OBJPROP_WIDTH,5);
  
  
//       ObjectCreate("NOBR", OBJ_TEXT, 0, Time[22], (Low[n]+FSize*10*Point)+30*Point); 
//               ObjectSetText("NOBR", "NO BREAK / EXTENSION", 28, "Arial Black", clrOrange);
  
}


o=1;  
   while (o<Bars){
      if (RSI2[o]>56 && RSI2[o]>RSI2[o-1] && RSI2[o]>RSI2[o+1]) break;
      o++;
   }


if (o<Bars  && Period()<=240) { ObjectDelete(0,"Der");
   if (o<7) ObjectCreate(0,"Der",OBJ_TREND,0,Time[o],High[o],Time[1],High[o]-FSize*10*Point,0,0);
    else  ObjectCreate(0,"Der",OBJ_TREND,0,Time[o],High[o],Time[o-7],High[o]-FSize*10*Point,0,0);
    ObjectSetInteger(0,"Der",OBJPROP_RAY_RIGHT,false);
         ObjectSet("Der",OBJPROP_COLOR,clrWhite);
         ObjectSet("Der",OBJPROP_WIDTH,1); 
         
         
         if (o<7)  ObjectCreate("Abigail"+o, OBJ_RECTANGLE, 0,  Time[8], (High[o]-FSize*10*Point), Time[0], High[o]-FSize*10*Point-FSize/5*10*Point);
         else ObjectCreate("Abigail"+o, OBJ_RECTANGLE, 0,  Time[o], (High[o]-FSize*10*Point), Time[0], High[o]-FSize*10*Point-FSize/5*10*Point);
  ObjectSetInteger(0,"Abigail"+o,OBJPROP_COLOR,clrOrange);
  ObjectSet("Abigail"+o,OBJPROP_BACK,0);
  ObjectSet("Abigail"+o,OBJPROP_WIDTH,5);
  
  
           if (o<7)  ObjectCreate("Abigail"+o+n, OBJ_RECTANGLE, 0,  Time[8], (High[o]-FSize*10*Point), Time[0], High[o]-FSize*10*Point-FSize/5*10*Point);
         else ObjectCreate("Abigail"+o+n, OBJ_RECTANGLE, 0,  Time[o], (High[o]-FSize*10*Point), Time[0], High[o]-FSize*10*Point-FSize/5*10*Point);
  ObjectSetInteger(0,"Abigail"+o+n,OBJPROP_COLOR,clrLime);
  ObjectSet("Abigail"+o+n,OBJPROP_BACK,1);
  ObjectSet("Abigail"+o+n,OBJPROP_WIDTH,5);
  
//  ObjectCreate("Abigail"+o+n+o, OBJ_RECTANGLE, 0,  Time[32], (High[o]-FSize*10*Point), Time[4], High[o]-FSize*10*Point-FSize/5*10*Point);
//  ObjectSetInteger(0,"Abigail"+o+n+o,OBJPROP_COLOR,clrOrange);
 // ObjectSet("Abigail"+o+n+o,OBJPROP_BACK,0);
 // ObjectSet("Abigail"+o+n+o,OBJPROP_WIDTH,5);
  
  
//   ObjectCreate("NOBR2", OBJ_TEXT, 0, Time[22], (High[o]-FSize*10*Point)); 
//               ObjectSetText("NOBR2", "NO BREAK / EXTENSION", 28, "Arial Black", clrOrange);
  
}  
  }

deletetxt1("Pol");

if (plot_polarities){

ObjectCreate( "Pol1", OBJ_TREND, 0, Time[1], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0)-FMax*10*Point-90*Point,4), Time[0], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0)-FMax*10*Point-90*Point,4));
               ObjectSet("Pol1", OBJPROP_COLOR, clrBlack);
               ObjectSet("Pol1", OBJPROP_STYLE, 2 );
               ObjectSet("Pol1", OBJPROP_WIDTH, 3 );
               ObjectSet("Pol1",OBJPROP_RAY_RIGHT,true);
               ObjectSet("Pol1", OBJPROP_BACK, 1 );
               
               
ObjectCreate( "Pol2", OBJ_TREND, 0, Time[1], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0)-FMax*10*Point+90*Point,4), Time[0], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0)-FMax*10*Point+90*Point,4));
               ObjectSet("Pol2", OBJPROP_COLOR, clrBlack);
               ObjectSet("Pol2", OBJPROP_STYLE, 2 );
               ObjectSet("Pol2", OBJPROP_WIDTH, 3 );
               ObjectSet("Pol2",OBJPROP_RAY_RIGHT,true);
               ObjectSet("Pol2", OBJPROP_BACK, 1 );               
        
ObjectCreate( "Pol3", OBJ_TREND, 0, Time[1], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+FMax*10*Point-90*Point,4), Time[0], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+FMax*10*Point-90*Point,4));
               ObjectSet("Pol3", OBJPROP_COLOR, clrBlack);
               ObjectSet("Pol3", OBJPROP_STYLE, 2 );
               ObjectSet("Pol3", OBJPROP_WIDTH, 3 );
               ObjectSet("Pol3",OBJPROP_RAY_RIGHT,true);
               ObjectSet("Pol3", OBJPROP_BACK, 1 );        

ObjectCreate( "Pol4", OBJ_TREND, 0, Time[1], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+FMax*10*Point+90*Point,4), Time[0], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+FMax*10*Point+90*Point,4));
               ObjectSet("Pol4", OBJPROP_COLOR, clrBlack);
               ObjectSet("Pol4", OBJPROP_STYLE, 2 );
               ObjectSet("Pol4", OBJPROP_WIDTH, 3 );
               ObjectSet("Pol4",OBJPROP_RAY_RIGHT,true);
               ObjectSet("Pol4", OBJPROP_BACK, 1 );     


      ObjectCreate("Pol00", OBJ_TEXT, 0, Time[0], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0)-FMax*10*Point-90*Point-.0000,4)); 
               ObjectSetText("Pol00", "      + "+addon, 20, "Arial Black", clrBlack);
               
               
                ObjectCreate("Pol01", OBJ_TEXT, 0, Time[0], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0)-FMax*10*Point+.0004,4)); 
               ObjectSetText("Pol01", "      0 0", 20, "Arial Black", clrBlack);
               

 ObjectCreate("Pol02", OBJ_TEXT, 0, Time[0], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_LOW,0)-FMax*10*Point+90*Point+.0008,4)); 
               ObjectSetText("Pol02", "      0 "+addon, 20, "Arial Black", clrBlack);


ObjectCreate("Pol03", OBJ_TEXT, 0, Time[0], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+FMax*10*Point-90*Point-.0000,4)); 
               ObjectSetText("Pol03", "      0 "+addon, 20, "Arial Black", clrBlack);
               
               
                ObjectCreate("Pol04", OBJ_TEXT, 0, Time[0], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+FMax*10*Point+.0004,4)); 
               ObjectSetText("Pol04", "      0 0", 20, "Arial Black", clrBlack);
               

 ObjectCreate("Pol05", OBJ_TEXT, 0, Time[0], NormalizeDouble(iMA(symbol,30,414,0,MODE_EMA, PRICE_HIGH,0)+FMax*10*Point+90*Point+.0008,4)); 
               ObjectSetText("Pol05", "      - "+addon, 20, "Arial Black", clrBlack);



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

bool LowComparison(int currentpos, int length)
{
  bool condition = False; 
   for(int k=currentpos; k<currentpos+length; k++)
      if (iLow(Symbol(),0,k)<iMA(Symbol(),30, 135,0,MODE_EMA, PRICE_LOW,k)-.0004) {condition=True; break;}
   return (condition);
}

bool HighComparison(int currentpos, int length)
{
  bool condition = False; 
   for(int k=currentpos; k<currentpos+length; k++)
      if (iHigh(Symbol(),0,k)>iMA(Symbol(),30,135,0,MODE_EMA, PRICE_HIGH,k)+.0004) {condition=True; break;}
   return (condition);
}


double ChoppinessIndex(int period, int bar)
  {
    double Low0 = 0, High0 = 0, Close1 = 0;
    double TrueRangeLow = 0, TrueRangeHigh = 0, TrueRangeSum = 0, Input = 0;
    double PeriodTrueRangeLow = 999999999, PeriodTrueRangeHigh = 0, PeriodTrueRange = 0;

    for(int k=bar; k<bar+period; k++)
    {
      Low0   = iLow(NULL,0,k);
      High0  = iHigh(NULL,0,k);
      Close1 = iClose(NULL,0,k+1);

      if (Low0<Close1)  TrueRangeLow  = Low0;  else TrueRangeLow  = Close1;
      if (High0>Close1) TrueRangeHigh = High0; else TrueRangeHigh = Close1;
      
      if (TrueRangeLow <PeriodTrueRangeLow)  PeriodTrueRangeLow  = TrueRangeLow;  // find true low of period
      if (TrueRangeHigh>PeriodTrueRangeHigh) PeriodTrueRangeHigh = TrueRangeHigh; // find true high of period

      TrueRangeSum += TrueRangeHigh;
      TrueRangeSum -= TrueRangeLow;
    }

    PeriodTrueRange = PeriodTrueRangeHigh - PeriodTrueRangeLow;
    if (PeriodTrueRange==0) PeriodTrueRange = MathPow(10, -12); // avoid possibility of division by zero
    Input = TrueRangeSum / PeriodTrueRange;
    return ((logN(Input, 10, MathPow(10, -12)) / logN(period, 10, MathPow(10, -12))) * 100);
  }
  

double logN(double x, double base, double epsilon)
  {
    double integer = 0.0;
    if ((x < 1) || (base < 1)) return(0);

    while (x < 1)
    {
      integer -= 1;
      x *= base;
    }
  
    while (x >= base)
    {
      integer += 1;
      x /= base;
    }
  
    double partial = 0.5;
    x *= x;
    double decimal = 0.0;

    while (partial > epsilon)
    {
      if (x >= base)
      {
        decimal += partial;
        x = x / base;
      }
      partial *= 0.5;
      x *= x;
    }
    
    return (integer + decimal);
  } 


double StdDev(int shift, int samples)
  {
  double x0=0, x1=0, x2=0;
  for (int m=0; m<samples; m++)
    {
    x0 = ExtMapBuffer[m+shift];
    x1 += x0;
    x2 += MathPow(x0,2);
    }
  return(MathSqrt((x2-(x1*x1/samples))/(samples-1))); // minimum samples is 2, enforced in the init section
}
//+------------------------------------------------------------------+

   void deletetxt1(string text){
   for(int iObj=ObjectsTotal()-1; iObj >= 0; iObj--){
      string   on = ObjectName(iObj);
      if(StringFind(on, text) == 0)  ObjectDelete(on);
}  }

It started out as a mean reversion, by the far end of the bear zone 1…
…and that was a wave 1 UP…