//+------------------------------------------------------------------+
//|                                                TF Display v2.mq4 |
//|                              http://www.forexfactory.com/saronko |
//|                                                                  |
//+------------------------------------------------------------------+

#property copyright "Saronko"
#property version   "2.00"
#property link      "http://www.forexfactory.com/saronko"
#property description "Indicator display Current TimeFrame name"     
#property indicator_chart_window

//**************Strig init
extern string  Corner_Note             = "0 top left, 1 top right, 2 bottom left, 3 bottom right";
extern int     Corner_Position_Text    = 1;
extern int     X_Position_Text         = 1;
extern int     Y_Position_Text         = 1;
extern int     Font_Size_Text          = 12;
extern color   colortext               = Silver;
extern string  font                    = "Arial";//Lucida Console etc

//**************Define Object
#define CurrentChart    "CurrTF2"


//Custom indicator initialization function 

int start()

   {
//****** Create Object start   
       ObjectCreate   (CurrentChart, OBJ_LABEL, 0, 0, 0);
       ObjectSet      (CurrentChart, OBJPROP_CORNER, Corner_Position_Text);
       ObjectSet      (CurrentChart, OBJPROP_YDISTANCE, 1+Y_Position_Text); //UP DOWN
       ObjectSet      (CurrentChart, OBJPROP_XDISTANCE, 1+X_Position_Text);//Left Right
      if(Period() == PERIOD_M1) ObjectSetText(CurrentChart,"M1", Font_Size_Text, font);
      if(Period() == PERIOD_M5) ObjectSetText(CurrentChart,"M5", Font_Size_Text, font);
      if(Period() == PERIOD_M15) ObjectSetText(CurrentChart,"M15", Font_Size_Text, font);
      if(Period() == PERIOD_M30) ObjectSetText(CurrentChart,"M30", Font_Size_Text, font);
      if(Period() == PERIOD_H1) ObjectSetText(CurrentChart,"H1", Font_Size_Text, font);
      if(Period() == PERIOD_H4) ObjectSetText(CurrentChart,"H4", Font_Size_Text, font);
      if(Period() == PERIOD_D1) ObjectSetText(CurrentChart,"D1", Font_Size_Text, font);
      if(Period() == PERIOD_W1) ObjectSetText(CurrentChart,"W1", Font_Size_Text, font);
      if(Period() == PERIOD_MN1) ObjectSetText(CurrentChart,"MN", Font_Size_Text, font);
      ObjectSet(CurrentChart,OBJPROP_COLOR,colortext);
      
      
//****** Create Object end
   WindowRedraw();
   
return(0);
}
//--- INIT AND DEINIT ------------------------------------- //

int init()
{
  return(0); 
}
//--- Delete object
int deinit()
{
     
   ObjectDelete(CurrentChart);     
    
return(0);
}
//************************end of code