Consistent #2

Lesson 3

tips & tips

I would suggest adding a 120-sample HL2 based Bollinger Bands on the 15-min chart. On the hourly this means 30-sample of course.

In a non-trending market every divergent leg is fadeable. On the hourly often the first fractal print would be the end of the measuring leg.

Corrective waves would always have a measuring leg (A-green) and a divergent leg (C-blue).

You can already utilize the previous lessons: the leveraged moves result in timid, low energy waves & the divergent leg would barely get out of the band, whilst the inistor waves are likely to spike outside plenty.

Be careful with squeezes. It is quite visible when this happens. The MT4 does not come with Keltner channels by default. If most of the measuring leg falls outside the bands, do not fade / get in on a continuation.

Don’t pay attention to people trading on 1-minute timeframe. They have nothing valuable to teach you.

Present #1

Projected Distance 240

//+------------------------------------------------------------------+
//|                                           Projected Distance 240 |
//|                                                      by Macdulio |
//|                                                                  |
//+------------------------------------------------------------------+

#include <stdlib.mqh>

#property copyright "Copyright © 2018, Macdulio" 
#property link      "https://forexfore.blog" 
#property description "V1.0"
#property description "Projected Distance 240"
#property description ""
#property description "Extension / Beat Possibilities"
#property description "Plotted for figuring Termminal Move"
#property description "Targets."


#property indicator_chart_window
#property indicator_buffers 6
extern int lookback = 250;
extern bool plot_engulfing=false;
double ATRA;
double ATRAVG[];

double HighBuffer[];
double LowBuffer[];
double HighBuffer2[];
double LowBuffer2[];
extern double FSize=32;
double FMax = FSize*6/5;
string symbol = Symbol(); 
int last_encounter_u, last_encounter_d;
int init()
  {
 
   IndicatorBuffers(15);
   
      SetIndexBuffer(0,HighBuffer);
   SetIndexBuffer(1,LowBuffer);   
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,4,Green);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,4,Green);
   SetIndexBuffer(2,HighBuffer2);
   SetIndexBuffer(3,LowBuffer2);   
   SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,4,Crimson);
   SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,4,Crimson);   
 

   

  ArrayResize(ATRAVG, 103);
   ArrayInitialize(ATRAVG, 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);    

   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
 int j;
   
   
   ATRA = 0;
   for (int i=1; i<=3; i++){ 
     ATRA = ATRA+iATR(NULL,1440,14,i);}
   
   for (i=0; i<=120; i++){ 
     ATRAVG[i] = ATRA/3; }
        

