Author: Copyright � 2007, MetaQuotes Software Corp.
X5

This script functions as a multi-currency analytical tool designed to track the relative strength and momentum of major global currencies. Instead of looking at a single pair (like EUR/USD) in isolation, it aggregates data from several different currency pairings to create a comprehensive "strength profile" for seven specific currencies: USD, EUR, GBP, CHF, JPY, CAD, and AUD.

Core Methodology

The logic operates by calculating the mathematical difference between moving averages across multiple currency pairs simultaneously. It uses two primary settings to define its perspective:

  • Period (per1): Determines the length of the moving average used to smooth out price fluctuations.
  • Distance (D): Sets a specific "look-back" gap to measure how much the price has shifted over a short interval.

How the Calculations Work

For every currency, the script looks at every other major currency it trades against. It calculates whether that currency is gaining or losing value relative to its peers.

For example:

  • To determine the strength of the USD, the script analyzes its performance against the Euro, Pound, Swiss Franc, Yen, and Canadian Dollar.
  • It performs these calculations for all seven currencies, effectively creating a "weighted score" for each.
  • The results are then scaled (multiplied) to ensure that different types of currencies (like those with different decimal points, such as JPY vs. EUR) are compared on an equal footing.

Visual Output

The tool plots seven distinct lines on a separate window in your trading platform. Each line represents one of the major currencies:

  • USD: Green
  • EUR: Navy
  • GBP: Red
  • CHF: Black
  • JPY: Maroon
  • CAD: Silver
  • AUD: Aqua

Practical Application for Traders

