Better Volume Pro Sabotaged

This is forex, and my Bear / Bull market separator is still 3 consecutive weekly closes on one side of the E-59.

Price finished between the Weekly R3 (1.0917), and the Window Envelope at 1.0901, after a bear market rally & got more overbought than it was at the peak made by the Bull Market. Go figure. I think 2 more weeks closing above the E-59 would be a lot to ask.

Cyan = professional activity.

Red = high volume churn down

Green = high volume churn up

Out of music.

#property copyright   "Better Volume Pro Sabotaged by Macdulio, (c) 2021"
#property link        "http://www.forexfore.blog"
#property description "Better Volume Pro Sabotaged by Macdulio"
//#property strict

#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 Chartreuse
#property indicator_color2 DimGray
#property indicator_color3 Yellow
#property indicator_color4 Cyan
#property indicator_color5 Red
#property indicator_color6 Magenta
#property indicator_color7 Maroon

#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 2
#property indicator_width6 2

extern int lookback = 100;
extern int     NumberOfBars = 500;
extern string  Note = "0 means Display all bars";
extern int     MAPeriod = 100;
extern int     LookBack = 20;
extern bool    AlertEmail=false;
extern bool    AlertSound=false;
extern bool    AlertPopup=false;

datetime       LastAlert;
string symbol = Symbol();

double red[],blue[],yellow[],green[],white[],magenta[],v4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
      SetIndexBuffer(0,red);
      SetIndexStyle(0,DRAW_HISTOGRAM,0,5);
      SetIndexLabel(0,"Climax High ");
      
      SetIndexBuffer(1,blue);
      SetIndexStyle(1,DRAW_HISTOGRAM,0,5);
      SetIndexLabel(1,"Neutral");
      
      SetIndexBuffer(2,yellow);
      SetIndexStyle(2,DRAW_HISTOGRAM,0,5);
      SetIndexLabel(2,"Low ");
      
      SetIndexBuffer(3,green);
      SetIndexStyle(3,DRAW_HISTOGRAM,0,5);
      SetIndexLabel(3,"HighChurn ");
      
      SetIndexBuffer(4,white);
      SetIndexStyle(4,DRAW_HISTOGRAM,0,5);
      SetIndexLabel(4,"Climax Low ");
      
      SetIndexBuffer(5,magenta);
      SetIndexStyle(5,DRAW_HISTOGRAM,0,5);
      SetIndexLabel(5,"ClimaxChurn ");
      
      SetIndexBuffer(6,v4);
      SetIndexStyle(6,DRAW_LINE,0,2);
      SetIndexLabel(6,"Average("+MAPeriod+")");
      
      IndicatorShortName("Better Volume PRO" );
      

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
  
//----
   return(0);
  }
  
string PeriodToText(int per) {

   switch (per)
   {
      case PERIOD_M1: return("M1");
      case PERIOD_M5: return("M5");
      case PERIOD_M15: return("M15");
      case PERIOD_M30: return("M30");
      case PERIOD_H1: return("H1");
      case PERIOD_H4: return("H4");
      case PERIOD_D1: return("D1");
      case PERIOD_W1: return("W1");
      case PERIOD_MN1: return("MN1");
   }

}  
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  
   double VolLowest,Range,Value2,Value3,HiValue2,HiValue3,LoValue3,tempv2,tempv3,tempv;
   int limit,j;
   int counted_bars=IndicatorCounted();
   
   
   
   
deletetxt1("PENELOPE");


 ObjectCreate("PENELOPE"+6,OBJ_LABEL,0, 0,0);
  ObjectSet("PENELOPE"+6,OBJPROP_CORNER,0);
    ObjectSet("PENELOPE"+6,OBJPROP_XDISTANCE,0);
  ObjectSet("PENELOPE"+6,OBJPROP_YDISTANCE,20);
  ObjectSet("PENELOPE"+6,OBJPROP_COLOR,clrNavy); 
  ObjectSetText("PENELOPE"+6,"Every Break Out is A",9,"Arial Black");


