Dollar Index Indicator For MT5
Table Of Contents:
- Dollar Index Indicator For MT5
- Installing the Dollar Index Indicator For MT5
- Parameters of the Dollar Index Indicator For MT5
- Buffers of the Dollar Index Indicator For MT5
- Main Parts Of The Code
The Dollar Index Indicator For MT5 calculates the index which is also called the USDX, DXY and DX. It is calculated based on a weighted value of different forexpairs. These forexpairs are: EURUSD, USDJPY, GBPUSD, USDCAD, USDSEK and USDCHF
Installing the 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 Dollar index.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 Dollar Index Indicator For MT5
The Dollar Index Indicator For MT5 has 3 parameters to configure.
input int inpBarsToCalculate = 500; // Bars to calculate input string inpSymbolsPrefix = ""; // Symbols prefix input string inpSymbolsSuffix = ""; // Symbols suffix
Buffers of the Dollar Index Indicator For MT5
The Dollar Index Indicator For MT5 provides 2 buffers.
SetIndexBuffer(0,ic); SetIndexBuffer(1,icolor,INDICATOR_COLOR_INDEX);
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 _bars = (int)MathMax(inpBarsToCalculate,ChartGetInteger(0,CHART_VISIBLE_BARS)); int i=(int)MathMax(prev_calculated-_bars+1,0); for (; i lt rates_total && !_StopFlag; i++) { if (i lt rates_total-_bars) { ic[i] = EMPTY_VALUE; icolor[i] = 0; continue; } double dxyClose = 50.14348112; for (int k=0; k lt 6; k++) { MqlRates _rates[]; int _ratesCopied = CopyRates(symbols[k],0,time[i],1,_rates); if (_ratesCopied == 1) dxyClose *= MathPow(_rates[0].close,pows[k]); } ic[i] = dxyClose; icolor[i] = (i gt 0) ? (ic[i] gt ic[i-1]) ? 1 : (ic[i] lt ic[i-1]) ? 2 : 0 : 0; } return(rates_total); }