deletetxt1("Projected");
deletetxt1("EPERJES");
deletetxt1("KAROLY");
deletetxt1("EGULF");

  for(i=lookback; i>=0; i--) {  
       LowBuffer[i]=EMPTY_VALUE;
    HighBuffer[i]=EMPTY_VALUE;
     LowBuffer2[i]=EMPTY_VALUE;
    HighBuffer2[i]=EMPTY_VALUE;
    
 if (plot_engulfing){
 
   if (Open[i]>=Close[i+1]-20*Point && Close[i+1]>Open[i+1] && Close[i]<Open[i+1] && Low[i]<Low[i+1]){
          ObjectCreate("EGULF"+IntegerToString(i), OBJ_TEXT, 0, Time[i+1], (High[i]+Low[i])/2+150*Point);  
                ObjectSetText("EGULF"+IntegerToString(i), " E", 46, "Impact",  clrFireBrick);
                ObjectSet("EGULF"+IntegerToString(i),OBJPROP_BACK,1);
      }
 
    if (Open[i]<=Close[i+1]+20*Point && Close[i+1]<Open[i+1] && Close[i]>Open[i+1] && High[i]>High[i+1]){
          ObjectCreate("EGULF"+IntegerToString(i), OBJ_TEXT, 0, Time[i+1], (High[i]+Low[i])/2+150*Point);  
                ObjectSetText("EGULF"+IntegerToString(i), " E", 46, "Impact",  clrDarkGreen);
                ObjectSet("EGULF"+IntegerToString(i),OBJPROP_BACK,1);
      }
 }
 
 ////upside projection
 
 
        if (Period()==5 && i<30 && iHigh(NULL,240,i+1)-iLow(NULL,240,i+3)>FSize*27*Point && iHigh(NULL,240,i+1)>iHigh(NULL,240,i+3) && iHigh(NULL,240,i+1)+(iHigh(NULL,240,i+1)-iLow(NULL,240,i+3))*.5>iMA(NULL,0,52,0,MODE_EMA, PRICE_HIGH,i)+FMax*5*Point && !(iLow(symbol,240,i+1)<iMA(NULL,240,52,0,MODE_EMA, PRICE_MEDIAN,i+1))){
               LowBuffer[i*48]=iHigh(NULL,240,i+1);
               HighBuffer[i*48]=iHigh(NULL,240,i+1)+(iHigh(NULL,240,i+1)-iLow(NULL,240,i+3))*.5;
            }    
 
   else
          if (Period()==60 && iHigh(NULL,240,i+1)-iLow(NULL,240,i+3)>FSize*27*Point && iHigh(NULL,240,i+1)>iHigh(NULL,240,i+3) && iHigh(NULL,240,i+1)+(iHigh(NULL,240,i+1)-iLow(NULL,240,i+3))*.5>iMA(NULL,0,52,0,MODE_EMA, PRICE_HIGH,i)+FMax*5*Point && !(iLow(symbol,240,i+1)<iMA(NULL,240,52,0,MODE_EMA, PRICE_MEDIAN,i+1))) {
             LowBuffer[i*4]=iHigh(NULL,240,i+1);
             HighBuffer[i*4]=iHigh(NULL,240,i+1)+(iHigh(NULL,240,i+1)-iLow(NULL,240,i+3))*.5;}
         
else 
 if (Period()>60 && iHigh(NULL,240,i+1)-iLow(NULL,240,i+3)>FSize*27*Point && iHigh(NULL,240,i+1)>iHigh(NULL,240,i+3) && iHigh(NULL,240,i+1)+(iHigh(NULL,240,i+1)-iLow(NULL,240,i+3))*.5>iMA(NULL,0,52,0,MODE_EMA, PRICE_HIGH,i)+FMax*5*Point && !(iLow(symbol,240,i+1)<iMA(NULL,240,52,0,MODE_EMA, PRICE_MEDIAN,i+1))) {
            if (Period()==240){ LowBuffer[i]=iHigh(NULL,240,i+1);
             HighBuffer[i]=iHigh(NULL,240,i+1)+(iHigh(NULL,240,i+1)-iLow(NULL,240,i+3))*.5;}
             
              ObjectCreate("ProjectedXLR"+IntegerToString(i), OBJ_TEXT, 0, Time[i+2], iHigh(NULL,240,i+1)+(iHigh(NULL,240,i+1)-iLow(NULL,240,i+3))*.5+20*Point);  
                ObjectSetText("ProjectedXLR"+IntegerToString(i), " "+DoubleToStr(NormalizeDouble(iHigh(NULL,240,i+1)+((iHigh(NULL,240,i+1)-iLow(NULL,240,i+3)))*.5,4),4), 16, "Arial Black",  clrBlack);
             
              ObjectCreate("ProjectedXR"+IntegerToString(i), OBJ_TEXT, 0, Time[i+2], iHigh(NULL,240,i+1)+(iHigh(NULL,240,i+1)-iLow(NULL,240,i+3))*.5+20*Point);  
                ObjectSetText("ProjectedXR"+IntegerToString(i), DoubleToStr(NormalizeDouble(iHigh(NULL,240,i+1)+((iHigh(NULL,240,i+1)-iLow(NULL,240,i+3)))*.5,4),4), 16, "Arial Black",  clrCrimson);
                if (iHigh(NULL,240,i)-iLow(NULL,240,iLowest(NULL,240,MODE_LOW,50,i))<1800*Point) ObjectSetText("ProjectedXR"+IntegerToString(i), DoubleToStr(NormalizeDouble(iHigh(NULL,240,i+1)+((iHigh(NULL,240,i+1)-iLow(NULL,240,i+3)))*.5,4),4), 16, "Arial Black",  clrGray);
             
                   
                   if (HighBuffer[i+2]==EMPTY_VALUE && HighBuffer[i+1]!=EMPTY_VALUE && HighBuffer[i]<HighBuffer[i+1]) {
                      ObjectCreate("ProjectedXCR"+IntegerToString(i), OBJ_TEXT, 0, Time[i+2], iHigh(NULL,240,i+1)+(iHigh(NULL,240,i+1)-iLow(NULL,240,i+3))*.5-400*Point+20*Point);  
                ObjectSetText("ProjectedXCR"+IntegerToString(i), " Sq. Exit: "+DoubleToStr(NormalizeDouble(iHigh(NULL,240,i+1)+((iHigh(NULL,240,i+1)-iLow(NULL,240,i+3)))*.5-400*Point,4),4), 16, "Impact",  clrBlack);
             
              ObjectCreate("ProjectedXDR"+IntegerToString(i), OBJ_TEXT, 0, Time[i+2], iHigh(NULL,240,i+1)+(iHigh(NULL,240,i+1)-iLow(NULL,240,i+3))*.5-400*Point+20*Point);  
                ObjectSetText("ProjectedXDR"+IntegerToString(i), "Sq. Exit: "+DoubleToStr(NormalizeDouble(iHigh(NULL,240,i+1)+((iHigh(NULL,240,i+1)-iLow(NULL,240,i+3)))*.5-400*Point,4),4), 16, "Impact",  clrDodgerBlue);
                   
                   }
      
             if (Period()>60 && i>0){
               j=i-1;
               while (j>=0){
                  if (iHigh(symbol,0,j)>HighBuffer[i] && iClose(symbol,0,j)<HighBuffer[i]) break;    
                 j--;            
               }
               if (iHigh(symbol,0,j)>HighBuffer[i] && iClose(symbol,0,j)<HighBuffer[i] && HighBuffer[i]>iMA(NULL,0,52,0,MODE_EMA, PRICE_HIGH,i)+FMax*5*Point) {
               
                if (i<1000){                  
                 ObjectCreate(0,"Projected"+i,OBJ_TREND,0,Time[i],HighBuffer[i],Time[j],HighBuffer[i]);
                 ObjectSetInteger(0,"Projected"+i,OBJPROP_RAY_RIGHT,false);
                 ObjectSet("Projected"+i,OBJPROP_COLOR,clrRed);
                 ObjectSet("Projected"+i,OBJPROP_WIDTH,3); 
                 ObjectSet("Projected"+i,OBJPROP_BACK,1); 
                 last_encounter_u = j;
                 }
                 
                 if (i<40){
                  ObjectCreate("Projected"+IntegerToString(j), OBJ_TEXT, 0, Time[j+2], HighBuffer[i]+20*Point);  
                ObjectSetText("Projected"+IntegerToString(j), "X-Fill!", 16, "Arial Black",  clrCrimson);
   
                }
                 
                 
                 }
                 
                else if (j<0){ 
                 
                                      
                   ObjectCreate(0,"Projected"+i,OBJ_TREND,0,Time[5],HighBuffer[i],Time[0],HighBuffer[i]);
                   ObjectSetInteger(0,"Projected"+i,OBJPROP_RAY_RIGHT,false);
                   ObjectSet("Projected"+i,OBJPROP_COLOR,clrPurple);
                   ObjectSet("Projected"+i,OBJPROP_WIDTH,3); 
                   ObjectSet("Projected"+i,OBJPROP_BACK,1); 
                 
                 if (i<140 && j>=0){
                  ObjectCreate("Projectedx"+IntegerToString(i), OBJ_TEXT, 0, Time[13], HighBuffer[i]+80*Point);  
                   ObjectSetText("Projectedx"+IntegerToString(i), "UnFilled: "+DoubleToStr(HighBuffer[i],4), 16, "Arial Black",  clrMagenta);}
                 }
                 
             }
             
         }
         
  
         
//downside projection         
         
         
       if (Period()==5 && i<30 && iHigh(NULL,240,i+3)-iLow(NULL,240,i+1)>FSize*27*Point && iLow(NULL,240,i+1)<iLow(NULL,240,i+3) && iLow(NULL,240,i+1)-(iHigh(NULL,240,i+3)-iLow(NULL,240,i+1))*.5<iMA(NULL,0,52,0,MODE_EMA, PRICE_LOW,i)-FMax*5.5*Point && !(iClose(symbol,240,i+1)>iMA(NULL,240,52,0,MODE_EMA, PRICE_MEDIAN,i+1) && iLow(symbol,240,i+1)<iMA(NULL,240,52,0,MODE_EMA, PRICE_MEDIAN,i+1))  ){
            LowBuffer2[i*48]=iLow(NULL,240,i+1);
            HighBuffer2[i*48]=iLow(NULL,240,i+1)-(iHigh(NULL,240,i+3)-iLow(NULL,240,i+1))*.5;    
            
         }


     else  if (Period()==60 && iHigh(NULL,240,i+3)-iLow(NULL,240,i+1)>FSize*27*Point && iLow(NULL,240,i+1)<iLow(NULL,240,i+3) && iLow(NULL,240,i+1)-(iHigh(NULL,240,i+3)-iLow(NULL,240,i+1))*.5<iMA(NULL,0,52,0,MODE_EMA, PRICE_LOW,i)-FMax*5.5*Point && !(iClose(symbol,240,i+1)>iMA(NULL,240,52,0,MODE_EMA, PRICE_MEDIAN,i+1) && iLow(symbol,240,i+1)<iMA(NULL,240,52,0,MODE_EMA, PRICE_MEDIAN,i+1)) && iLow(NULL,240,iLowest(NULL,0,MODE_LOW,3,i))<iLow(NULL,240,iLowest(NULL,0,MODE_LOW,9,i+3))-250*Point){
           LowBuffer2[i*4]=iLow(NULL,240,i+1);
            HighBuffer2[i*4]=iLow(NULL,240,i+1)-(iHigh(NULL,240,i+3)-iLow(NULL,240,i+1))*.5;  }
            
         
         
        else  if (Period()>60 && iHigh(NULL,240,i+3)-iLow(NULL,240,i+1)>FSize*27*Point && iLow(NULL,240,i+1)<iLow(NULL,240,i+3) && iLow(NULL,240,i+1)-(iHigh(NULL,240,i+3)-iLow(NULL,240,i+1))*.5<iMA(NULL,0,52,0,MODE_EMA, PRICE_LOW,i)-FMax*5.5*Point && !(iClose(symbol,240,i+1)>iMA(NULL,240,52,0,MODE_EMA, PRICE_MEDIAN,i+1) && iLow(symbol,240,i+1)<iMA(NULL,240,52,0,MODE_EMA, PRICE_MEDIAN,i+1)) && iLow(NULL,240,iLowest(NULL,0,MODE_LOW,3,i))<iLow(NULL,240,iLowest(NULL,0,MODE_LOW,9,i+3))-250*Point){
         if (Period()==240){   LowBuffer2[i]=iLow(NULL,240,i+1);
            HighBuffer2[i]=iLow(NULL,240,i+1)-(iHigh(NULL,240,i+3)-iLow(NULL,240,i+1))*.5;  }
            
            
            ObjectCreate("ProjectedXLR"+IntegerToString(i), OBJ_TEXT, 0, Time[i+2], iLow(NULL,240,i+1)-(iHigh(NULL,240,i+3)-iLow(NULL,240,i+1))*.5+50*Point);  
                ObjectSetText("ProjectedXLR"+IntegerToString(i), " "+DoubleToStr(NormalizeDouble(iLow(NULL,240,i+1)-(iHigh(NULL,240,i+3)-iLow(NULL,240,i+1))*.5,4),4), 16, "Arial Black",  clrBlack);
              ObjectCreate("ProjectedXR"+IntegerToString(i), OBJ_TEXT, 0, Time[i+2], iLow(NULL,240,i+1)-(iHigh(NULL,240,i+3)-iLow(NULL,240,i+1))*.5+50*Point);  
                ObjectSetText("ProjectedXR"+IntegerToString(i), DoubleToStr(NormalizeDouble(iLow(NULL,240,i+1)-(iHigh(NULL,240,i+3)-iLow(NULL,240,i+1))*.5,4),4), 16, "Arial Black",  clrDarkGreen);
                if (iHigh(NULL,240,iHighest(NULL,240,MODE_HIGH,50,i))-iLow(NULL,240,i)<1700*Point) ObjectSetText("ProjectedXR"+IntegerToString(i), DoubleToStr(NormalizeDouble(iLow(NULL,240,i+1)-(iHigh(NULL,240,i+3)-iLow(NULL,240,i+1))*.5,4),4), 16, "Arial Black",  clrGray);
      
                 if (Period()>60 && i>0){
               j=i-1;
               while (j>=0){
                  if (iLow(symbol,0,j)<HighBuffer2[i] && iHigh(symbol,0,j)>HighBuffer2[i]) break;    
                 j--;            
               }
               if (iLow(symbol,0,j)<HighBuffer2[i] && iHigh(symbol,0,j)>HighBuffer2[i] && HighBuffer2[i]<iMA(NULL,0,52,0,MODE_EMA, PRICE_LOW,i)-FMax*5*Point) {
               
                 if (i<1000){               
                 ObjectCreate(0,"Projectedx"+i,OBJ_TREND,0,Time[i],HighBuffer2[i],Time[j],HighBuffer2[i]);
                 ObjectSetInteger(0,"Projectedx"+i,OBJPROP_RAY_RIGHT,false);
                 ObjectSet("Projectedx"+i,OBJPROP_COLOR,clrDarkGreen);
                 ObjectSet("Projectedx"+i,OBJPROP_WIDTH,3); 
                 ObjectSet("Projectedx"+i,OBJPROP_BACK,1); 
                 last_encounter_d = j;
                 }
                 
                 
                 if (i<40){
                 ObjectCreate("Projected"+IntegerToString(j), OBJ_TEXT, 0, Time[j+2], HighBuffer2[i]-10*Point);  
                ObjectSetText("Projected"+IntegerToString(j), "X-Fill!", 16, "Arial Black",  clrDarkGreen);
   
                }
             }
             
             else if (j<0){ 
                  ObjectCreate(0,"Projectedx"+i,OBJ_TREND,0,Time[5],HighBuffer2[i],Time[0],HighBuffer2[i]);
                 ObjectSetInteger(0,"Projectedx"+i,OBJPROP_RAY_RIGHT,false);
                 ObjectSet("Projectedx"+i,OBJPROP_COLOR,clrBlue);
                 ObjectSet("Projectedx"+i,OBJPROP_WIDTH,3); 
                 ObjectSet("Projectedx"+i,OBJPROP_BACK,1); 
                 
                 
                 if (i<140 && j>=0){
                 ObjectCreate("Projectedy"+IntegerToString(i), OBJ_TEXT, 0, Time[13], HighBuffer2[i]+50*Point);  
                ObjectSetText("Projectedy"+IntegerToString(i), "UnFilled: "+DoubleToStr(HighBuffer2[i],4), 16, "Arial Black",  clrPurple);}
             }
            }
            
            }

      if (Period()==240 && HighBuffer[i+9]!=EMPTY_VALUE && i<50  && High[i+8]<HighBuffer[i+9] && High[i+7]<HighBuffer[i+9] && High[i+6]<HighBuffer[i+9] && High[i+5]<HighBuffer[i+9] && High[i+4]<HighBuffer[i+9] && High[i+3]<HighBuffer[i+9] && High[i+2]<HighBuffer[i+9] && High[i+1]<HighBuffer[i+9]) {
        
       if (i>1) {
        
        j=i-1;
        
        while (j>=0){
         if (High[j]>HighBuffer[i+9]) break;
         j--;}
        
         if (j<0) {
        
         ObjectCreate("EPERJES"+DoubleToStr(i), OBJ_RECTANGLE, 0, Time[i+2], HighBuffer[i+9], Time[i], HighBuffer[i+9]+FSize/2*10*Point);
         ObjectSetInteger(0,"EPERJES"+DoubleToStr(i),OBJPROP_COLOR,clrOrange);
      }}}
      
       if (Period()==240 && HighBuffer2[i+9]!=EMPTY_VALUE && i<50  && Low[i+8]>HighBuffer2[i+9] && Low[i+7]>HighBuffer2[i+9] && Low[i+6]>HighBuffer2[i+9] && Low[i+5]>HighBuffer2[i+9] && Low[i+4]>HighBuffer2[i+9] && Low[i+3]>HighBuffer2[i+9] && Low[i+2]>HighBuffer2[i+9] && Low[i+1]>HighBuffer2[i+9]) {
       
          if (i>1) {
        
        j=i-1;
        
        while (j>0){
         if (Low[j]<HighBuffer2[i+9]) break;
         j--;}
        
         if (j==0) {
         ObjectCreate("EPERJES"+DoubleToStr(i), OBJ_RECTANGLE, 0, Time[i+2], HighBuffer2[i+9], Time[i], HighBuffer2[i+9]-FSize/2*10*Point);
         ObjectSetInteger(0,"EPERJES"+DoubleToStr(i),OBJPROP_COLOR,clrOrange);
      }}}
}