ObjectCreate("PENELOPE"+9,OBJ_LABEL,0, 0,0);
  ObjectSet("PENELOPE"+9,OBJPROP_CORNER,0);
    ObjectSet("PENELOPE"+9,OBJPROP_XDISTANCE,0);
  ObjectSet("PENELOPE"+9,OBJPROP_YDISTANCE,40);
  ObjectSet("PENELOPE"+9,OBJPROP_COLOR,clrNavy); 
  ObjectSetText("PENELOPE"+9,"Money Flow-Break Out",9,"Arial Black");
   
   
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   if ( NumberOfBars == 0 ) 
      NumberOfBars = Bars-counted_bars;
   limit=NumberOfBars; //Bars-counted_bars;
   
      
   for(int i=0; i<lookback; i++)   
      {
         red[i] = 0; blue[i] = Volume[i]; yellow[i] = 0; green[i] = 0; white[i] = 0; magenta[i] = 0;
         Value2=0;Value3=0;HiValue2=0;HiValue3=0;LoValue3=99999999;tempv2=0;tempv3=0;tempv=0;
         
         
         VolLowest = Volume[iLowest(NULL,0,MODE_VOLUME,20,i)];
    //    if (Volume[i] == VolLowest)
    //        {
    //           yellow[i] = NormalizeDouble(Volume[i],0);
    //           blue[i]=0;
    //        }
               
         Range = (High[i]-Low[i]);
         Value2 = Volume[i]*Range;
         
         if (  Range != 0 )
            Value3 = Volume[i]/Range;
            
         
         for ( int n=i;n<i+MAPeriod;n++ )
            {
               tempv= Volume[n] + tempv; 
            } 
          v4[i] = NormalizeDouble(tempv/MAPeriod,0);
         
          
          for ( n=i;n<i+LookBack;n++)
            {
               tempv2 = Volume[n]*((High[n]-Low[n])); 
               if ( tempv2 >= HiValue2 )
                  HiValue2 = tempv2;
                    
               if ( Volume[n]*((High[n]-Low[n])) != 0 )
                  {           
                     tempv3 = Volume[n] / ((High[n]-Low[n]));
                     if ( tempv3 > HiValue3 ) 
                        HiValue3 = tempv3; 
                     if ( tempv3 < LoValue3 )
                        LoValue3 = tempv3;
                  } 
            }
                                      
         
            
    
            
               if ( Value2 == HiValue2  && Close[i] > (High[i] + Low[i]) / 2 )
            {
               red[i] = NormalizeDouble(Volume[i],0);
               blue[i]=0;
               yellow[i]=0;
            } 
          else     if ( Value3 == HiValue3 )
            {
               green[i] = NormalizeDouble(Volume[i],0);                
               blue[i] =0;
               yellow[i]=0;
               red[i]=0;
            }  
            
            
          if ( Value2 == HiValue2 && Value3 == HiValue3 )
            {
               magenta[i] = NormalizeDouble(Volume[i],0);
               blue[i]=0;
               red[i]=0;
               green[i]=0;
               yellow[i]=0;
            } 
         if ( Value2 == HiValue2  && Close[i] <= (High[i] + Low[i]) / 2 )
            {
               white[i] = NormalizeDouble(Volume[i],0);
               magenta[i]=0;
               blue[i]=0;
               red[i]=0;
               green[i]=0;
               yellow[i]=0;
            } 
            
         
      }
//----Alert Code - gah

   if (AlertEmail || AlertSound || AlertPopup)
      if (Time[0] != LastAlert) {
         LastAlert = Time[0];

         if (red[1] > 0) {
            if (AlertSound)
               PlaySound("alert");
            if (AlertPopup)
               Alert(Symbol() +" "+PeriodToText(Period())+ " Climax High at " + TimeToStr(TimeLocal(),TIME_DATE|TIME_MINUTES));
            if (AlertEmail)
               SendMail(WindowExpertName() + " - " + Symbol() +" "+PeriodToText(Period())+ " Climax High at " + TimeToStr(TimeLocal(),TIME_DATE|TIME_MINUTES),"New Climax High");
         }//if (red[1] > 0)          

         if (white[1] > 0) {
            if (AlertSound)
               PlaySound("alert");
            if (AlertPopup)
               Alert(Symbol() +" "+PeriodToText(Period())+ " Climax Low at " + TimeToStr(TimeLocal(),TIME_DATE|TIME_MINUTES));
            if (AlertEmail)
               SendMail(WindowExpertName() + " - " + Symbol() +" "+PeriodToText(Period())+ " Climax Low at " + TimeToStr(TimeLocal(),TIME_DATE|TIME_MINUTES),"New Climax Low");
         }//if (white[1] > 0) 
         
      }//if (Time[0] != LastAlert) 

