#property copyright "Stephen Ambatoding"
#property link      ""
#property indicator_chart_window

extern string MonthlyTrend = "Up";
extern string WeeklyTrend  = "Down";
extern string DailyTrend   = "Sideways";
extern string MonthlyPA    = "BEOB";
extern string WeeklyPA     = "Pin Up";
extern string DailyPA      = "N/A";
extern double Support      = 1.4356;
extern double Resistance   = 1.4856;

extern int    XDistanceFromRightCorner   = 120;
extern int    SpaceForValue              = 60;
extern int    VerticalSpace              = 10;
extern string FontName                   = "Arial";
extern int    FontSize                   = 8;
extern color  FontColorPrefix            = Silver;
extern color  FontColorValue             = White;

int init()
  {
   string ObjName,ObjNameVal;
   string RowPrefix[3] = {"Monthly","Weekly","Daily"};
   string ColPrefix1[2] = {"Trend","PA"};
   string ColPrefix2[2] = {"Support","Resistance"};
   string temp;
   int ColPrefix,
       ColValue;
   
   int VerticalDistance = 1;
   for(int row = 0; row<4; row++) {
     for(int col = 0; col<2; col++) {
       ObjName = "TFA_"+row+col;
       ObjNameVal = ObjName+"val";
       ObjectCreate (ObjName,OBJ_LABEL,0,0,0);
       ObjectSet(ObjName,OBJPROP_CORNER,1);
       
       ObjectCreate (ObjNameVal,OBJ_LABEL,0,0,0);
       ObjectSet(ObjNameVal,OBJPROP_CORNER,1);       
       
       if(row<3) temp = RowPrefix[row]+" "+ColPrefix1[col];
       else      temp = ColPrefix2[col];
              
       ObjectSet(ObjName,OBJPROP_XDISTANCE,(col^1)*XDistanceFromRightCorner+SpaceForValue+1); 
       ObjectSet(ObjNameVal,OBJPROP_XDISTANCE,(col^1)*XDistanceFromRightCorner+1); 
       ObjectSet(ObjName,OBJPROP_YDISTANCE,VerticalDistance);       
       ObjectSet(ObjNameVal,OBJPROP_YDISTANCE,VerticalDistance);
       ObjectSetText(ObjName,temp,FontSize,FontName,CLR_NONE);
       
       if(row==0 && col==0)      temp = MonthlyTrend;
       else if(row==0 && col==1) temp = MonthlyPA;
       else if(row==1 && col==0) temp = WeeklyTrend;
       else if(row==1 && col==1) temp = WeeklyPA;
       else if(row==2 && col==0) temp = DailyTrend;
       else if(row==2 && col==1) temp = DailyPA;
       else if(row==3 && col==0) temp = DoubleToStr(Support,Digits);
       else if(row==3 && col==1) temp = DoubleToStr(Resistance,Digits);
       ObjectSetText(ObjNameVal,temp,FontSize,FontName,CLR_NONE);
     }
     VerticalDistance += VerticalSpace;
   }

   int ObjTotal = ObjectsTotal();
   for(int i = ObjTotal-1; i>=0; i--) {
     ObjName = ObjectName(i);
     if(StringFind(ObjName,"TFA",0)>=0) {
       if(StringFind(ObjName,"val",0)>=0) ObjectSet(ObjName,OBJPROP_COLOR,FontColorValue);
       else                               ObjectSet(ObjName,OBJPROP_COLOR,FontColorPrefix);
     }
   }   
   return(0);
  }

int deinit()
  {
   int ObjTotal = ObjectsTotal();
   for(int i = ObjTotal-1; i>=0; i--) {
     if(StringFind(ObjectName(i),"TFA",0)>=0)
       ObjectDelete(ObjectName(i));
   }
   return(0);
  }

int start()
  {
   return(0);
  }
//+------------------------------------------------------------------+