deletetxt1("KAROLY");

if (last_encounter_u>8 && last_encounter_u<last_encounter_d){ 
            ObjectCreate("EPERJES", OBJ_TEXT, 0, Time[25], Close[0]+250*Point);  
            ObjectSetText("EPERJES", "Play Short Below: "+DoubleToStr(NormalizeDouble(iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,8,last_encounter_u-8)),4),4), 16, "Arial Black",  clrCrimson);
            
            
             ObjectCreate("KAROLY", OBJ_TEXT, 0, Time[25], Close[0]+150*Point);  
            ObjectSetText("KAROLY", "Play Long From: "+DoubleToStr(NormalizeDouble(iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,8,last_encounter_u-8))+60*Point,4),4), 16, "Arial Black",  clrPurple);
            
     
   }


if (last_encounter_d>8 && last_encounter_u>last_encounter_d){ 
            ObjectCreate("EPERJES", OBJ_TEXT, 0, Time[25], Close[0]+250*Point);  
            ObjectSetText("EPERJES", "Play Long Above: "+DoubleToStr(NormalizeDouble(iLow(symbol,0,iLowest(symbol,0,MODE_LOW,8,last_encounter_d-8)),4),4), 16, "Arial Black",  clrDarkGreen);
            
            ObjectCreate("KAROLY", OBJ_TEXT, 0, Time[25], Close[0]+150*Point);  
            ObjectSetText("KAROLY", "Play Short From: "+DoubleToStr(NormalizeDouble(iLow(symbol,0,iLowest(symbol,0,MODE_LOW,8,last_encounter_d-8))-60*Point,4),4), 16, "Arial Black",  clrPurple);
            
           
   }
   
   if (last_encounter_u>8){
   
             ObjectCreate("EPERJESRACK"+i, OBJ_RECTANGLE, 0, Time[last_encounter_u], Close[last_encounter_u], Time[last_encounter_u-8], iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,9,last_encounter_u-8)));
           ObjectSet("EPERJESRACK"+i,OBJPROP_BACK,1);
           if (Close[0]<iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,9,last_encounter_u-8))+60*Point) ObjectSetInteger(0,"EPERJESRACK"+i,OBJPROP_COLOR,clrCrimson);
            else ObjectSetInteger(0,"EPERJESRACK"+i,OBJPROP_COLOR,clrGreen);
}


   if (last_encounter_d>8){
    ObjectCreate("EPERJESBACK"+i, OBJ_RECTANGLE, 0, Time[last_encounter_d], Close[last_encounter_d], Time[last_encounter_d-8], iLow(symbol,0,iLowest(symbol,0,MODE_LOW,9,last_encounter_d-8)));
           ObjectSet("EPERJESBACK"+i,OBJPROP_BACK,1);
            
         if (Close[0]>iLow(symbol,0,iLowest(symbol,0,MODE_LOW,9,last_encounter_d-8))-60*Point) ObjectSetInteger(0,"EPERJESBACK"+i,OBJPROP_COLOR,clrGreen);
         else ObjectSetInteger(0,"EPERJESBACK"+i,OBJPROP_COLOR,clrCrimson);
            

}

