Skip to content Skip to footer

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.
These include:

  1. EUR – Euro
  2. USD – US Dollar
  3. GBP – British Pound
  4. JPY – Japanese Yen
  5. AUD – Australian Dollar
  6. NZD – New Zealand Dollar
  7. CHF – Swiss Franc
  8. 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:

  1. Contains the concerned currency in either the Base or Quote component,
  2. The pairs combined include all 8 major currencies,
  3. 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:

  1. EUR/USD,
  2. EUR/GBP,
  3. EUR/AUD,
  4. EUR/NZD,
  5. EUR/JPY,
  6. EUR/CHF,
  7. EUR/CAD

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 [latex]I_x[/latex], at time t, where rates_total time periods are available for processing, can be mathematically represented.
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:
Click here to download DLabs_CurrencyIndex.mqh
Click here to download DLabs_CurrencyIndex.mq4
Instructions:

  1. Launch MetaTrader 4, and open your data folder (File -> Open Data Folder)
  2. Copy the “DLabs_CurrencyIndex.mqh” into your MQL4\Include directory,
  3. Copy the “DLabs_CurrencyIndex.mq4” into your MQL4\Indicators directory,
  4. Restart MetaTrader 4 and open a new chart,
  5. Double-click on DLabs_CurrencyIndex under Indicators to load the indicator on any chart.

The indicator takes two inputs:

  1. Currency Index to draw (e.g. EUR, GBP, etc)
  2. 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!

