//+------------------------------------------------------------------+
//|                                           smLandline TradingAreas_v1
//+------------------------------------------------------------------+
#property copyright "Copyright 03.07.2017, SwingMan"
#property strict

#property description "ForexFactory: The 'V' trading system"
#property description "Autor: sam68"
#property description "---"
#property description "@landline #Post 402"
#property description "https://www.forexfactory.com/showthread.php?t=666624&page=21"

/*--------------------------------------------------------------------
03.07.2017  v1    - First version
--------------------------------------------------------------------*/

#property indicator_chart_window
#property indicator_buffers 2

#property indicator_color1 clrBlack
#property indicator_color2 clrBlack

#property indicator_width1 2
#property indicator_width2 2

//---- input parameters
//====================================================================
input int ADR_Period=10;
input int DaysBack  =30;
input bool Consider_GMT_Offset=false;
input string ____ReferenceVerticalLine____="--------------------------------------------";
input bool Draw_ReferenceVerticalLine=false;
input int ReferenceHour=7;
input color Color_ReferenceVerticalLine=clrYellow;
input int Width_ReferenceVerticalLine=1;
input ENUM_LINE_STYLE Style_ReferenceVerticalLine=STYLE_SOLID;
input bool Draw_Areas_AboveBelowHiLo=false;
input color Color_Area_AboveHigh=clrBisque;
input color Color_Area_BelowLow =clrLime;
input string ____ChartParameters____="--------------------------------------------";
input bool Draw_HighLow_Lines    =false;
input bool Change_ChartProperties=false;
input string ____Lines____="--------------------------------------------";
input bool Draw_DailyOpen   =true;
input bool Draw_DailyPivot  =true;
input bool Draw_DailyMiddle =true;
input bool Draw_PivotAverage =true;
input int PivotAverage_Period=3;
input color Color_DailyOpen_Line   =clrOrange;
input color Color_DailyPivot_Line  =clrFireBrick;
input color Color_DailyMiddle_Line =clrSaddleBrown;
input color Color_PivotAverage_Line=clrOrangeRed;
input string ____Areas____="--------------------------------------------";
input bool Draw_DailyMinMaxLines=true;
input color Color_DailyMinMaxLines_AreaUP=clrDarkSeaGreen;
input color Color_DailyMinMaxLines_AreaDN=clrLightCoral;
input bool Draw_DailyPivotRange=true;
input color Color_DailyPivotRange_Area=clrSilver;
//====================================================================

//---- constants
string sObject="LTZ_";

//---- indicator buffers
double arrHighs[],arrLows[];

//---- variables
int limit,maxBars;
int userTimeFrame;
bool timeFrameOK;

double dATR,dATR_D1;
bool newBar,newDay;
datetime thisTime,oldTime,thisDay,oldDay;
datetime firstDailyTime,lastDailyTime;
//
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--Buffers  
   SetIndexBuffer(0,arrHighs);   SetIndexLabel(0,"High");
   SetIndexBuffer(1,arrLows);  SetIndexLabel(1,"Low");

//--- chart properties   
   if(Change_ChartProperties==true)
     {
      ChartSetInteger(0,CHART_SHOW_GRID,false);
      ChartSetInteger(0,CHART_SHOW_PERIOD_SEP,false);
      ChartSetInteger(0,CHART_COLOR_BACKGROUND,clrPowderBlue);
      ChartSetInteger(0,CHART_COLOR_FOREGROUND,clrBlack);

      ChartSetInteger(0,CHART_MODE,CHART_BARS);
      ChartSetInteger(0,CHART_COLOR_CHART_UP,clrWhite);
      ChartSetInteger(0,CHART_COLOR_CHART_DOWN,clrWhite);
     }
//=========================================================

//--- get maxBars   
   int barsPerDay=PERIOD_D1/Period();

   thisDay=iTime(Symbol(),PERIOD_D1,0);
   int weekDay=TimeDayOfWeek(thisDay);

   newDay=false;
