//+------------------------------------------------------------------+
//|                                                 Mn HideTimes.mq4 |
//+------------------------------------------------------------------+
#property copyright "Mn"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Black
#property indicator_color2 Black
#property indicator_width1 5
#property indicator_width2 5

extern color mChartBckCol = Black;
extern int mShowBarsOpenTime = 8, mShowBarsCloseTime = 22;

double mHbuff[];
double mLbuff[];

int mBars = 0;

//|------------------------------------------------------------------|
int init()
  {
   SetIndexStyle(0, DRAW_HISTOGRAM, 0, 5, mChartBckCol);
   SetIndexBuffer(0, mHbuff);
   SetIndexStyle(1, DRAW_HISTOGRAM, 0, 5, mChartBckCol);
   SetIndexBuffer(1, mLbuff);

   SetIndexBuffer(0, mHbuff);
   SetIndexBuffer(1, mLbuff);

   return(0);
  }

//+------------------------------------------------------------------+
int deinit()
  {

   return(0);
  }

//+------------------------------------------------------------------+
int start()
  {
   double mHi, mLo;

   mBars = IndicatorCounted();

   if (mBars > 0)
    mBars--;
   int mPos = Bars - mBars - 1;
   while(mPos >= 0)
     {
      if(TimeHour(Time[mPos]) < mShowBarsOpenTime || TimeHour(Time[mPos]) > mShowBarsCloseTime)
       {
        mHi = High[mPos];
        mLo = Low[mPos];
        mHbuff[mPos] = mHi;
        mLbuff[mPos] = mLo;
       }

 	   mPos--;
     }

   return(0);
  }
//+------------------------------------------------------------------+