//+------------------------------------------------------------------+
 
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
#property indicator_chart_window

extern bool Corner_of_Chart_RIGHT_TOP = true;
extern bool Show_Price = true;
extern bool Show_Xtra_Details = true;
extern bool Show_Smaller_Size = false;
extern int Shift_UP_DN =0; 
extern int Adjust_Side_to_side  = 20;
extern color BarLabel_color = LightBlue;
extern color CommentLabel_color = LightBlue;


//****************************************



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectsDeleteAll(0,OBJ_LABEL); 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {    
   //***********************************************************************************************************************

   int    counted_bars=IndicatorCounted();
   
 string  MFI_StrH1 = "",  MFI_StrM15 = "",  MFI_StrM5 = "",  MFI_StrM1 = "",  MFI_StrH4 ="",  MFI_StrM30= "",  MFI_StrD1= "",  MFI_StrW1= "";
   
 color  color_signal,color_M1,color_M5,color_M15,color_M30,color_M60,color_M240,color_M1440;
     
    
   //*************************************************************************************************************** 
  
   //*****************************************************************************************************
   //Info
   
    string PRC1;
   double Price1 = iMA(Symbol(),0,1,0,MODE_EMA,PRICE_CLOSE,0);   
    PRC1 = DoubleToStr(Price1,Digits);
    

   string HI="",LO="",SPREAD="",PIPS="",DAV="",HILO="",PRC,Pips="",Av="",AV_Yest="";
   color color_pip,color_av;
   double OPEN = iOpen(NULL,1440,0);
   double CLOSE = iClose(NULL,1440,0);
   double SPRD = (Ask - Bid)/Point;
   double High_Today = iHigh(NULL,1440,0);
   double Low_Today = iLow(NULL,1440,0);
   PIPS =  DoubleToStr((CLOSE-OPEN)/Point,0);
   SPREAD = (DoubleToStr(SPRD,Digits-4));

   AV_Yest =  (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/Point;
   
   HILO = DoubleToStr((High_Today-Low_Today)/Point,0);
        
    if (Show_Smaller_Size  == false)
    {  
      
    if (Show_Price  == true)
    {      
           ObjectCreate("Signalprice", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("Signalprice",""+PRC1+"", 20, "Arial",  Orange);
   ObjectSet("Signalprice", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("Signalprice", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("Signalprice", OBJPROP_YDISTANCE, 66+Shift_UP_DN); 
   }}
          
    if (Show_Smaller_Size  == true)
    {  
     if (Show_Price  == true)
    {     
           ObjectCreate("Signalprice", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("Signalprice",""+PRC1+"", 10, "Arial",  Orange);
   ObjectSet("Signalprice", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("Signalprice", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("Signalprice", OBJPROP_YDISTANCE, 66+Shift_UP_DN);  
   }}
   int R1=0,R5=0,R10=0,R20=0,RAvg=0,i=0;
   R1 =  (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/Point;
   for(i=1;i<=5;i++)
      R5    =    R5  +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;
   for(i=1;i<=10;i++)
      R10   =    R10 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;
   for(i=1;i<=20;i++)
      R20   =    R20 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;

   R5 = R5/5;
   R10 = R10/10;
   R20 = R20/20;
   RAvg  =  (R1+R5+R10+R20)/4;    
   
   DAV = (DoubleToStr(RAvg,Digits-4));
     
     if (CLOSE >= OPEN) {Pips= "-";color_pip = Lime; }
     if (CLOSE < OPEN) {Pips= "-";color_pip = OrangeRed; }
      if (DAV > AV_Yest) {Av= "-";color_av = Lime; }
     if (DAV < AV_Yest) {Av= "-";color_av = OrangeRed; }
     
        
    if (Show_Smaller_Size  == false)
    {     
    if (Show_Xtra_Details == true)
    {
     if (Show_Price  == true)
    {  
    
                ObjectCreate("MMLEVELS7", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS7","Spread", 10, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS7", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS7", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS7", OBJPROP_YDISTANCE, 100+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS8", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS8",""+SPREAD+"", 10, "Arial Bold", White);
   ObjectSet("MMLEVELS8", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS8", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS8", OBJPROP_YDISTANCE, 100+Shift_UP_DN);  
   
     
                ObjectCreate("MMLEVELS9", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS9","Pips to Open", 10, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS9", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS9", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS9", OBJPROP_YDISTANCE, 115+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS10", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS10",""+PIPS+"", 10, "Arial Bold", color_pip);
   ObjectSet("MMLEVELS10", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS10", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS10", OBJPROP_YDISTANCE, 115+Shift_UP_DN);  
      
                ObjectCreate("MMLEVELS11", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS11","Hi to Low", 10, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS11", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS11", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS11", OBJPROP_YDISTANCE, 130+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS12", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS12",""+HILO+"", 10, "Arial Bold", White);
   ObjectSet("MMLEVELS12", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS12", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS12", OBJPROP_YDISTANCE, 130+Shift_UP_DN);  
   
                 ObjectCreate("MMLEVELS13", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS13","Daily Av", 10, "Arial",CommentLabel_color);
   ObjectSet("MMLEVELS13", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS13", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS13", OBJPROP_YDISTANCE, 145+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS14", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS14",""+DAV+"", 10, "Arial Bold", color_av);
   ObjectSet("MMLEVELS14", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS14", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS14", OBJPROP_YDISTANCE, 145+Shift_UP_DN); 
 }}}
 //*****************************************************************
 //Shift if price not wanted
  if (Show_Smaller_Size  == false)
    {     
    if (Show_Xtra_Details == true)
    {
     if (Show_Price  == false)
    {  
    
                ObjectCreate("MMLEVELS7", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS7","Spread", 10, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS7", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS7", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS7", OBJPROP_YDISTANCE, 60+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS8", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS8",""+SPREAD+"", 10, "Arial Bold", White);
   ObjectSet("MMLEVELS8", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS8", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS8", OBJPROP_YDISTANCE, 60+Shift_UP_DN);  
   
     
                ObjectCreate("MMLEVELS9", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS9","Pips to Open", 10, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS9", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS9", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS9", OBJPROP_YDISTANCE, 75+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS10", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS10",""+PIPS+"", 10, "Arial Bold", color_pip);
   ObjectSet("MMLEVELS10", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS10", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS10", OBJPROP_YDISTANCE, 75+Shift_UP_DN);  
      
                ObjectCreate("MMLEVELS11", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS11","Hi to Low", 10, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS11", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS11", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS11", OBJPROP_YDISTANCE, 90+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS12", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS12",""+HILO+"", 10, "Arial Bold", White);
   ObjectSet("MMLEVELS12", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS12", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS12", OBJPROP_YDISTANCE, 90+Shift_UP_DN);  
   
                 ObjectCreate("MMLEVELS13", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS13","Daily Av", 10, "Arial",CommentLabel_color);
   ObjectSet("MMLEVELS13", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS13", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS13", OBJPROP_YDISTANCE, 105+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS14", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS14",""+DAV+"", 10, "Arial Bold", color_av);
   ObjectSet("MMLEVELS14", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS14", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS14", OBJPROP_YDISTANCE, 105+Shift_UP_DN); 
 }}}
 
  //***********************************************************************
  //Smaller type option     
    if (Show_Smaller_Size  == true)
    {     
    if (Show_Xtra_Details == true)
    {
     if (Show_Price  == true)
    {  
    
                ObjectCreate("MMLEVELS7", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS7","Spread", 8, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS7", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS7", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS7", OBJPROP_YDISTANCE, 80+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS8", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS8",""+SPREAD+"", 8, "Arial Bold", White);
   ObjectSet("MMLEVELS8", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS8", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS8", OBJPROP_YDISTANCE, 80+Shift_UP_DN);  
   
     
                ObjectCreate("MMLEVELS9", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS9","Pips to Open", 8, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS9", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS9", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS9", OBJPROP_YDISTANCE, 95+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS10", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS10",""+PIPS+"", 8, "Arial Bold", color_pip);
   ObjectSet("MMLEVELS10", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS10", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS10", OBJPROP_YDISTANCE, 95+Shift_UP_DN);  
      
                ObjectCreate("MMLEVELS11", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS11","Hi to Low", 8, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS11", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS11", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS11", OBJPROP_YDISTANCE, 110+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS12", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS12",""+HILO+"", 8, "Arial Bold", White);
   ObjectSet("MMLEVELS12", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS12", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS12", OBJPROP_YDISTANCE, 110+Shift_UP_DN);  
   
                 ObjectCreate("MMLEVELS13", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS13","Daily Av", 8, "Arial",CommentLabel_color);
   ObjectSet("MMLEVELS13", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS13", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS13", OBJPROP_YDISTANCE, 125+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS14", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS14",""+DAV+"", 8, "Arial Bold", color_av);
   ObjectSet("MMLEVELS14", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS14", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS14", OBJPROP_YDISTANCE, 125+Shift_UP_DN); 
 }}}
 
 //****************************************************************
 // Shift if Price not needed
  if (Show_Smaller_Size  == true)
    {     
    if (Show_Xtra_Details == true)
    {
     if (Show_Price  == false)
     
    { 
                ObjectCreate("MMLEVELS7", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS7","Spread", 8, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS7", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS7", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS7", OBJPROP_YDISTANCE, 60+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS8", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS8",""+SPREAD+"", 8, "Arial Bold", White);
   ObjectSet("MMLEVELS8", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS8", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS8", OBJPROP_YDISTANCE, 60+Shift_UP_DN);  
   
     
                ObjectCreate("MMLEVELS9", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS9","Pips to Open", 8, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS9", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS9", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS9", OBJPROP_YDISTANCE, 75+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS10", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS10",""+PIPS+"", 8, "Arial Bold", color_pip);
   ObjectSet("MMLEVELS10", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS10", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS10", OBJPROP_YDISTANCE, 75+Shift_UP_DN);  
      
                ObjectCreate("MMLEVELS11", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS11","Hi to Low", 8, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS11", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS11", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS11", OBJPROP_YDISTANCE, 90+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS12", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS12",""+HILO+"", 8, "Arial Bold", White);
   ObjectSet("MMLEVELS12", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS12", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS12", OBJPROP_YDISTANCE, 90+Shift_UP_DN);  
   
                 ObjectCreate("MMLEVELS13", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS13","Daily Av", 8, "Arial",CommentLabel_color);
   ObjectSet("MMLEVELS13", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS13", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS13", OBJPROP_YDISTANCE, 105+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS14", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS14",""+DAV+"", 8, "Arial Bold", color_av);
   ObjectSet("MMLEVELS14", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS14", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS14", OBJPROP_YDISTANCE, 105+Shift_UP_DN); 
 }}}
 //----
   return(0);
  }
//+------------------------------------------------------------------+