Price Data Components
0
Views
0
Downloads
0
Favorites
infoindi_new
//+------------------------------------------------------------------+
//| ProjectName |
//| Copyright 2012, CompanyName |
//| http://www.companyname.net |
//+------------------------------------------------------------------+
#property copyright "2014, AlexTrask Software Corp."
#property link "http://www.mql4.com"
#property description "Account Info Indicator"
#property strict
#property indicator_chart_window
//---
int Corner=2;
int X=7;
int Y=12;
//---
extern string Font="Arial";
extern color DescriptionColor=Lime;
extern color HeaderColor=Coral;
extern int Size=8;
extern color ClockColor=clrAqua;
extern int ClockCorner=3;
extern string ClockFont="Arial Bold Italic";
extern int FontSize=10;
int ClockX=5;
int ClockY=7;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int OnInit()
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
ObjectDelete("LH1");
ObjectDelete("LH2");
ObjectDelete("LH3");
ObjectDelete("LH4");
ObjectDelete("LZ1");
ObjectDelete("LZ2");
ObjectDelete("LZ3");
ObjectDelete("LZ4");
ObjectDelete("t");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
static int count=1;
static double sum=0;
static double maxspread = 0;
static double minspread = 30;
double currentspread=0;
string tt;
//---
currentspread=(Ask-Bid)/Point();
if(currentspread>maxspread)
maxspread=currentspread;
if(currentspread<minspread)
minspread=currentspread;
//---
sum+=currentspread;
double avrspread=sum/count;
count++;
//---
CreateClock();
TickTack();
//---
if(IsDemo())
tt="DEMO";
else
tt="REAL";
//---
if((Corner==1 || Corner==3) && X<1) X=1;
if(X<0) X=0;
//---
if(Corner>1 && Y<1) Y=1;
if(Y<0) Y=0;
//---
if(ObjectFind("LH1")==-1)
{
ObjectCreate("LH1",OBJ_LABEL,0,0,0);
ObjectSet("LH1",OBJPROP_CORNER,Corner);
ObjectSet("LH1",OBJPROP_XDISTANCE,X);
ObjectSet("LH1",OBJPROP_YDISTANCE,Y+5*Size);
}
//---
if(ObjectFind("LZ1")==-1)
{
ObjectCreate("LZ1",OBJ_LABEL,0,0,0);
ObjectSet("LZ1",OBJPROP_CORNER,Corner);
ObjectSet("LZ1",OBJPROP_XDISTANCE,X+47);
ObjectSet("LZ1",OBJPROP_YDISTANCE,Y+5*Size);
}
//---
if(ObjectFind("LH2")==-1)
{
ObjectCreate("LH2",OBJ_LABEL,0,0,0);
ObjectSet("LH2",OBJPROP_CORNER,Corner);
ObjectSet("LH2",OBJPROP_XDISTANCE,X);
ObjectSet("LH2",OBJPROP_YDISTANCE,Y+3*Size);
}
//---
if(ObjectFind("LZ2")==-1)
{
ObjectCreate("LZ2",OBJ_LABEL,0,0,0);
ObjectSet("LZ2",OBJPROP_CORNER,Corner);
ObjectSet("LZ2",OBJPROP_XDISTANCE,X+35);
ObjectSet("LZ2",OBJPROP_YDISTANCE,Y+3*Size);
}
//---
if(ObjectFind("LH3")==-1)
{
ObjectCreate("LH3",OBJ_LABEL,0,0,0);
ObjectSet("LH3",OBJPROP_CORNER,Corner);
ObjectSet("LH3",OBJPROP_XDISTANCE,X);
ObjectSet("LH3",OBJPROP_YDISTANCE,Y+1*Size);
}
//---
if(ObjectFind("LZ3")==-1)
{
ObjectCreate("LZ3",OBJ_LABEL,0,0,0);
ObjectSet("LZ3",OBJPROP_CORNER,Corner);
ObjectSet("LZ3",OBJPROP_XDISTANCE,X+35);
ObjectSet("LZ3",OBJPROP_YDISTANCE,Y+1*Size);
}
//---
if(ObjectFind("LH4")==-1)
{
ObjectCreate("LH4",OBJ_LABEL,0,0,0);
ObjectSet("LH4",OBJPROP_CORNER,Corner);
ObjectSet("LH4",OBJPROP_XDISTANCE,X);
ObjectSet("LH4",OBJPROP_YDISTANCE,Y-1*Size);
}
//---
if(ObjectFind("LZ4")==-1)
{
ObjectCreate("LZ4",OBJ_LABEL,0,0,0);
ObjectSet("LZ4",OBJPROP_CORNER,Corner);
ObjectSet("LZ4",OBJPROP_XDISTANCE,X+55);
ObjectSet("LZ4",OBJPROP_YDISTANCE,Y-1*Size);
}
//---
ObjectSetText("LH1","Òðåéäåð:",Size,Font,HeaderColor);
ObjectSetText("LH2","쑌֔:",Size,Font,HeaderColor);
ObjectSetText("LH3","Ñïðåä:",Size,Font,HeaderColor);
ObjectSetText("LH4","Ñâîáîäíî:",Size,Font,HeaderColor);
//---
ObjectSetText("LZ1","",Size,Font,HeaderColor);
ObjectSetText("LZ2","",Size,Font,HeaderColor);
ObjectSetText("LZ3","",Size,Font,HeaderColor);
ObjectSetText("LZ4","",Size,Font,HeaderColor);
//---
ObjectSetText("LZ1",AccountName()+" ("+tt+")",Size,Font,DescriptionColor);
ObjectSetText("LZ2","1/ "+DoubleToStr(AccountLeverage(),0),Size,Font,DescriptionColor);
ObjectSetText("LZ3","Òåêóùèé = "+DoubleToStr(currentspread,1)+", Ñðåäíèé = "+DoubleToStr(avrspread,1)+", "
"Ìèí/Ìàêñ = "+DoubleToStr(minspread,1)+"/"+DoubleToStr(maxspread,1),Size,Font,DescriptionColor);
ObjectSetText("LZ4",DoubleToStr(AccountFreeMargin(),2)+" USD "+
" ( Öåíà ïóíêòà çà 1 ëîò = "+DoubleToStr(MarketInfo(Symbol(),MODE_TICKVALUE),2)+" USD )",Size,Font,DescriptionColor);
//---
return(rates_total);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void CreateClock()
{
if(ObjectFind("t")==-1)
{
ObjectCreate("t",OBJ_LABEL,0,0,0);
ObjectSet("t",OBJPROP_COLOR,ClockColor);
if(ClockCorner==2)
ClockCorner=3;
ObjectSet("t",OBJPROP_CORNER,ClockCorner);
ObjectSet("t",OBJPROP_XDISTANCE,ClockX);
ObjectSet("t",OBJPROP_YDISTANCE,ClockY);
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void TickTack()
{
int m=int(60*Period() -(TimeCurrent()-Time[0]));
int s=m%60;
m=(m-s)/60;
ObjectSetText("t",IntegerToString(m)+"m:"+IntegerToString(s)+"s",FontSize,ClockFont,ClockColor);
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---