USDx dollar index Indicator For MT5
The USDx dollar index Indicator For MT5 might be one of the most useful tools for the fulltime traders. The U.S dollar index which measures the overall value of the green buck’s strength against the major asset lets you know which asset is getting stronger. After installing the indicator, you will notice the US dollar index curve trading inside a channel. If the curve hits the bottom part of the channel, you can expect a recovery in the price of the U.S dollar index. This means the U.S dollar will gain strength against most of its major rivals. When it hits the channel resistance, you can expect a weaker dollar in the global market. Learn to use this tool in a practice account so that you don’t have to lose a big sum of money.
Installing the USDx dollar index Indicator For MT5
After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file usdx.mq5 into the folder MQL5\Indicators of your MT5 installation. After that please restart MT5 and then you will be able to see the indicator in the list of indicators.
Parameters of the USDx dollar index Indicator For MT5
The USDx dollar index Indicator For MT5 has 1 parameters to configure.
input int MaxBar=1000;//Number of bars for calculation
Buffers of the USDx dollar index Indicator For MT5
The USDx dollar index Indicator For MT5 provides 7 buffers.
SetIndexBuffer(0,USDx,INDICATOR_DATA);
SetIndexBuffer(1,mEURUSD,INDICATOR_CALCULATIONS);
SetIndexBuffer(2,mUSDJPY,INDICATOR_CALCULATIONS);
SetIndexBuffer(3,mGBPUSD,INDICATOR_CALCULATIONS);
SetIndexBuffer(4,mUSDCAD,INDICATOR_CALCULATIONS);
SetIndexBuffer(5,mUSDSEK,INDICATOR_CALCULATIONS);
SetIndexBuffer(6,mUSDCHF,INDICATOR_CALCULATIONS);
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[])
{
//---
if(rates_total!=prev_calculated)
{
if(CopyClose("EURUSD",PERIOD_CURRENT,0,MaxBar,mEURUSD) lt =0 ||
CopyClose("USDJPY",PERIOD_CURRENT,0,MaxBar,mUSDJPY) lt =0 ||
CopyClose("GBPUSD",PERIOD_CURRENT,0,MaxBar,mGBPUSD) lt =0 ||
CopyClose("USDCAD",PERIOD_CURRENT,0,MaxBar,mUSDCAD) lt =0 ||
CopyClose("USDSEK",PERIOD_CURRENT,0,MaxBar,mUSDSEK) lt =0 ||
CopyClose("USDCHF",PERIOD_CURRENT,0,MaxBar,mUSDCHF) lt =0 )
{
return(0);
}
}
int i;
for(i=prev_calculated;i lt rates_total;i++)
{
sEURUSD =MathPow(mEURUSD[i],-0.576);
sUSDJPY =MathPow(mUSDJPY[i],0.136);
sGBPUSD =MathPow(mGBPUSD[i],-0.119);
sUSDCAD =MathPow(mUSDCAD[i],0.091);
sUSDSEK =MathPow(mUSDSEK[i],0.042);
sUSDCHF =MathPow(mUSDCHF[i],0.036);
USDx[i]=50.14348112 *sEURUSD*sUSDJPY*sGBPUSD *sUSDCAD*sUSDSEK*sUSDCHF;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//| TradeTransaction function |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction &trans,
const MqlTradeRequest &request,
const MqlTradeResult &result)
{
//---
}
//+------------------------------------------------------------------+