A_info
Download scriptThis script is a specialized dashboard tool designed for the MetaTrader 4 platform. Its primary purpose is to provide traders with a real-time, at-a-glance summary of key market metrics directly on their trading chart. Instead of requiring a trader to manually calculate various figures, this tool automatically extracts and displays essential data points regarding price action, volatility, and costs.
Key Functionalities
Dynamic Market Information The script automatically detects and displays the current trading symbol (e.g., EURUSD) and the timeframe you are currently viewing. This ensures that the information shown is always relevant to your active chart without requiring any manual input.
Daily Range and Price Action One of the primary metrics provided is the "High to Low" range for the current day. By showing the total distance between the highest and lowest prices reached so far, it helps traders understand the daily volatility and the overall "space" the market has covered.
Price Position Tracking The tool calculates your current position relative to the day's opening price ("Pips to Open").
- If the current price is above the opening price, the value is highlighted in Lime (Green).
- If the current price is below the opening price, it is highlighted in Red. This allows for immediate visual confirmation of whether the market is currently trending upwards or downwards relative to the start of the day.
Volatility Measurement The script incorporates an Average True Range (ATR) calculation based on a user-defined period (defaulting to 5 days). This provides a historical average of how much the price typically moves, helping traders gauge whether current market movements are normal or unusually aggressive.
Cost and Spread Monitoring To assist in managing trading costs, the tool calculates and displays the current "Spread" (the difference between the Buy and Sell prices) plus any customizable commission fees. This ensures that traders can see the exact cost of entering a trade in real-time.
Visual Design
The script is designed to be non-intrusive yet highly readable:
- Labels: It creates a structured layout on the corner of your chart with clear headers like "Spread," "Pips to Open," and "High to Low."
- Color Coding: It uses standard financial color coding (Red/Green) to signal market direction.
- Automatic Scaling: The script includes logic to automatically adjust the decimal places based on whether you are trading assets with 4 or 5 digits (like Forex pairs) or other types of instruments, ensuring the numbers always appear correctly regardless of the symbol.
//+------------------------------------------------------------------+
//| a_info.mq4 |
//| Copyright © 2010, Elmare |
//| http://elmare.webnode.ru |
//+------------------------------------------------------------------+
#property copyright "Elmare © 2010"
#property link "http://elmare.webnode.ru/"
#property indicator_chart_window
extern int ATR_Period=5;
extern double comission=0;
extern int shift=10;
extern bool symbol = true;
extern bool frame = true;
double pprice;
string sprice;
double hl;
string shl;
double pto;
string spto;
int k;
int d;
int fsize=11;
int pfsize=24;
color fcolor=Orange;
double da;
string sda;
string font="Microsoft Sans Serif";
string instr;
int per;
string sper;
string ssprd;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
instr=Symbol();
instr=StringSubstr(instr,0,6);
per=Period();
if (per<60){sper="M"+per;}
else if(per>=60&&per<60*24) {sper="H"+per/60+" ";}
else {sper="D"+per/(60*24);}
ObjectCreate("L",OBJ_LABEL,0,0,0);
ObjectSet("L",OBJPROP_CORNER,1);
ObjectSet("L",OBJPROP_XDISTANCE,3);
ObjectSet("L",OBJPROP_YDISTANCE,0+shift);
//======================================
if (symbol)
{
ObjectCreate("Instr",OBJ_LABEL,0,0,0);
ObjectSet("Instr",OBJPROP_CORNER,1);
ObjectSet("Instr",OBJPROP_XDISTANCE,62);
ObjectSet("Instr",OBJPROP_YDISTANCE,120+shift);
ObjectSetText("Instr",instr,12,font,DarkSlateGray);
}
if (frame)
{
ObjectCreate("Peri",OBJ_LABEL,0,0,0);
ObjectSet("Peri",OBJPROP_CORNER,1);
ObjectSet("Peri",OBJPROP_XDISTANCE,4);
ObjectSet("Peri",OBJPROP_YDISTANCE,120+shift);
ObjectSetText("Peri",sper,12,font,DarkSlateGray);
}
ObjectCreate("L1",OBJ_LABEL,0,0,0);
ObjectSet("L1",OBJPROP_CORNER,1);
ObjectSet("L1",OBJPROP_XDISTANCE,36);
ObjectSet("L1",OBJPROP_YDISTANCE,40+shift);
ObjectSetText("L1","High to Low :",fsize,font,fcolor);
ObjectCreate("L11",OBJ_LABEL,0,0,0);
ObjectSet("L11",OBJPROP_CORNER,1);
ObjectSet("L11",OBJPROP_XDISTANCE,5);
ObjectSet("L11",OBJPROP_YDISTANCE,40+shift);
//======================================
ObjectCreate("L2",OBJ_LABEL,0,0,0);
ObjectSet("L2",OBJPROP_CORNER,1);
ObjectSet("L2",OBJPROP_XDISTANCE,36);
ObjectSet("L2",OBJPROP_YDISTANCE,60+shift);
ObjectSetText("L2","Pips to Open:",fsize,font,fcolor);
ObjectCreate("L22",OBJ_LABEL,0,0,0);
ObjectSet("L22",OBJPROP_CORNER,1);
ObjectSet("L22",OBJPROP_XDISTANCE,5);
ObjectSet("L22",OBJPROP_YDISTANCE,60+shift);
//======================================
ObjectCreate("L3",OBJ_LABEL,0,0,0);
ObjectSet("L3",OBJPROP_CORNER,1);
ObjectSet("L3",OBJPROP_XDISTANCE,36);
ObjectSet("L3",OBJPROP_YDISTANCE,80+shift);
//ObjectSetText("L3","Day Average:",fsize,font,fcolor);
ObjectCreate("L33",OBJ_LABEL,0,0,0);
ObjectSet("L33",OBJPROP_CORNER,1);
ObjectSet("L33",OBJPROP_XDISTANCE,5);
ObjectSet("L33",OBJPROP_YDISTANCE,80+shift);
//=======================================
ObjectCreate("L4",OBJ_LABEL,0,0,0);
ObjectSet("L4",OBJPROP_CORNER,1);
ObjectSet("L4",OBJPROP_XDISTANCE,36);
ObjectSet("L4",OBJPROP_YDISTANCE,100+shift);
ObjectSetText("L4","Spread :",fsize,font,fcolor);
ObjectCreate("L44",OBJ_LABEL,0,0,0);
ObjectSet("L44",OBJPROP_CORNER,1);
ObjectSet("L44",OBJPROP_XDISTANCE,5);
ObjectSet("L44",OBJPROP_YDISTANCE,100+shift);
if(Digits==5){k=10000;d=5;}
else if(Digits==4){k=10000;d=4;}
else if(Digits==3){k=100;d=3;}
else if(Digits==2){k=10;d=2;}
else {k=100;d=2;}
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("L");
ObjectDelete("L1");
ObjectDelete("L11");
ObjectDelete("L2");
ObjectDelete("L22");
ObjectDelete("L3");
ObjectDelete("L33");
ObjectDelete("L4");
ObjectDelete("L44");
ObjectDelete("Instr");
ObjectDelete("Peri");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
sprice=DoubleToStr(Bid,d-1);
hl=iHigh(0,PERIOD_D1,0)-iLow(0,PERIOD_D1,0);
hl*=k;
shl=DoubleToStr(hl,0);
pto=(Bid-iOpen(0,PERIOD_D1,0))*k;
spto=DoubleToStr(pto,0);
da=iATR(0,PERIOD_D1,ATR_Period,1);
da*=k;
sda=DoubleToStr(da,0);
//ssprd=DoubleToStr(deduct(Ask,Bid)*k+comission,1);
ssprd=DoubleToStr((Ask-Bid)*k+comission,1);
//===================================
if (pprice>Bid)
{
ObjectSetText("L",sprice,pfsize,"Digifacewide",Red);
pprice=Bid;
}
if (pprice<Bid)
{
ObjectSetText("L",sprice,pfsize,"Digifacewide",Lime);
pprice=Bid;
}
//======================================
ObjectSetText("L11",shl,fsize,font,LightGray);
//=====================================================
if (pto<=0){ObjectSetText("L22",spto,fsize,font,Red);}
if (pto>0){ObjectSetText("L22",spto,fsize,font,Lime);}
//======================================
ObjectSetText("L33",sda,fsize,font,LightGray);
ObjectSetText("L3",ATR_Period+" Days Avrg :",fsize,font,fcolor);
ObjectSetText("L44",ssprd,fsize,font,LightGray);
return(0);
}
//+------------------------------------------------------------------+
Comments