//+------------------------------------------------------------------+
//|                                                SHI_MFzone.mq4    |
//|                                         Copyright © 2005, Shurka |
//|                                                 shforex@narod.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Shurka"
#property link      "shforex@narod.ru"
#property indicator_chart_window
//#property indicator_buffers 2
extern double HighLevel=1.21;
extern double LowLevel=1.2;
extern bool Painting=True;
extern bool Fon=True;

extern color BackColor=Wheat; //цвет закрашивания канала
extern color LinesColor=DarkGray;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   ObjectCreate("MFChan",OBJ_RECTANGLE,0,Time[1],HighLevel,Time[0],LowLevel);
   ObjectSet("MFChan",OBJPROP_COLOR,BackColor);
   if(Fon) ObjectSet("MFChan",OBJPROP_BACK,true);
   else ObjectSet("MFChan",OBJPROP_BACK,false);
   ObjectCreate("MFhiLine",OBJ_TREND,0,Time[1],HighLevel,Time[0]+Period()*60*7,HighLevel);
   ObjectCreate("MFloLine",OBJ_TREND,0,Time[1],LowLevel,Time[0]+Period()*60*7,LowLevel);
   ObjectSet("MFhiLine",OBJPROP_RAY,False);
   ObjectSet("MFloLine",OBJPROP_RAY,False);
   ObjectSet("MFhiLine",OBJPROP_COLOR,LinesColor);
   ObjectSet("MFloLine",OBJPROP_COLOR,LinesColor);
   ObjectCreate("MFtext",OBJ_TEXT,0,Time[0]+Period()*60*7,HighLevel);
   ObjectSetText("MFtext", "MF-zone", 8, "Arial", Blue);
   ObjectCreate("MFtextL",OBJ_TEXT,0,Time[0]+Period()*60*7,LowLevel+Point*6);
   ObjectSetText("MFtextL", "MF-zone", 8, "Arial", Blue);
   return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
   ObjectDelete("MFChan"); ObjectDelete("MFbar"); ObjectDelete("MFhiLine");
   ObjectDelete("MFloLine"); ObjectDelete("MFtext"); ObjectDelete("MFtextL");
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   if (Period()>PERIOD_D1) return;
   for(int i=0;TimeDayOfWeek(Time[i])!=1 || TimeDayOfWeek(Time[i+1])!=5;i++) continue;
   ObjectSet("MFhiLine",OBJPROP_TIME1,Time[i]);
   ObjectSet("MFloLine",OBJPROP_TIME1,Time[i]);
   
   if(Painting==True) ObjectSet("MFChan",OBJPROP_TIME1,Time[i]);
   else ObjectDelete("MFChan");
   return(0);
}
//+------------------------------------------------------------------+