//+------------------------------------------------------------------+
//| Aiman-Account_Info.mq4 |
//| Copyright © 2010, Aiman |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, Aiman"
#property link "Aiman"
#property indicator_chart_window
#define id "Aiman-Account_Info_"
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
deinit();
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
int index = 100;
bool round = true;
while (round)
{
if (ObjectFind(id+DoubleToStr(index,0)) != -1)
{
ObjectDelete(id+DoubleToStr(index,0));
index++;
}
else round = false;
}
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
int x1,x2,y,index=101;
if (ObjectFind(id+"100") != -1)
{
x1 = ObjectGet(id+"100",OBJPROP_XDISTANCE)+5;
x2 = x1+85;
y = ObjectGet(id+"100",OBJPROP_YDISTANCE);
}
else
{
x1 =15; x2 =100; y =10;
drawLabel (id+"100","l",8,"Wingdings", Red, 0,x1-5,y);
}
color clrTitle = White;
color clrInfo = Yellow;
string fontStyle = "Arial";
int fontHeight = 8;
drawLabel (id+DoubleToStr(index,0), "Account Info", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "==========", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Account #", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": "+AccountNumber(), fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Account Name", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": "+AccountName(), fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Server", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": "+AccountServer(), fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Broker", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": "+AccountCompany(), fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Leverage", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": "+AccountLeverage()+":1", fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Currency", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": "+AccountCurrency(), fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Balance", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": $ "+DoubleToStr(AccountBalance(),2), fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Free Margin", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": $ "+DoubleToStr(AccountFreeMargin(),2), fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
y += (fontHeight*1.5);
//+------------------------------------------------------------------+
drawLabel (id+DoubleToStr(index,0), "Chart Info", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "========", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Symbol", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": "+Symbol(), fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Spread", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": "+DoubleToStr(MarketInfo(Symbol(),MODE_SPREAD),0)+" pips", fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Minimum Lot", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": "+DoubleToStr(MarketInfo(Symbol(),MODE_MINLOT),2)+" ($ "+
DoubleToStr(MarketInfo(Symbol(),MODE_MINLOT)*MarketInfo(Symbol(),MODE_TICKVALUE),2)
+"/pip)", fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Maximum Lot", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": "+DoubleToStr(MarketInfo(Symbol(),MODE_MAXLOT),2)+" ($ "+
DoubleToStr(MarketInfo(Symbol(),MODE_MAXLOT)*MarketInfo(Symbol(),MODE_TICKVALUE),2)
+"/pip)", fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Tick Value", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": $ "+DoubleToStr(MarketInfo(Symbol(),MODE_TICKVALUE),4)+" per 1 lot", fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
drawLabel (id+DoubleToStr(index,0), "Margin for 1 lot", fontHeight, fontStyle, clrTitle, 0, x1, y); index++;
drawLabel (id+DoubleToStr(index,0), ": $ "+DoubleToStr(MarketInfo(Symbol(),MODE_MARGINREQUIRED),2), fontHeight, fontStyle, clrInfo, 0, x2, y); index++;
y += (fontHeight*1.5);
//+------------------------------------------------------------------+
WindowRedraw();
return(0);
}
//+------------------------------------------------------------------+
void drawLabel (string name, string text, int height, string style, color clr, int cr, int xp, int yp)
{
ObjectCreate(name, OBJ_LABEL, 0, 0, 0);
ObjectSetText(name, text, height, style, clr);
ObjectSet(name, OBJPROP_CORNER, cr);
ObjectSet(name, OBJPROP_XDISTANCE, xp);
ObjectSet(name, OBJPROP_YDISTANCE, yp);
}