Author: SemSemFX@rambler.ru
Complex'

This script is designed as a multi-currency analysis tool for the MetaTrader platform. Rather than focusing on a single pair of currencies, it calculates the relative strength and movement dynamics of six major global currencies—USD, EUR, GBP, CHF, JPY, and CAD—simultaneously.

Core Functionality

The logic operates by analyzing "Moving Averages," which are smoothed price trends. The script looks at these trends across multiple currency pairs to determine how each specific currency is performing against all its major counterparts.

Instead of simply showing you the price of a currency, it calculates a cumulative "score" for each one based on its performance against others:

  • USD (United States Dollar): Tracks how the dollar is moving against the Euro, Pound, Franc, Yen, and Canadian Dollar.
  • EUR (Euro): Measures the Euro's strength relative to the Dollar, Pound, Franc, Yen, and Canadian Dollar.
  • GBP (British Pound): Evaluates the Pound against the Dollar, Euro, Franc, Yen, and Canadian Dollar.
  • CHF (Swiss Franc): Analyzes the Franc in relation to the Dollar, Euro, Pound, Yen, and Canadian Dollar.
  • JPY (Japanese Yen): Tracks the Yen's movement against the Dollar, Euro, Pound, Franc, and Canadian Dollar.
  • CAD (Canadian Dollar): Monitors the Canadian Dollar relative to the Dollar, Euro, Franc, Yen, and British Pound.

How it Works Visually

The script produces six separate lines on a dedicated window within your trading platform. Each line corresponds to one of the major currencies:

  1. Green Line: USD
  2. Navy Line: EUR
  3. Red Line: GBP
  4. Black Line: CHF
  5. Maroon Line: JPY
  6. Silver Line: CAD

Practical Application

By observing these lines, a trader can identify which currencies are currently gaining momentum and which are losing it across the entire market.

The logic uses a "difference" calculation—comparing the current moving average to a previous point in time (defined by the user's settings). By totaling these differences for each currency, the script provides a birds-eye view of the market. If one line is trending sharply upward while others are flat or downward, it suggests that specific currency is currently dominating the market, while others may be weakening.

This allows you to see the "big picture" of global currency flow in a single glance, rather than having to monitor dozens of individual charts separately.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
Complex'
//+------------------------------------------------------------------+
//|                                                      Complex.mq4 |
//|                                              SemSemFX@rambler.ru |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "SemSemFX@rambler.ru"
#property link      ""

#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
//---- buffers
double USD[];
double EUR[];
double GBP[];
double CHF[];
double JPY[];
double CAD[];
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");
   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");  
//----
   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>0) 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
            ;
         //double Summa=USD[i]+EUR[i]+GBP[i]+CHF[i]+JPY[i];
         //Print("Summa: ",Summa);
       }
  //----
    return(0);
  }
//+------------------------------------------------------------------+

Comments