#property copyright "Lowphat © 2006"
#property link      "mystikvgv@yahoo.com (mail only)"

#property indicator_separate_window

extern string MoneyManagementSetting = "==MoneyManagementSettings==";
extern double Risk = 10.0;
double Gd_92;
double Gd_100;
double s1[];
int G_spread_108;
int Gi_unused_112;
int Gi_unused_116;
int G_leverage_120;
int G_timebar_124;
int G_timebar_128;
double PointCost() {
   double Ld_ret_0;
   double Ld_8 = MarketInfo(Symbol(), MODE_LOTSIZE) * MarketInfo(Symbol(), MODE_POINT);
   string Ls_16 = StringSubstr(Symbol(), 3, 3);
   string symbol_24 = "USD" + Ls_16;
   string symbol_32 = Ls_16 + "USD";
   if (Ls_16 == "USD") Ld_ret_0 = Ld_8;
   else {
      if (MarketInfo(symbol_24, MODE_BID) != 0.0) Ld_ret_0 = Ld_8 * (1 / MarketInfo(symbol_24, MODE_BID));
      else Ld_ret_0 = Ld_8 * MarketInfo(symbol_32, MODE_ASK);
   }
   return (Ld_ret_0);
}

int init() {
   IndicatorShortName("Stat Monitor (" + Symbol() + ")");
   return (0);
}

int deinit() {
   return (0);
}

