Currency Index Indicator for MetaTrader 4
In this post, we describe the purpose, composition, parity, calculation logic and construction of a Currency Index for each of the 8 major currencies.
- EUR – Euro
- USD – US Dollar
- GBP – British Pound
- JPY – Japanese Yen
- AUD – Australian Dollar
- NZD – New Zealand Dollar
- CHF – Swiss Franc
- CAD – Canadian Dollar
MQL4 source code is also provided to enable traders to load and use the indicator on the MetaTrader 4 platform.
What is a Currency Index?
A currency index measures the evolution or strength in one major currency relative to a basket of the other major currencies.
With a single currency pair, e.g. GBP/JPY, an uptrend would symbolize a strengthening of the British Pound vs the Japanese Yen, information based on only those two currencies, and vice versa.
Therefore, by monitoring just the GBP/JPY, a trader knows how the GBP is behaving vs the JPY, but not how the GBP and JPY currencies are behaving independently.
With a currency index however, an uptrend in the British Pound (GBP) would indicate a strengthening of the British Pound relative to the entire basket of seven other major currencies.
i.e. EUR, USD, JPY, CAD, AUD, NZD, and CHF.
Similarly, in the case of a downtrend, it would indicate a weakening of the GBP relative to the entire basket of seven other major currencies.
Basket Composition & Parity
Each currency index is calculated relative to a basket of currency pairs, chosen such that each pair:
- Contains the concerned currency in either the Base or Quote component,
- The pairs combined include all 8 major currencies,
- Where the concerned currency is the Quote component of a pair, the parity of the pair needs to be reversed. e.g. when calculating the GBP currency index, EUR/GBP needs a parity of -1, making it -EUR/GBP to adjust for relative GBP strength.
For example, the basket of currency pairs to calculate the EUR currency index is:
It contains the concerned currency (EUR), and the other major currencies, i.e. USD, GBP, JPY, AUD, NZD, CHF, CAD. As each currency pair has EUR as the Base component, the parity of each pair in this basket is +1.
The remaining currency indexes therefore, have the following composition and parities:
USD: -EUR/USD, -GBP/USD, -AUD/USD, -NZD/USD, USD/JPY, USD/CHF, USD/CAD,
GBP: -EUR/GBP, GBP/USD, GBP/AUD, GBP/NZD, GBP/JPY, GBP/CHF, GBP/CAD,
JPY: -EUR/JPY, -USD/JPY, -AUD/JPY, -NZD/JPY, -GBP/JPY, -CHF/JPY, -CAD/JPY,
AUD: -EUR/AUD, AUD/USD, AUD/JPY, AUD/NZD, -GBP/AUD, AUD/CHF, AUD/CAD,
NZD: -EUR/NZD, NZD/USD, -AUD/NZD, NZD/JPY, -GBP/NZD, NZD/CHF, NZD/CAD,
CHF: -EUR/CHF, -NZD/CHF, -AUD/CHF, CHF/JPY, -GBP/CHF, -USD/CHF, -CAD/CHF,
CAD: -EUR/CAD, -USD/CAD, -AUD/CAD, -NZD/CAD, -GBP/CAD, CAD/CHF, CAD/JPY
Unlike the common standard of using a weighted portfolio of currencies in baskets to reflect each currency’s relative importance by economic factors, this implementation uses an equally weighted portfolio to remove that bias.
Calculation Logic & Construction
Each currency index \(I_x\), at time t, where rates_total time periods are available for processing, can be mathematically represented as follows:
The contribution of each currency pair in an index’s basket is calculated as above, indexed to base 100.00 from the chosen start date.
The MQL4 indicator source code provided allows the user to set a start date for calculating the first point in the currency index therefore starting at 100.00. The default start date is January 01, 2015.
MQL4 Indicator (Source Code)
We have uploaded a functional MetaTrader 4 Indicator to our GitHub page under tools -> MQL4.
First, simply Right-Click and Save-As on the following links to save the files to your computer, and follow the instructions below them:
- Launch MetaTrader 4, and open your data folder (File -> Open Data Folder)
- Copy the “DLabs_CurrencyIndex.mqh” into your MQL4\Include directory,
- Copy the “DLabs_CurrencyIndex.mq4” into your MQL4\Indicators directory,
- Restart MetaTrader 4 and open a new chart,
- Double-click on DLabs_CurrencyIndex under Indicators to load the indicator on any chart.
The indicator takes two inputs:
- Currency Index to draw (e.g. EUR, GBP, etc)
- Start date to base the index calculation.
Click OK, and the indicator will draw the selected currency index in its own dedicated window, as shown below:
Important Note: In order for the indicator to draw correctly and accurately, users must ensure that their History Center contains data for all currency pairs in an index’s basket.
[Additional Resources] Constructing Currency Portfolio Indexes in MetaTrader 4
Do you have what it takes? – Join the Darwinex Trader Movement!