if (Period()<240){
for(i=lookback; i>=0; i--) {  
  if (i>0 && HighBuffer[i]!=EMPTY_VALUE ){
    
               j=i-1;
               while (j>=0){
                  if (High[j]>HighBuffer[i] && Low[j]<HighBuffer[i] && HighBuffer[i]!=EMPTY_VALUE) break;    
                 j--;            
               }
               if (High[j]>HighBuffer[i] && Low[j]<HighBuffer[i] && HighBuffer[i]!=EMPTY_VALUE) {
               
                 ObjectCreate(0,"Projected"+i,OBJ_TREND,0,Time[i],HighBuffer[i],Time[j],HighBuffer[i]);
                 ObjectSetInteger(0,"Projected"+i,OBJPROP_RAY_RIGHT,false);
                 ObjectSet("Projected"+i,OBJPROP_COLOR,clrRed);
                 ObjectSet("Projected"+i,OBJPROP_WIDTH,3); 
                 ObjectSet("Projected"+i,OBJPROP_BACK,1); 
                                  
                 ObjectCreate("Projected"+IntegerToString(j), OBJ_TEXT, 0, Time[j+2], HighBuffer[i]+20*Point);  
                ObjectSetText("Projected"+IntegerToString(j), "X-Fill! 40+pips counter", 16, "Arial Black",  clrCrimson);
                 
                 
                 }
                 
                else if (j<0 && HighBuffer[i]!=EMPTY_VALUE){ 
                 
                  ObjectCreate(0,"Projected"+i,OBJ_TREND,0,Time[5],HighBuffer[i],Time[0],HighBuffer[i]);
                   ObjectSetInteger(0,"Projected"+i,OBJPROP_RAY_RIGHT,false);
                   ObjectSet("Projected"+i,OBJPROP_COLOR,clrPurple);
                   ObjectSet("Projected"+i,OBJPROP_WIDTH,3); 
                   ObjectSet("Projected"+i,OBJPROP_BACK,1); 
                 
                 if (j>=0){
                  ObjectCreate("Projectedx"+IntegerToString(i), OBJ_TEXT, 0, Time[13], HighBuffer[i]+80*Point);  
                   ObjectSetText("Projectedx"+IntegerToString(i), "UnFilled: "+DoubleToStr(HighBuffer[i],4), 16, "Arial Black",  clrMagenta);}
                 }
                 
             }

     if (i>0 && HighBuffer2[i]!=EMPTY_VALUE){
               
               j=i-1;
               while (j>=0){
                  if (Low[j]<HighBuffer2[i] && High[j]>HighBuffer2[i] && HighBuffer2[i]!=EMPTY_VALUE) break;    
                 j--;            
               }
               if (Low[j]<HighBuffer2[i] && High[j]>HighBuffer2[i] && HighBuffer2[i]!=EMPTY_VALUE) {
               
                 ObjectCreate(0,"Projectedx"+i,OBJ_TREND,0,Time[i],HighBuffer2[i],Time[j],HighBuffer2[i]);
                 ObjectSetInteger(0,"Projectedx"+i,OBJPROP_RAY_RIGHT,false);
                 ObjectSet("Projectedx"+i,OBJPROP_COLOR,clrDarkGreen);
                 ObjectSet("Projectedx"+i,OBJPROP_WIDTH,3); 
                 ObjectSet("Projectedx"+i,OBJPROP_BACK,1); 
                 
                 
                 ObjectCreate("Projected"+IntegerToString(j), OBJ_TEXT, 0, Time[j+2], HighBuffer2[i]-10*Point);  
                ObjectSetText("Projected"+IntegerToString(j), "X-Fill! 40+pips counter", 16, "Arial Black",  clrDarkGreen);
             }
             
             else if (j<0 && HighBuffer2[i]!=EMPTY_VALUE){ 
                  ObjectCreate(0,"Projected"+i,OBJ_TREND,0,Time[5],HighBuffer2[i],Time[j],HighBuffer2[i]);
                 ObjectSetInteger(0,"Projected"+i,OBJPROP_RAY_RIGHT,false);
                 ObjectSet("Projected"+i,OBJPROP_COLOR,clrBlue);
                 ObjectSet("Projected"+i,OBJPROP_WIDTH,3); 
                 ObjectSet("Projected"+i,OBJPROP_BACK,1); 
                 
                 
                 if (j>=0){
                 ObjectCreate("Projectedy"+IntegerToString(i), OBJ_TEXT, 0, Time[13], HighBuffer2[i]+50*Point);  
                ObjectSetText("Projectedy"+IntegerToString(i), "UnFilled: "+DoubleToStr(HighBuffer2[i],4), 16, "Arial Black",  clrPurple);}
             }
            }

}
}




  ObjectCreate("Projected", OBJ_TEXT, 0, Time[13], (iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,30,0))+iLow(symbol,0,iLowest(symbol,0,MODE_LOW,30,0)))/2);  
                ObjectSetText("Projected", "Q: "+DoubleToStr(NormalizeDouble(ATRAVG[1]*10000,4),1), 16, "Arial Black",  clrPurple);


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