//int i=0;
   int barToday=0;
   while(newDay==false)
     {
      thisTime=iTime(Symbol(),Period(),barToday);
      if(TimeDayOfWeek(thisTime)!=weekDay)
         newDay=true;
      else
        {
         barToday++;
        }
     }

   maxBars=barToday;
   for(int i=1;i<DaysBack;i++)
     {
      thisDay=iTime(Symbol(),PERIOD_D1,i);
      if(TimeDayOfWeek(thisDay)!=SUNDAY)
        {
         maxBars=maxBars+barsPerDay;
        }
     }
//---

   timeFrameOK=(Period()<PERIOD_D1);
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   Delete_Objects(sObject);
  }
//---

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   if(timeFrameOK==false) return(0);

   int counted_bars=IndicatorCounted();
   if(counted_bars < 0)  return(-1);
   if(counted_bars>0) counted_bars-=10;

   limit=Bars-counted_bars-1;

   if(maxBars>0)
     {
      limit=MathMin(maxBars,limit);
     }
   RefreshRates();

//-- draw values ------------------------------------------
   for(int i=limit; i>=0; i--)
     {
      if(Draw_HighLow_Lines==true)
        {
         arrHighs[i]=High[i];
         arrLows[i] =Low[i];
        }
      //-- ceck new bar -----------------------------------------
      if(iTime(Symbol(),Period(),i)!=oldTime)
        {
         newBar=true;
         oldTime=iTime(Symbol(),Period(),i);
        }
      else newBar=false;

      //-- ceck new Day -----------------------------------------
      int iBarD1=iBarShift(Symbol(),PERIOD_D1,Time[i],false);
      if(iTime(Symbol(),PERIOD_D1,iBarD1)!=oldDay)
        {
         newDay=true;
         oldDay=iTime(Symbol(),PERIOD_D1,iBarD1);
        }
      else newDay=false;

      //-- Draw daily horizontal lines
      //if(Draw_HorizontalLines==true)
      Draw_DailyHorizontalLines(i);

      Draw_DailyVerticalLine(i);

      //#########################################
      if(i==0)
        {
         Show_MarketInfos();
        }
     }
//---
   return(0);
  }
