USDX or DXY Indicator
What Is the U.S. Dollar Index (USDX) and How to Trade It
The U.S. dollar index (USDX) is a measure of the value of the U.S. dollar relative to a basket of foreign currencies. The USDX was established by the U.S. Federal Reserve in 1973 after the dissolution of the Bretton Woods Agreement. It is now maintained by ICE Data Indices, a subsidiary of the Intercontinental Exchange (ICE).
Understanding the U.S. Dollar Index (USDX)
The index is currently calculated by factoring in the exchange rates of six foreign currencies, which include the euro (EUR), Japanese yen (JPY), Canadian dollar (CAD), British pound (GBP), Swedish krona (SEK), and Swiss franc (CHF).
The euro is, by far, the largest component of the index, making up 57.6% of the basket. The weights of the rest of the currencies in the index are JPY (13.6%), GBP (11.9%), CAD (9.1%), SEK (4.2%), and CHF (3.6%)
More info:
https://www.investopedia.com/terms/u/usdx.asp
Indicator USDX shows the USD index in form of Japanese candlesticks.
https://www.mql5.com/en/code/20563
Calculations:
USDX = 50.14348112 × EURUSD-0.576 × USDJPY0.136 × GBPUSD-0.119 × USDCAD0.091 × USDSEK0.042 × USDCHF0.036
Original USDX Indicator:
My broker does not have the USD/SEK pair, so I removed it in the indicator code, this is wrong because the index cannot be calculated correctly, but if I do not have it in the broker, the indicator does not work. If your broker has the pair, you can use the original indicator.
Indicator without SEK:
USDX_Candle.ex5
USDX_Candle.mq5
I have modified the code to add suffixes automatically and if the USD/SEK pair does not exist, it recalculates the values without this pair automatically.
It also adds the pairs "EURUSD","USDJPY","GBPUSD","USDCAD","USDSEK","USDCHF" to MarketWatch automatically.
USDX_Candle_v2.ex5
USDX_Candle_v2.mq5
Great job! Thank you for sharing this.