ShowImportantParams Indicator For MT4
The ShowImportantParams Indicator For MT4 shows you the current spread and smooth spread. You don’t have to worry about the dynamic spread even during the volatility. Based on your lot size, it can also calculate the margin required based on the real spread and market condition. If you can follow this important parameter, you can expect to find the best possible trades.
Installing the ShowImportantParams Indicator For MT4
After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file ShowImportantParams.mq4 into the folder MQL4\Indicators of your MT4 installation. After that please restart MT4 and then you will be able to see the indicator in the list of indicators.
Parameters of the ShowImportantParams Indicator For MT4
The ShowImportantParams Indicator For MT4 has 6 parameters to configure.
input int FontSize = 10;
input color FontColor = clrYellow;
input string FontName = "Tahoma";
input int XOffset = 10;
input int YOffset = 15;
input int SpreadSmoothTicks = 20;
Buffers of the ShowImportantParams Indicator For MT4
The ShowImportantParams Indicator For MT4 provides 0 buffers.
Main Parts Of The Code
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[])
{
int size=ArraySize(SpreadBuf);
SpreadBuf[SpreadBufIdx++]=Ask-Bid;
if(SpreadBufIdx gt = SpreadSmoothTicks)
SpreadBufIdx = 0;
double sprd=0;
for(int n = 0; n lt SpreadSmoothTicks; n++)
sprd += SpreadBuf[n];
sprd/=(double)SpreadSmoothTicks;
ResetLastError();
double price4lot;
Quote2Price(sprd,price4lot,Symbol());
ObjectSetString(0,"SIP_"+lNames[0],OBJPROP_TEXT,lNames[0]+DoubleToString(MarketInfo(Symbol(),MODE_MARGINREQUIRED),2));
ObjectSetString(0,"SIP_"+lNames[1],OBJPROP_TEXT,lNames[1]+IntegerToString(AccountLeverage()));
ObjectSetString(0,"SIP_"+lNames[2],OBJPROP_TEXT,lNames[2]+DoubleToString(sprd,_Digits) + ", RealSpread=" + DoubleToString(Ask - Bid,_Digits));
ObjectSetString(0,"SIP_"+lNames[3],OBJPROP_TEXT,lNames[3]+DoubleToString(price4lot,2));
ObjectSetString(0,"SIP_"+lNames[4],OBJPROP_TEXT,lNames[4]+DoubleToString(MarketInfo(Symbol(),MODE_STOPLEVEL),0));
ENUM_ACCOUNT_STOPOUT_MODE stop_out_mode=(ENUM_ACCOUNT_STOPOUT_MODE)AccountInfoInteger(ACCOUNT_MARGIN_SO_MODE);
string s=(stop_out_mode==ACCOUNT_STOPOUT_MODE_PERCENT)?" %":"";
ObjectSetString(0,"SIP_"+lNames[5],OBJPROP_TEXT,lNames[5]+DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN_SO_SO),0)+s);
ObjectSetString(0,"SIP_"+lNames[6],OBJPROP_TEXT,lNames[6]+DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN_SO_CALL),0)+s);
return(rates_total);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
bool Quote2Price(double diff,double &price4lot,string symbol="EURUSD")
{
int dig=(int)MarketInfo(symbol,MODE_DIGITS);
if(dig == 0)
return(false); // symbol is none
double tickSize = MarketInfo(symbol, MODE_TICKSIZE); // ïóíêò â âàëþòå êîòèðîâêè (0,00001 äëÿ EURUSD íà 5-çíàêå)
double tickValue = MarketInfo(symbol, MODE_TICKVALUE); // ïóíêò â âàëþòå äåïîçèòà ($1 äëÿ EURUSD íà 5-çíàêå)
double price=diff/(tickSize/tickValue);
price4lot=NormalizeDouble(price,2);
return (true);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
bool CreateLabel(string name,int x,int y=10)
{
if(!ObjectCreate(0,name,OBJ_LABEL,0,0,0))
return false;;
ObjectSetInteger(0,name,OBJPROP_ANCHOR,ANCHOR_LEFT_LOWER);
ObjectSetInteger(0,name,OBJPROP_CORNER,CORNER_LEFT_LOWER);
ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x);
ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y);
ObjectSetInteger(0,name,OBJPROP_FONTSIZE,FontSize);
ObjectSetInteger(0,name,OBJPROP_COLOR,FontColor);
ObjectSetInteger(0,name,OBJPROP_SELECTABLE,true);
ObjectSetString(0,name,OBJPROP_FONT,FontName);
ChartRedraw();
return true;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnTimer()
{
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)
{
}
//+------------------------------------------------------------------+