deletetxt1("Cinzano");
deletetxt1("Duhh");
   
    for(i=lookback; i>=0; i--)   
    {
      ///U-Turn Down
        if ( white[i]!=0 && red[i+1]!=0){
            ObjectCreate("Cinzano"+IntegerToString(i), OBJ_RECTANGLE, 0,  Time[i+1], iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,1,i))+10*Point, Time[i], iLow(symbol,0,iLowest(symbol,0,MODE_LOW,1,i))-10*Point);
          ObjectSetInteger(0,"Cinzano"+IntegerToString(i),OBJPROP_COLOR,clrCrimson);
          ObjectSet("Cinzano"+IntegerToString(i),OBJPROP_BACK,1);
          ObjectSet("Cinzano"+IntegerToString(i),OBJPROP_WIDTH,1);
          
                    ObjectCreate("Cinzanoy"+IntegerToString(i), OBJ_TEXT, 0, Time[i], iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,2,i+1))-280*Point+20*Point); 
     
         ObjectSetText("Cinzanoy"+IntegerToString(i), "U-TURN DOWN", 14, "Impact", Navy);  
          
                      
        }
        ///U-Turn Up
        if ( white[i+1]!=0 && red[i]!=0){
            ObjectCreate("Cinzano"+IntegerToString(i), OBJ_RECTANGLE, 0,  Time[i+1], iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,1,i))+10*Point, Time[i], iLow(symbol,0,iLowest(symbol,0,MODE_LOW,1,i))-10*Point);
          ObjectSetInteger(0,"Cinzano"+IntegerToString(i),OBJPROP_COLOR,clrChartreuse);
          ObjectSet("Cinzano"+IntegerToString(i),OBJPROP_BACK,1);
          ObjectSet("Cinzano"+IntegerToString(i),OBJPROP_WIDTH,1);     
          
                    ObjectCreate("Cinzanoy"+IntegerToString(i), OBJ_TEXT, 0, Time[i], iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,2,i+1))-280*Point+20*Point); 
     
         ObjectSetText("Cinzanoy"+IntegerToString(i), "U-TURN UP", 14, "Impact", Navy);         
        }
        
         ///Out of Upside Volume Turn Down
        if (green[i]==0 && red[i]==0 && red[i+1]!=0 && Volume[i]>Volume[i+1] ){
            ObjectCreate("Cinzano"+IntegerToString(i), OBJ_RECTANGLE, 0,  Time[i+1], iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,1,i))+10*Point, Time[i], iLow(symbol,0,iLowest(symbol,0,MODE_LOW,1,i))-10*Point);
          ObjectSetInteger(0,"Cinzano"+IntegerToString(i),OBJPROP_COLOR,clrRed);
          ObjectSet("Cinzano"+IntegerToString(i),OBJPROP_BACK,1);
          ObjectSet("Cinzano"+IntegerToString(i),OBJPROP_WIDTH,1);  
          
          
         if (i<0 && green[i-1]==0){ 
            ObjectCreate("Cinzanoy"+IntegerToString(i), OBJ_TEXT, 0, Time[i], iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,2,i+1))-280*Point+20*Point); 
            ObjectSetText("Cinzanoy"+IntegerToString(i), "NO MORE BUYS", 14, "Impact", Navy);                     
          
          if (red[i+2]==0 ){
           j=i;
      while (j>0){
         if (Low[j]<Open[i+1] && Low[j]<Close[i+1]) break;
         j--;
      }
        if (j<0) j=0;  
            ObjectCreate("Cinzanoss"+IntegerToString(i), OBJ_RECTANGLE, 0,  Time[i+1], iLow(symbol,0,iLowest(symbol,0,MODE_LOW,1,i))-40*Point, Time[j], iLow(symbol,0,iLowest(symbol,0,MODE_LOW,1,i)));
          ObjectSetInteger(0,"Cinzanoss"+IntegerToString(i),OBJPROP_COLOR,clrSpringGreen);
          ObjectSet("Cinzanoss"+IntegerToString(i),OBJPROP_BACK,1);
          ObjectSet("Cinzanoss"+IntegerToString(i),OBJPROP_WIDTH,3); 
          
          ObjectCreate("Cinzanoszs"+IntegerToString(i), OBJ_TEXT, 0, Time[i+1], iLow(symbol,0,iLowest(symbol,0,MODE_LOW,1,i))+280*Point+20*Point); 
                if (iMA(NULL,60,67,0,MODE_EMA, PRICE_HIGH,i)>iMA(NULL,60,207,0,MODE_EMA, PRICE_HIGH,i))          ObjectSetText("Cinzanoszs"+IntegerToString(i), "TGT:"+DoubleToStr(NormalizeDouble(iLow(symbol,0,iLowest(symbol,0,MODE_LOW,1,i))+280*Point,4),4), 14, "Impact", DarkGreen);
         else ObjectSetText("Cinzanoszs"+IntegerToString(i), "(TGT:"+DoubleToStr(NormalizeDouble(iLow(symbol,0,iLowest(symbol,0,MODE_LOW,1,i))+280*Point,4),4)+")", 14, "Impact", DarkGreen);           
          }
          }      
        } 
         ///Out of Downside Volume Turn Up
        if ( white[i+1]!=0 && white[i]==0 && Volume[i]>Volume[i+1]){
            ObjectCreate("Cinzano"+IntegerToString(i), OBJ_RECTANGLE, 0,  Time[i+1], iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,1,i))+10*Point, Time[i], iLow(symbol,0,iLowest(symbol,0,MODE_LOW,1,i))-10*Point);
          ObjectSetInteger(0,"Cinzano"+IntegerToString(i),OBJPROP_COLOR,clrChartreuse);
          ObjectSet("Cinzano"+IntegerToString(i),OBJPROP_BACK,1);
          ObjectSet("Cinzano"+IntegerToString(i),OBJPROP_WIDTH,1);       
          
          
          if (i<0 && green[i-1]==0){
               ObjectCreate("Cinzanoy"+IntegerToString(i), OBJ_TEXT, 0, Time[i], iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,2,i+1))-280*Point+20*Point); 
               ObjectSetText("Cinzanoy"+IntegerToString(i), "NO MORE SELLS", 14, "Impact", Navy);       
          }     
        }
        
        
        ///First Sore White
          if ( i>0 && white[i+2]==0 && green[i+2]==0 && red[i+1]!=0 && red[i]==0 && red[i-1]==0  && white[i-1]==0 && Volume[i]<Volume[i+1]){
           j=i-1;
      while (j>0){
         if (High[j]>High[i+1]) break;
         j--;
      }
        if (j<0) j=0;  
          ObjectCreate("Cinzanos"+IntegerToString(i), OBJ_RECTANGLE, 0,  Time[i+1], iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,2,i+1))+50*Point, Time[j], iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,2,i+1)));
          ObjectSetInteger(0,"Cinzanos"+IntegerToString(i),OBJPROP_COLOR,clrRed);
          ObjectSet("Cinzanos"+IntegerToString(i),OBJPROP_BACK,1);
          ObjectSet("Cinzanos"+IntegerToString(i),OBJPROP_WIDTH,3);      
          
           ObjectCreate("Cinzanosz"+IntegerToString(i), OBJ_TEXT, 0, Time[i], iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,2,i+1))-280*Point+20*Point); 
     
         ObjectSetText("Cinzanosz"+IntegerToString(i), "TGT:"+DoubleToStr(NormalizeDouble(iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,2,i+1))-280*Point,4),4), 14, "Impact", Crimson);                 
        }
        
          ///First Sore Red
      if ( i>0 && red[i+2]==0 && green[i+2]==0  && white[i+1]!=0 && white[i]==0 && white[i-1]==0 && red[i-1]==0 && Volume[i]<Volume[i+1]){
      j=i-1;
      while (j>0){
         if (Low[j]<Low[i+1]) break;
         j--;
      }
        if (j<0) j=0;  
            ObjectCreate("Cinzanos"+IntegerToString(i), OBJ_RECTANGLE, 0,  Time[i+1], iLow(symbol,0,iLowest(symbol,0,MODE_LOW,2,i+1))-50*Point, Time[j], iLow(symbol,0,iLowest(symbol,0,MODE_LOW,2,i+1)));
          ObjectSetInteger(0,"Cinzanos"+IntegerToString(i),OBJPROP_COLOR,clrSpringGreen);
          ObjectSet("Cinzanos"+IntegerToString(i),OBJPROP_BACK,1);
          ObjectSet("Cinzanos"+IntegerToString(i),OBJPROP_WIDTH,3);
          
                   ObjectCreate("Cinzanosy"+IntegerToString(i), OBJ_TEXT, 0, Time[i+4], Low[i]-50*Point); 
         ObjectSetText("Cinzanosy"+IntegerToString(i), " BUY @:"+DoubleToStr(NormalizeDouble((iLow(symbol,0,iLowest(symbol,0,MODE_LOW,2,i))-50*Point),4),4), 14, "Impact", White);
         ObjectCreate("Cinzanosx"+IntegerToString(i), OBJ_TEXT, 0, Time[i+4], Low[i]-50*Point); 
         ObjectSetText("Cinzanosx"+IntegerToString(i), "BUY @:"+DoubleToStr(NormalizeDouble((iLow(symbol,0,iLowest(symbol,0,MODE_LOW,2,i))-50*Point),4),4), 14, "Impact", DarkGreen); 
          
          ObjectCreate("Cinzanosz"+IntegerToString(i), OBJ_TEXT, 0, Time[i], iLow(symbol,0,iLowest(symbol,0,MODE_LOW,2,i+1))+280*Point+20*Point); 
           if (iMA(NULL,60,67,0,MODE_EMA, PRICE_HIGH,i)>iMA(NULL,60,207,0,MODE_EMA, PRICE_HIGH,i))    ObjectSetText("Cinzanosz"+IntegerToString(i), "TGT:"+DoubleToStr(NormalizeDouble(iLow(symbol,0,iLowest(symbol,0,MODE_LOW,2,i+1))+280*Point,4),4), 14, "Impact", DarkGreen);  
       else  ObjectSetText("Cinzanosz"+IntegerToString(i), "(TGT:"+DoubleToStr(NormalizeDouble(iLow(symbol,0,iLowest(symbol,0,MODE_LOW,2,i+1))+280*Point,4),4)+")", 14, "Impact", DarkGreen);           
        }
        
        
        
        ///first Climax down        
        if ( white[i+3]==0 && white[i+2]==0 && white[i+1]==0 && white[i]!=0 && red[i+1]==0 && High[i]-Close[i]<180*Point){
                      ObjectCreate("DuhhW"+DoubleToStr(i), OBJ_RECTANGLE, 0, Time[i+3], High[i], Time[i], iClose(symbol,0,i));
                      ObjectSetInteger(0,"DuhhW"+DoubleToStr(i),OBJPROP_COLOR,clrWhite);
                      ObjectSet("DuhhW"+DoubleToStr(i),OBJPROP_WIDTH,3);
                      ObjectSet("DuhhW"+DoubleToStr(i),OBJPROP_BACK,0);
        
        }
        ///first Climax up        
        if ( red[i+3]==0 && red[i+2]==0 && red[i+1]==0 && red[i]!=0 && white[i+1]==0 && Close[i]-Low[i]<180*Point && i>0
        && white[i-1]==0
        ){
                      ObjectCreate("Duhh"+DoubleToStr(i), OBJ_RECTANGLE, 0, Time[i+3], Low[i], Time[i], iClose(symbol,0,i));
                      ObjectSetInteger(0,"Duhh"+DoubleToStr(i),OBJPROP_COLOR,clrYellow);
                      ObjectSet("Duhh"+DoubleToStr(i),OBJPROP_WIDTH,3);
                      ObjectSet("Duhh"+DoubleToStr(i),OBJPROP_BACK,0);
        }
        
      
      ///Magenta  
      if (i<200 && magenta[i]!=0){
          ObjectCreate("Cinzano"+IntegerToString(i), OBJ_RECTANGLE, 0,  Time[i], iHigh(symbol,0,iHighest(symbol,0,MODE_HIGH,1,i))-20*Point, Time[0], iLow(symbol,0,iLowest(symbol,0,MODE_LOW,1,i))+20*Point);
          ObjectSetInteger(0,"Cinzano"+IntegerToString(i),OBJPROP_COLOR,clrMagenta);
          ObjectSet("Cinzano"+IntegerToString(i),OBJPROP_BACK,1);
          ObjectSet("Cinzano"+IntegerToString(i),OBJPROP_WIDTH,1);  
      
      }
    }
   
//----
   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);
}  }