int start() {

//Time to bar expiry
  int m,s;

  m=Time[0]+Period()*60-CurTime();
  s=m%60;
  m=(m-s)/60;
  string _m="",_s="";

   G_spread_108 = MarketInfo(Symbol(), MODE_SPREAD);
   Gi_unused_112 = MarketInfo(Symbol(), MODE_TICKVALUE);
   Gd_92 = NormalizeDouble(MarketInfo(Symbol(), MODE_SWAPLONG), 2);
   Gd_100 = NormalizeDouble(MarketInfo(Symbol(), MODE_SWAPSHORT), 2);
   Gi_unused_116 = Volume[0];
   G_leverage_120 = AccountLeverage();
   G_timebar_124 = DoubleToStr(m,0);
   G_timebar_128 = DoubleToStr(s,0);
   ObjectCreate("Stat Monitor1", OBJ_LABEL, WindowFind("Stat Monitor (" + Symbol() + ")"), 0, 0);
   ObjectSetText("Stat Monitor1", "Spread      : ", 9, "Arial Bold", CadetBlue);
   ObjectSet("Stat Monitor1", OBJPROP_CORNER, 0);
   ObjectSet("Stat Monitor1", OBJPROP_XDISTANCE, 1196);
   ObjectSet("Stat Monitor1", OBJPROP_YDISTANCE, 20);
   ObjectCreate("Stat Monitor2", OBJ_LABEL, WindowFind("Stat Monitor (" + Symbol() + ")"), 0, 0);
   ObjectSetText("Stat Monitor2", DoubleToStr(G_spread_108, 0), 9, "Arial Bold", Lime);
   ObjectSet("Stat Monitor2", OBJPROP_CORNER, 0);
   ObjectSet("Stat Monitor2", OBJPROP_XDISTANCE, 1280);
   ObjectSet("Stat Monitor2", OBJPROP_YDISTANCE, 20);
   ObjectCreate("Stat Monitor3", OBJ_LABEL, WindowFind("Stat Monitor (" + Symbol() + ")"), 0, 0);
   ObjectSetText("Stat Monitor3", "Pips/0.1Lot : ", 9, "Arial Bold", CadetBlue);
   ObjectSet("Stat Monitor3", OBJPROP_CORNER, 0);
   ObjectSet("Stat Monitor3", OBJPROP_XDISTANCE, 1190);
   ObjectSet("Stat Monitor3", OBJPROP_YDISTANCE, 40);
   ObjectCreate("Stat Monitor4", OBJ_LABEL, WindowFind("Stat Monitor (" + Symbol() + ")"), 0, 0);
   ObjectSetText("Stat Monitor4", DoubleToStr(PointCost(), 2) + " USD", 9, "Arial Bold", Lime);
   ObjectSet("Stat Monitor4", OBJPROP_CORNER, 0);
   ObjectSet("Stat Monitor4", OBJPROP_XDISTANCE, 1264);
   ObjectSet("Stat Monitor4", OBJPROP_YDISTANCE, 40);
   ObjectCreate("Stat Monitor5", OBJ_LABEL, WindowFind("Stat Monitor (" + Symbol() + ")"), 0, 0);
   ObjectSetText("Stat Monitor5", "Buy Swap : ", 9, "Arial Bold", CadetBlue);
   ObjectSet("Stat Monitor5", OBJPROP_CORNER, 0);
   ObjectSet("Stat Monitor5", OBJPROP_XDISTANCE, 1196);
   ObjectSet("Stat Monitor5", OBJPROP_YDISTANCE, 60);
   ObjectCreate("Stat Monitor6", OBJ_LABEL, WindowFind("Stat Monitor (" + Symbol() + ")"), 0, 0);
   if (Gd_92 > 0.0) ObjectSetText("Stat Monitor6", DoubleToStr(Gd_92, 2), 9, "Arial Bold", Lime);
   else ObjectSetText("Stat Monitor6", DoubleToStr(Gd_92, 2), 9, "Arial Bold", Red);
   ObjectSet("Stat Monitor6", OBJPROP_CORNER, 0);
   ObjectSet("Stat Monitor6", OBJPROP_XDISTANCE, 1280);
   ObjectSet("Stat Monitor6", OBJPROP_YDISTANCE, 60);
   ObjectCreate("Stat Monitor7", OBJ_LABEL, WindowFind("Stat Monitor (" + Symbol() + ")"), 0, 0);
   ObjectSetText("Stat Monitor7", "Sell Swap : ", 9, "Arial Bold", CadetBlue);
   ObjectSet("Stat Monitor7", OBJPROP_CORNER, 0);
   ObjectSet("Stat Monitor7", OBJPROP_XDISTANCE, 1196);
   ObjectSet("Stat Monitor7", OBJPROP_YDISTANCE, 80);
   ObjectCreate("Stat Monitor8", OBJ_LABEL, WindowFind("Stat Monitor (" + Symbol() + ")"), 0, 0);
   if (Gd_100 > 0.0) ObjectSetText("Stat Monitor8", DoubleToStr(Gd_100, 2), 9, "Arial Bold", Lime);
   else ObjectSetText("Stat Monitor8", DoubleToStr(Gd_100, 2), 9, "Arial Bold", Red);
   ObjectSet("Stat Monitor8", OBJPROP_CORNER, 0);
   ObjectSet("Stat Monitor8", OBJPROP_XDISTANCE, 1280);
   ObjectSet("Stat Monitor8", OBJPROP_YDISTANCE, 80);
   ObjectCreate("Stat Monitor9", OBJ_LABEL, WindowFind("Stat Monitor (" + Symbol() + ")"), 0, 0);
   ObjectSetText("Stat Monitor9", "Leverage  :  ", 9, "Arial Bold", CadetBlue);
   ObjectSet("Stat Monitor9", OBJPROP_CORNER, 0);
   ObjectSet("Stat Monitor9", OBJPROP_XDISTANCE, 1196);
   ObjectSet("Stat Monitor9", OBJPROP_YDISTANCE, 100);
   ObjectCreate("Stat Monitor10", OBJ_LABEL, WindowFind("Stat Monitor (" + Symbol() + ")"), 0, 0);
   ObjectSetText("Stat Monitor10", " 1 : ", 9, "Arial Bold", Lime);
   ObjectSet("Stat Monitor10", OBJPROP_CORNER, 0);
   ObjectSet("Stat Monitor10", OBJPROP_XDISTANCE, 1260);
   ObjectSet("Stat Monitor10", OBJPROP_YDISTANCE, 100);
   ObjectCreate("Stat Monitor11", OBJ_LABEL, WindowFind("Stat Monitor (" + Symbol() + ")"), 0, 0);
   ObjectSetText("Stat Monitor11",   DoubleToStr(G_leverage_120, 0), 9, "Arial Bold", Lime);
   ObjectSet("Stat Monitor11", OBJPROP_CORNER, 0);
   ObjectSet("Stat Monitor11", OBJPROP_XDISTANCE, 1280);
   ObjectSet("Stat Monitor11", OBJPROP_YDISTANCE, 100);
   
   if (G_timebar_124>0.0)
   ObjectCreate("Stat Monitor13", OBJ_LABEL, WindowFind("Stat Monitor (" + Symbol() + ")"), 0, 0);
   ObjectSetText("Stat Monitor13", "Next Bar in :"+_m+G_timebar_124+" : "+_s+G_timebar_128, 9, "Arial Bold", Red);//
   ObjectSet("Stat Monitor13", OBJPROP_CORNER, 0);
   ObjectSet("Stat Monitor13", OBJPROP_XDISTANCE, 1167);
   ObjectSet("Stat Monitor13", OBJPROP_YDISTANCE, 120);
   

   return (0);
}