By observing these lines, a user can identify which currencies are currently dominating the market and which are weakening. If one currency's line is trending upward while others are falling, it indicates that specific currency is gaining strength relative to the rest of the global market. This provides a "big picture" view of market dynamics that is difficult to see by looking at individual charts alone.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
6 Views
0 Downloads
0 Favorites
X5
//+------------------------------------------------------------------+
//|                                                         tola.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 Green
#property indicator_color2 Navy
#property indicator_color3 Red
#property indicator_color4 Black
#property indicator_color5 Maroon
#property indicator_color6 Silver 
#property indicator_color7 Aqua
//---- b
double USD[];
double EUR[];
double GBP[];
double CHF[];
double JPY[];
double CAD[];
double AUD[];
extern int per1=14;
extern int D=3;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorShortName("USD:Green; EUR:Blue; GBP:Red; CHF:Black; JPY:Brown; CAD:Silver ; AUD:Aqua;");
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,USD);
   SetIndexLabel(0, "USD"); 
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,EUR);
   SetIndexLabel(1, "EUR"); 
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,GBP);
   SetIndexLabel(2, "GBP"); 
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,CHF);
   SetIndexLabel(3, "CHF"); 
   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4,JPY);
   SetIndexLabel(4, "JPY");
   SetIndexStyle(5,DRAW_LINE);
   SetIndexBuffer(5,CAD);
   SetIndexLabel(5, "CAD");  
   SetIndexStyle(6,DRAW_LINE); 
   SetIndexBuffer(6,AUD);
   SetIndexLabel(6, "AUD");
   //----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
     int limit;
     int counted_bars=IndicatorCounted();
  //---- ïðîâåðêà íà âîçìîæíûå îøèáêè
     if(counted_bars<0) return(-1);
  //---- ïîñëåäíèé ïîñ÷èòàííûé áàð áóäåò ïåðåñ÷èòàí
     if(counted_bars>10) counted_bars-=10;
     limit=Bars-counted_bars;
  //---- îñíîâíîé öèêë
      int Price=6;
      int Mode=3;
      //int per1=13;
      //int per2=5;
     for(int i=0; i<limit; i++)
       {
        USD[i]=
            (iMA("EURUSD",0,per1,0,Mode,Price,i+D)-
            iMA("EURUSD",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("GBPUSD",0,per1,0,Mode,Price,i+D)-
            iMA("GBPUSD",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("USDCHF",0,per1,0,Mode,Price,i)-
            iMA("USDCHF",0,per1,0,Mode,Price,i+D))*10000
            +
            (iMA("USDJPY",0,per1,0,Mode,Price,i)-
            iMA("USDJPY",0,per1,0,Mode,Price,i+D))*100
            +
            (iMA("USDCAD",0,per1,0,Mode,Price,i)-
            iMA("USDCAD",0,per1,0,Mode,Price,i+D))*10000
            ;
        EUR[i]=
            (iMA("EURUSD",0,per1,0,Mode,Price,i)-
            iMA("EURUSD",0,per1,0,Mode,Price,i+D))*10000
            +
            (iMA("EURGBP",0,per1,0,Mode,Price,i)-
            iMA("EURGBP",0,per1,0,Mode,Price,i+D))*10000
            +
            (iMA("EURCHF",0,per1,0,Mode,Price,i)-
            iMA("EURCHF",0,per1,0,Mode,Price,i+D))*10000
            +
            (iMA("EURJPY",0,per1,0,Mode,Price,i)-
            iMA("EURJPY",0,per1,0,Mode,Price,i+D))*100
            +
            (iMA("EURCAD",0,per1,0,Mode,Price,i)-
            iMA("EURCAD",0,per1,0,Mode,Price,i+D))*10000
            ;
        GBP[i]=
            (iMA("GBPUSD",0,per1,0,Mode,Price,i)-
            iMA("GBPUSD",0,per1,0,Mode,Price,i+D))*10000
            +
            (iMA("EURGBP",0,per1,0,Mode,Price,i+D)-
            iMA("EURGBP",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("GBPCHF",0,per1,0,Mode,Price,i)-
            iMA("GBPCHF",0,per1,0,Mode,Price,i+D))*10000
            +
            (iMA("GBPJPY",0,per1,0,Mode,Price,i)-
            iMA("GBPJPY",0,per1,0,Mode,Price,i+D))*100
            +
            (iMA("GBPCAD",0,per1,0,Mode,Price,i)-
            iMA("GBPCAD",0,per1,0,Mode,Price,i+D))*10000
            ;
        CHF[i]=
            (iMA("USDCHF",0,per1,0,Mode,Price,i+D)-
            iMA("USDCHF",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("EURCHF",0,per1,0,Mode,Price,i+D)-
            iMA("EURCHF",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("GBPCHF",0,per1,0,Mode,Price,i+D)-
            iMA("GBPCHF",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("CHFJPY",0,per1,0,Mode,Price,i)-
            iMA("CHFJPY",0,per1,0,Mode,Price,i+D))*100
            +
            (iMA("CADCHF",0,per1,0,Mode,Price,i)-
            iMA("CADCHF",0,per1,0,Mode,Price,i+D))*10000
            ;
        JPY[i]=
            (iMA("USDJPY",0,per1,0,Mode,Price,i+D)-
            iMA("USDJPY",0,per1,0,Mode,Price,i))*100
            +
            (iMA("EURJPY",0,per1,0,Mode,Price,i+D)-
            iMA("EURJPY",0,per1,0,Mode,Price,i))*100
            +
            (iMA("GBPJPY",0,per1,0,Mode,Price,i+D)-
            iMA("GBPJPY",0,per1,0,Mode,Price,i))*100
            +
            (iMA("CHFJPY",0,per1,0,Mode,Price,i+D)-
            iMA("CHFJPY",0,per1,0,Mode,Price,i))*100
            +
            (iMA("CADJPY",0,per1,0,Mode,Price,i)-
            iMA("CADJPY",0,per1,0,Mode,Price,i+D))*100
            ;
         CAD[i]=
            (iMA("USDCAD",0,per1,0,Mode,Price,i)-
            iMA("USDCAD",0,per1,0,Mode,Price,i+D))*10000
            +
            (iMA("EURCAD",0,per1,0,Mode,Price,i+D)-
            iMA("EURCAD",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("CADCHF",0,per1,0,Mode,Price,i)-
            iMA("CADCHF",0,per1,0,Mode,Price,i+D))*10000
            +
            (iMA("CADJPY",0,per1,0,Mode,Price,i)-
            iMA("CADJPY",0,per1,0,Mode,Price,i+D))*100
            +
            (iMA("GBPCAD",0,per1,0,Mode,Price,i)-
            iMA("GBPCAD",0,per1,0,Mode,Price,i+D))*10000
              ;
        AUD[i]=
            (iMA("AUDUSD",0,per1,0,Mode,Price,i)-
            iMA("AUDUSD",0,per1,0,Mode,Price,i+D))*10000
            +
            (iMA("EURAUD",0,per1,0,Mode,Price,i+D)-
            iMA("EURAUD",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("AUDNZD",0,per1,0,Mode,Price,i)-
            iMA("AUDNZD",0,per1,0,Mode,Price,i+D))*10000
            +
            (iMA("AUDJPY",0,per1,0,Mode,Price,i)-
            iMA("AUDJPY",0,per1,0,Mode,Price,i+D))*100
            +
            (iMA("AUDCAD",0,per1,0,Mode,Price,i)-
            iMA("AUDCAD",0,per1,0,Mode,Price,i+D))*10000
            ;
        //double Summa=USD[i]+EUR[i]+GBP[i]+CHF[i]+JPY[i];
         //Print("Summa: ",Summa);
       }
  //----
    return(0);
  }
//+------------------------------------------------------------------+

Comments