36 Comments

  • Alberto Cardenas
    Posted October 20, 2017 at 10:58 pm

    Hi, great work guys. Do you have some manual of proceed to instal the file saved in GitHub to MT4. Thanks in advance

    • Post Author
      The Market Bull
      Posted October 20, 2017 at 11:45 pm

      Hi Alberto! Great to hear your found the post useful. Thank you for raising this query, we have just updated the blog post with additional instructions on downloading files from GitHub and installing in MetaTrader 4. Hope this helps.

  • eric
    Posted October 24, 2017 at 11:20 am

    the indicator seem not working, am i the only one? hmmmm.

    • Post Author
      The Market Bull
      Posted October 24, 2017 at 12:13 pm

      Hi Eric, no worries – kindly elaborate further on what you’re experiencing and we’ll help you get it working 🙂

      • eric
        Posted October 24, 2017 at 2:50 pm

        i copy to my indicator folder, and restart my mt4, but cant find/see any indicator name as per downloaded at the custom. but it is exist in the folder, how?

        • Post Author
          The Market Bull
          Posted October 24, 2017 at 3:36 pm

          Hi Eric,
          Please try the following steps:
          1) From the file menu in MetaTrader 4, click on “Open Data Folder”,
          2) Open the “MQL4” folder you see here,
          3) Copy the file ending in “.mqh” into the “Include” folder,
          4) Copy the file ending in “.mq4” into the “Indicators” folder you see here,
          5) Now close and restart MetaTrader 4.
          Also, kindly forward any further questions to info@darwinex.com as we can help you much faster through there 🙂
          Hope this helps!

  • jim
    Posted October 25, 2017 at 8:21 am

    Hi, Can I ask how to interrupt the reading given in the indicator please? i.e. is a number above 100.00 a show of strength for currency? Thanks

    • Post Author
      The Market Bull
      Posted October 25, 2017 at 11:36 am

      Hi Jim,
      The reading indicates the rise or decline of the index since your start date. For example, if the reading on a particular day is 101.00 and your start date is 2017-01-01, it implies that the index has strengthened by 1.0% since your start date.
      Hope this helps!

  • Krzysiek
    Posted October 28, 2017 at 8:25 pm

    Hi guys. Thanks for your great job. I already use it:)

  • Chris
    Posted November 17, 2017 at 3:46 pm

    Tried again, after 4 times it worked. Dont know whtas going on. Sorry for the “virus” mail, but today you must be cautious…. Thank you for your work!

    • Post Author
      The Market Bull
      Posted November 20, 2017 at 8:21 pm

      Hi Chris,
      Glad to hear you got it working 🙂
      No worries, Anti-Virus software can sometimes flag unrecognized file extensions (.mql is a non-standard extension so could have set it off accidentally). All Indicator code is published in text format on GitHub for this very reason, so users are able to safely download/copy and compile the code in MT4 themselves, no virus threats possible as a result :thumbsup:

      • Chris
        Posted December 3, 2017 at 3:13 pm

        This is a great indi! Thank you for your work!
        Is it possible to display the indi on chart? For example GBP index-GBPUSD overlay (no extra window)??? That would be great to compare behaviour. Or overlay the price of the pair in the indi window would do the same job.
        greetings
        C

        • Post Author
          The Market Bull
          Posted December 4, 2017 at 1:20 pm

          Hi Chris, glad you’re finding the Indicator useful! Yes, you can add this Indicator to any pair’s chart as it works independently. You simply need to select the currency in the indicator’s options to display the required index on the chart it’s been added to.

          • Chris
            Posted December 6, 2017 at 11:44 am

            Yes I know that, but its in an extra indicator window. Is it possible to overlay the indi in the price window?

          • Post Author
            The Market Bull
            Posted December 8, 2017 at 12:54 am

            Hi Chris,
            Technically it’s possible to overlay any indicator as a function of price and time on a given chart, yes.
            However, in this currency index indicator’s case, we opted for a dedicated window as overlaying a line composed of multiple currency pair returns (with its own base of 100) would prove less intuitive to users when comparing their chart contents (a single currency pair of one price range) to a currency index (of a different price range).
            We will of course keep your suggestion on file and research ways to present overlaid indexes intuitively.
            As always, thank you for your interest and feedback!

  • rimantas venckus
    Posted January 31, 2018 at 8:51 pm

    Can you make to show 7 currencies at once ?

    • Post Author
      The Market Bull
      Posted February 5, 2018 at 4:17 pm

      Hi Rimantas,
      Great suggestion! 🙂
      This is indeed possible – however, we’ll first need to assess how MetaTrader handles multiple indexes plotted in the same indicator window (performance-wise).
      If our tests look good, we’ll consider publishing an update to the source code – thank you for raising this!

  • Chris
    Posted April 20, 2018 at 1:28 pm

    Hey darwinex team,
    thank you for your great work! Can you please help me to plot the line of the Dlabs_CurrencyIndex as a ZigZag???
    Greetings big fan
    Chris

  • gersom
    Posted January 7, 2019 at 9:42 pm

    creo que este indicador sería útil para mi operativa pero he hecho lo posible y no he podido hacerle funcionar en mi mt4

    • Post Author
      The Market Owl
      Posted January 8, 2019 at 5:31 pm

      Hola gersom,
      Por favor, escríbenos a info@darwinex.com y nuestros compañeros te podrán ayudar a hacerlo funcionar. Cualquier información que puedas proporcionar como capturas de pantalla del Journal/Registro y de la sección Experts/Expertos de tu Terminal de trading será de mucha utilidad.

  • Marc
    Posted January 21, 2019 at 7:16 pm

    Hi GUys, Your DLabs_CurrencyIndex.mq4 indicator is flagging up a few issues when compiling. Any chance someone could have a look at it please?

    • Post Author
      The Market Bull
      Posted January 23, 2019 at 2:37 pm

      Hi Marc,
      Thank you for letting us know.
      Could you please create an Issue via the following link, providing the following information:
      1) MetaTrader 4 Experts log containing the errors you’ve mentioned
      2) MetaTrader 4 Journal log (same as above)
      3) A more detailed description of the events that lead to your experience.
      As soon as we have this information, we’ll investigate and get back to you with feedback as soon as possible, directly on GitHub.
      Create an Issue here:
      https://github.com/darwinex/DarwinexLabs/issues

      • Marc
        Posted February 1, 2019 at 10:31 am

        Many thanks for the response….i got it working….User error :-/

  • tony
    Posted March 17, 2019 at 12:52 am

    This indicator is perfect Thanks. Works great no problem

  • Ferdinand Odeligbo
    Posted November 27, 2019 at 1:15 pm

    I am having problems with the “DLabs_CurrencyIndex.mq4”. Followed the download instructions but indicator window does not open to launch the indicator on a new chart. Please I need your help to resolve this issue ASAP.

  • Ferdinand Odeligbo
    Posted November 27, 2019 at 3:26 pm

    Hi, I read through the reply of a couple of posts her and was able to successfully download your currency index indicator. Great indicator for precise entry. Better than watching the spaghetti indicators out there. Many thanks for your pioneering ideas.

  • mohsern
    Posted November 27, 2019 at 7:35 pm

    hi. The dlabs indicator is not installed on my MetaTrader 4. Is it possible to analyze the currency index with this indicator and find the strength of trading and trading?

  • Miguel López
    Posted April 8, 2020 at 12:42 am

    Un saludo a todos ! Aún funciona este indicador? El código fuente lo copio y lo pego en el editor mq4, pero me presenta errores y honestamente no se como corregirlos.

  • Drew
    Posted March 17, 2021 at 4:50 am

    Market bull – right click and save didn’t work so I cop[ied to note book for mqh file. when I copied the mql contents to metaeditor it indicated – line 82, weights and N aren’t declared.. what shall I do?
    thx
    Drew

  • Nate T
    Posted March 19, 2021 at 5:45 pm

    You guys are a godsend. Your index indicator is absolutely phenomenal! I can not trade without it! I have one question, does it recalculate or repaint? I notice past data seems to fluctuate. Other than that, what a wonderful indicator. It’s what I’ve been looking for a long time.

  • Henry
    Posted October 23, 2021 at 8:50 am

    Hi, I tried to complied, but error message. “weights” and “N” undeclared identifier.

  • Octapad
    Posted February 6, 2022 at 2:27 am

    This is great but is it possible to use it as an overlay instead of in an indicator window?

  • lorenzo Sostre
    Posted April 17, 2023 at 9:55 pm

    is there any updated version of this? I just tried installing both files but the indicator isn’t opening up at all on my chart. thanks!

Leave a comment

logo-footer

The Darwinex® brand and the http://www.darwinex.com domain are commercial names used by Tradeslide Trading Tech Limited, a company regulated by the Financial Conduct Authority (FCA) in the United Kingdom with FRN 586466, with company registration number 08061368 and registered office in Acre House, 11-15 William Road, London NW1 3ER, UK. and by Sapiens Markets EU Sociedad de Valores SA, a company regulated by the Comisión Nacional del Mercado de Valores (CNMV) in Spain under the number 311, with CIF A10537348 and registered office in Calle de Recoletos, 19, Bajo, 28001 Madrid, Spain.

CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. 58% of retail investor accounts lose money when trading CFDs with this provider. You should consider whether you understand how CFDs work and whether you can afford to take the high risk of losing your money.