//====================================================================
//          END of PROGRAM START
//====================================================================
//                *****************************************
//                *****************************************
//                            TEMP FUNCTIONS
//                *****************************************
//                *****************************************
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Show_MarketInfos()
  {
//   x=x0;
//   y=y0-yStep;
//
//   string objectName;
//   string showText;
//   color  colorText;
//   int windex=WindowFind(WindowExpertName());
//
//   color colorInfoText=clrDodgerBlue;
//   color colorWarningText=clrRed;
//
////-- Spread -----------------------------------------------
//   y=y+yStep;
//   objectName=sObject+"Spread";
//   if(ObjectFind(objectName)==-1)
//     {
//      if(ObjectCreate(objectName,OBJ_LABEL,windex,0,0))
//        {
//         ObjectSet(objectName,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
//         ObjectSet(objectName,OBJPROP_XDISTANCE,x);
//         ObjectSet(objectName,OBJPROP_YDISTANCE,y);
//        }
//     }
//   showText="Spread: "+DoubleToString(MarketInfo(Symbol(),MODE_SPREAD),0);
//
//   if(MarketInfo(Symbol(),MODE_SPREAD)<=Max_Spread)
//      colorText=colorInfoText;
//   else
//     {
//      showText=showText+" > "+string(Max_Spread);
//      colorText=colorWarningText;
//     }
//   ObjectSetText(objectName,showText,font_size,font_name,colorText);
//
////-- Tick Value -------------------------------------------
//   y=y+yStep;
//   objectName=sObject+"TickValue";
//   if(ObjectFind(objectName)==-1)
//     {
//      if(ObjectCreate(objectName,OBJ_LABEL,windex,0,0))
//        {
//         ObjectSet(objectName,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
//         ObjectSet(objectName,OBJPROP_XDISTANCE,x);
//         ObjectSet(objectName,OBJPROP_YDISTANCE,y);
//        }
//     }
//   showText="TickValue: "+DoubleToString(MarketInfo(Symbol(),MODE_TICKVALUE),2);
//   ObjectSetText(objectName,showText,font_size,font_name,colorInfoText);
//
////-- ATR --------------------------------------------------
//   y=y+yStep;
//   objectName=sObject+"ATR";
//   if(ObjectFind(objectName)==-1)
//     {
//      if(ObjectCreate(objectName,OBJ_LABEL,windex,0,0))
//        {
//         ObjectSet(objectName,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
//         ObjectSet(objectName,OBJPROP_XDISTANCE,x);
//         ObjectSet(objectName,OBJPROP_YDISTANCE,y);
//        }
//     }
//   showText="ATR["+string(ATR_Period)+"]: "+DoubleToString(dATR/Point,0);
//   ObjectSetText(objectName,showText,font_size,font_name,colorInfoText);
//
////-- ATR D1 -----------------------------------------------
//   y=y+yStep;
//   objectName=sObject+"ATR_D1";
//   if(ObjectFind(objectName)==-1)
//     {
//      if(ObjectCreate(objectName,OBJ_LABEL,windex,0,0))
//        {
//         ObjectSet(objectName,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
//         ObjectSet(objectName,OBJPROP_XDISTANCE,x);
//         ObjectSet(objectName,OBJPROP_YDISTANCE,y);
//        }
//     }
//   showText="ATR[D1]: "+DoubleToString(dATR_D1/Point,0);
//   ObjectSetText(objectName,showText,font_size,font_name,colorInfoText);
//
////-- BUY, SELL, OFF day -----------------------------------
//   y=y+yStep;
//   objectName=sObject+"Trade_Day";
//   if(ObjectFind(objectName)==-1)
//     {
//      if(ObjectCreate(objectName,OBJ_LABEL,windex,0,0))
//        {
//         ObjectSet(objectName,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
//         ObjectSet(objectName,OBJPROP_XDISTANCE,x);
//         ObjectSet(objectName,OBJPROP_YDISTANCE,y);
//        }
//     }
//   double dClose   =iClose(Symbol(),Period(),0);
//   double dailyOpen=iOpen(Symbol(),PERIOD_D1,0);
//   double dPivot   =iMA(Symbol(),PERIOD_D1,1,0,MODE_SMA,PRICE_TYPICAL,1);
//   double dPivotAvg=iMA(Symbol(),PERIOD_D1,3,0,MODE_SMA,PRICE_TYPICAL,1);
//   string showTextAllowed="(don't trade)";
//
////-- Open above Pivot ----------------------------------
//   if(dailyOpen>dPivot && dPivot>dPivotAvg)
//     {
//      showText="BUY day";
//      colorText=clrGreen;
//      if(dClose>dailyOpen) showTextAllowed="(LONG allowed)";
//      else
//      if(dClose<dPivot)
//        {
//         showText="BUY day"+"  (Reverse)";
//         showTextAllowed="(SHORT allowed)";
//        }
//     }
//   else
////-- Open belove Pivot ---------------------------------
//   if(dailyOpen<dPivot && dPivot<dPivotAvg)
//     {
//      showText="SELL day";
//      colorText=clrMagenta;
//      if(dClose<dailyOpen) showTextAllowed="(SHORT allowed)";
//      else
//      if(dClose>dPivot)
//        {
//         showText="SELL day"+"  (Reverse)";
//         showTextAllowed="(LONG allowed)";
//        }
//     }
//   else
//     {
//      showText="OFF day";
//      colorText=clrGray;
//     }
//   ObjectSetText(objectName,showText,font_size,font_name,colorText);
//
////-- Trade allowed ----------------------------------------
//   y=y+yStep;
//   objectName=sObject+"Trade_Allowed";
//   if(ObjectFind(objectName)==-1)
//     {
//      if(ObjectCreate(objectName,OBJ_LABEL,windex,0,0))
//        {
//         ObjectSet(objectName,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
//         ObjectSet(objectName,OBJPROP_XDISTANCE,x);
//         ObjectSet(objectName,OBJPROP_YDISTANCE,y);
//        }
//     }
//   ObjectSetText(objectName,showTextAllowed,font_size,font_name,colorText);
//
////-- GMT offset -------------------------------------------
//   y=y+yStep;
//   objectName=sObject+"GMT_Offset";
//   colorText=colorInfoText;
//
//   double dOffsetServerLocal=MathFloor(TimeLocal()-TimeCurrent())/(60*60);
//   int iGMToffset=TimeGMTOffset()/(60*60);
//   double dOffset=MathFloor(iGMToffset+dOffsetServerLocal);
//   int iOffset=(int)dOffset;
//
//   showText="GMT offset="+string(iOffset);
//
//   if(ObjectFind(objectName)==-1)
//     {
//      if(ObjectCreate(objectName,OBJ_LABEL,windex,0,0))
//        {
//         ObjectSet(objectName,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
//         ObjectSet(objectName,OBJPROP_XDISTANCE,x);
//         ObjectSet(objectName,OBJPROP_YDISTANCE,y);
//        }
//     }
//   ObjectSetText(objectName,showText,font_size,font_name,colorText);
////################
//   y=y+yStep;
//   objectName=sObject+"GMT_Time";
//   colorText=colorInfoText;
////datetime thisTime=TimeCurrent();
//   showText="GMT Time="+TimeToString(TimeGMT(),TIME_MINUTES|TIME_SECONDS);
////showText="GMT Time="+TimeGMT(thisTime);
////showText="GMT Time="+string(TimeGMT(thisTime)/(60*60));
//   if(ObjectFind(objectName)==-1)
//     {
//      if(ObjectCreate(objectName,OBJ_LABEL,windex,0,0))
//        {
//         ObjectSet(objectName,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
//         ObjectSet(objectName,OBJPROP_XDISTANCE,x);
//         ObjectSet(objectName,OBJPROP_YDISTANCE,y);
//        }
//     }
//   ObjectSetText(objectName,showText,font_size,font_name,colorText);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Draw_DailyVerticalLine(int iBar)
  {
   datetime timeServer=TimeCurrent();
   datetime timeGMT=TimeGMT();

   datetime thisHourTime=iTime(Symbol(),PERIOD_H1,iBar);
   datetime diffGmtTime=TimeCurrent()-TimeGMT(); //+10;
   int diffGmtHours=TimeHour(diffGmtTime);

   datetime checkTime;
   if(Consider_GMT_Offset==true)
      checkTime=thisHourTime-diffGmtTime;
   else
      checkTime=thisHourTime;
   int checkHour=TimeHour(checkTime);
   
////#### TEST
//if(iBar==7)
//int iii=3;

   if(TimeHour(checkTime)==ReferenceHour)
     {
      //          ******************************************
      //---             1. draw vertical line
      //          ******************************************
      if(Draw_ReferenceVerticalLine==true)
        {
         string objectNameDO=sObject+"ReferenceHour_"+TimeToString(thisHourTime);
         if(ObjectCreate(objectNameDO,OBJ_VLINE,0,thisHourTime,0))
           {
            ObjectSet(objectNameDO,OBJPROP_COLOR,Color_ReferenceVerticalLine);
            ObjectSet(objectNameDO,OBJPROP_WIDTH,Width_ReferenceVerticalLine);
            ObjectSet(objectNameDO,OBJPROP_STYLE,Style_ReferenceVerticalLine);
            ObjectSet(objectNameDO,OBJPROP_BACK,false);
           }
        }
      //          ******************************************
      //---             2. draw areas
      //          ******************************************
      if(Draw_Areas_AboveBelowHiLo==true)
        {
         //-- daily bar number
         int iBarD1=iBarShift(Symbol(),PERIOD_D1,Time[iBar],false);
         int sub_window=0;

         firstDailyTime=iTime(Symbol(),PERIOD_D1,iBarD1);
         lastDailyTime=firstDailyTime+(PERIOD_D1/Period()-1)*60*Period();

         double thisHigh=iHigh(Symbol(),Period(),iBar);
         double thisLow =iLow(Symbol(),Period(),iBar);
         double dATRx=iATR(Symbol(),PERIOD_D1,10,iBarD1);

         //-- 2.1 area above high
         string objectName=sObject+"AreaAboveHigh_"+TimeToString(thisHourTime);
         if(ObjectCreate(objectName,OBJ_RECTANGLE,sub_window,thisHourTime,thisLow,lastDailyTime,thisLow+dATRx))
           {
            ObjectSet(objectName,OBJPROP_COLOR,Color_Area_AboveHigh);
            ObjectSet(objectName,OBJPROP_BACK,true);
           }
         //-- 2.2 area below low
         objectName=sObject+"AreaBelowLow_"+TimeToString(thisHourTime);
         if(ObjectCreate(objectName,OBJ_RECTANGLE,sub_window,thisHourTime,thisHigh,lastDailyTime,thisHigh-dATRx))
           {
            ObjectSet(objectName,OBJPROP_COLOR,Color_Area_BelowLow);
            ObjectSet(objectName,OBJPROP_BACK,true);
           }
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Draw_DailyHorizontalLines(int iBar)
  {
   static double dailyOpen,dPivot,dMiddle,dPivotAvg;
//static double dClose;
   static string objectNameDO;
   string objectName;

//-- Draw Open, Pivot, PivotAverage lines -----------------
   if(newBar==true)
     {
      if(TimeDayOfWeek(Time[iBar])==SATURDAY || TimeDayOfWeek(Time[iBar])==SUNDAY)
         return;

      if(newDay==true)
        {
         //-- daily bar number
         int iBarD1=iBarShift(Symbol(),PERIOD_D1,Time[iBar],false);
         int sub_window=0;

         firstDailyTime=iTime(Symbol(),PERIOD_D1,iBarD1);
         lastDailyTime=firstDailyTime+(PERIOD_D1/Period()-1)*60*Period();

         dailyOpen=iOpen(Symbol(),PERIOD_D1,iBarD1);
         dPivot   =iMA(Symbol(),PERIOD_D1,1,0,MODE_SMA,PRICE_TYPICAL,iBarD1+1);
         dMiddle  =iMA(Symbol(),PERIOD_D1,1,0,MODE_SMA,PRICE_MEDIAN,iBarD1+1);
         dPivotAvg=iMA(Symbol(),PERIOD_D1,PivotAverage_Period,0,MODE_SMA,PRICE_TYPICAL,iBarD1+1);

         //              ****************************************************
         //              *       Draw LINES
         //              ****************************************************
         //-- 1. daily open line
         if(Draw_DailyOpen==true)
           {
            objectNameDO=sObject+"DailyOpen_"+TimeToString(firstDailyTime);
            if(ObjectCreate(objectNameDO,OBJ_TREND,sub_window,firstDailyTime,dailyOpen,lastDailyTime,dailyOpen))
              {
               ObjectSet(objectNameDO,OBJPROP_COLOR,Color_DailyOpen_Line); //clrDodgerBlue
               ObjectSet(objectNameDO,OBJPROP_WIDTH,4);
               ObjectSet(objectNameDO,OBJPROP_BACK,true);
               ObjectSet(objectNameDO,OBJPROP_RAY,false);
              }
           }
         //-- 2. daily pivot line
         if(Draw_DailyPivot==true)
           {
            objectName=sObject+"DailyPivot_"+TimeToString(firstDailyTime);
            if(ObjectCreate(objectName,OBJ_TREND,sub_window,firstDailyTime,dPivot,lastDailyTime,dPivot))
              {
               ObjectSet(objectName,OBJPROP_COLOR,Color_DailyPivot_Line); //clrFireBrick
               ObjectSet(objectName,OBJPROP_WIDTH,2);
               ObjectSet(objectName,OBJPROP_BACK,true);
               ObjectSet(objectName,OBJPROP_RAY,false);
              }
           }
         //-- 3. daily pivot line
         if(Draw_DailyMiddle==true)
           {
            objectName=sObject+"DailyMiddle_"+TimeToString(firstDailyTime);
            if(ObjectCreate(objectName,OBJ_TREND,sub_window,firstDailyTime,dMiddle,lastDailyTime,dMiddle))
              {
               ObjectSet(objectName,OBJPROP_COLOR,Color_DailyMiddle_Line); //clrSaddleBrown
               ObjectSet(objectName,OBJPROP_WIDTH,2);
               ObjectSet(objectName,OBJPROP_BACK,true);
               ObjectSet(objectName,OBJPROP_RAY,false);
              }
           }

         //-- 4. daily pivot average line
         if(Draw_PivotAverage==true)
           {
            objectName=sObject+"DailyPivotAvg_"+TimeToString(firstDailyTime);
            if(ObjectCreate(objectName,OBJ_TREND,sub_window,firstDailyTime,dPivotAvg,lastDailyTime,dPivotAvg))
              {
               ObjectSet(objectName,OBJPROP_COLOR,Color_PivotAverage_Line); //clrOrange
               ObjectSet(objectName,OBJPROP_WIDTH,3);
               ObjectSet(objectName,OBJPROP_BACK,true);
               ObjectSet(objectName,OBJPROP_RAY,false);
              }
           }
         //              ****************************************************
         //              *       Draw AREAS
         //              ****************************************************
         //-- 1. daily pivot range area
         if(Draw_DailyPivotRange==true)
           {
            objectName=sObject+"DailyPivotRange_"+TimeToString(firstDailyTime);
            if(ObjectCreate(objectName,OBJ_RECTANGLE,sub_window,firstDailyTime,dPivot,lastDailyTime,dMiddle))
              {
               ObjectSet(objectName,OBJPROP_COLOR,Color_DailyPivotRange_Area);
               ObjectSet(objectName,OBJPROP_BACK,true);
              }
           }

         //-- 2. daily MinMax lines area
         color dColor;
         if(Draw_DailyMinMaxLines==true)
           {
            double maxValue1=MathMax(dailyOpen,dPivot);
            double maxValue2=MathMax(dMiddle,dPivotAvg);
            double maxValue =MathMax(maxValue1,maxValue2);

            double minValue1=MathMin(dailyOpen,dPivot);
            double minValue2=MathMin(dMiddle,dPivotAvg);
            double minValue =MathMin(minValue1,minValue2);
            
            if(iClose(Symbol(),Period(),iBar)>dPivotAvg) 
            dColor=Color_DailyMinMaxLines_AreaUP; else dColor=Color_DailyMinMaxLines_AreaDN;
            
            objectName=sObject+"DailyMinMaxLines_"+TimeToString(firstDailyTime);
            if(ObjectCreate(objectName,OBJ_RECTANGLE,sub_window, firstDailyTime,minValue,lastDailyTime,maxValue))
              {
               ObjectSet(objectName,OBJPROP_COLOR,dColor);
               ObjectSet(objectName,OBJPROP_BACK,true);
              }
           }           
        }

      //      else
      //      //-- check allowed trading -----------------
      //      if(newDay==false)
      //        {
      //         dClose=iClose(Symbol(),Period(),iBar);
      //
      //         //-- identify BUY, SELL, OFF day -----------------
      //         string showTextAllowed="(don't trade)";
      //         string showText;
      //         string empty="                 ";
      //         //-- Open above Pivot ----------------------------------
      //         if(dailyOpen>dPivot && dPivot>dPivotAvg)
      //           {
      //            showText="BUY day";
      //            if(dClose>dailyOpen) showTextAllowed="(LONG allowed)";
      //            else
      //            if(dClose<dPivot)
      //              {
      //               showText="BUY day"+" (REVERSE)";
      //               showTextAllowed="(SHORT allowed)";
      //              }
      //           }
      //         else
      //         //-- Open belove Pivot ---------------------------------
      //         if(dailyOpen<dPivot && dPivot<dPivotAvg)
      //           {
      //            showText="SELL day";
      //            if(dClose<dailyOpen) showTextAllowed="(SHORT allowed)";
      //            else
      //            if(dClose>dPivot)
      //              {
      //               showText="SELL day"+" (REVERSE)";
      //               showTextAllowed="(LONG allowed)";
      //              }
      //           }
      //         else
      //           {
      //            showText="OFF day";
      //           }
      //
      //         showText=empty+showText+"  "+showTextAllowed;
      //         ObjectSetText(objectNameDO,showText);
      //         ObjectSet(objectNameDO,OBJPROP_BACK,false);
      //        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//                *****************************************
//                *****************************************
//                            FUNCTIONS
//                *****************************************
//                *****************************************

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Delete_Objects(string sText)
  {
   int total = ObjectsTotal();
   for(int i = total-1; i>= 0; i--)
     {
      string sObjectName=ObjectName(i);
      if(StringFind(sObjectName,sText,0)!=-1)
         ObjectDelete(sObjectName);
     }
  }

//+------------------------------------------------------------------+
