Author: SemSemFX@rambler.ru
Complex

This script is a specialized multi-currency analysis tool designed to track the relative strength of major global currencies (USD, EUR, GBP, CHF, and JPY) simultaneously. Instead of looking at just one pair at a time, it synthesizes data from multiple currency interactions to provide a broader perspective on market momentum.

Core Functionality

The logic operates by calculating the "spread" between two different moving averages for various currency pairs. By subtracting a short-term moving average from a long-term moving average (or vice versa), the tool measures the velocity and direction of price movement.

How it Works

  1. Multi-Pair Synthesis: For each individual currency (like the USD or EUR), the script looks at several different trading pairs simultaneously. For example, to determine the strength of the USD, it evaluates how the USD is performing against the Euro, the Pound, and the Yen across different markets.
  2. Weighted Calculation: The script applies specific mathematical multipliers to these differences. This ensures that the results are scaled correctly across different types of currency pairs (e.g., balancing the weights between standard major pairs and those involving the Japanese Yen).
  3. Comparative Strength Tracking: By aggregating these various price movements into a single value for each currency, the indicator produces five distinct lines on a separate window.
  4. Visual Indicators: Each of the five lines represents one of the core currencies:
    • USD (Green)
    • EUR (Navy)
    • GBP (Red)
    • CHF (Black)
    • JPY (Maroon)

User Benefit

Rather than forcing a trader to monitor dozens of individual charts to see which currency is gaining or losing power, this tool consolidates that information into one view. It allows you to see at a glance which currencies are trending upward in strength and which are weakening across the entire forex market.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
10 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 5
#property indicator_color1 Green
#property indicator_color2 Navy
#property indicator_color3 Red
#property indicator_color4 Black
#property indicator_color5 Maroon
//---- buffers
double USD[];
double EUR[];
double GBP[];
double CHF[];
double JPY[];
extern int per1=8;
extern int per2=3;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorShortName("USD:Green; EUR:Blue; GBP:Red; CHF:Black; JPY:Brown");
   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"); 
//----
   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)-
            iMA("EURUSD",0,per2,0,Mode,Price,i))*10000
            +
            (iMA("GBPUSD",0,per1,0,Mode,Price,i)-
            iMA("GBPUSD",0,per2,0,Mode,Price,i))*10000
            +
            (iMA("USDCHF",0,per2,0,Mode,Price,i)-
            iMA("USDCHF",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("USDJPY",0,per2,0,Mode,Price,i)-
            iMA("USDJPY",0,per1,0,Mode,Price,i))*100
            ;
        EUR[i]=
            (iMA("EURUSD",0,per2,0,Mode,Price,i)-
            iMA("EURUSD",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("EURGBP",0,per2,0,Mode,Price,i)-
            iMA("EURGBP",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("EURCHF",0,per2,0,Mode,Price,i)-
            iMA("EURCHF",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("EURJPY",0,per2,0,Mode,Price,i)-
            iMA("EURJPY",0,per1,0,Mode,Price,i))*100
            ;
        GBP[i]=
            (iMA("GBPUSD",0,per2,0,Mode,Price,i)-
            iMA("GBPUSD",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("EURGBP",0,per1,0,Mode,Price,i)-
            iMA("EURGBP",0,per2,0,Mode,Price,i))*10000
            +
            (iMA("GBPCHF",0,per2,0,Mode,Price,i)-
            iMA("GBPCHF",0,per1,0,Mode,Price,i))*10000
            +
            (iMA("GBPJPY",0,per2,0,Mode,Price,i)-
            iMA("GBPJPY",0,per1,0,Mode,Price,i))*100
            ;
        CHF[i]=
            (iMA("USDCHF",0,per1,0,Mode,Price,i)-
            iMA("USDCHF",0,per2,0,Mode,Price,i))*10000
            +
            (iMA("EURCHF",0,per1,0,Mode,Price,i)-
            iMA("EURCHF",0,per2,0,Mode,Price,i))*10000
            +
            (iMA("GBPCHF",0,per1,0,Mode,Price,i)-
            iMA("GBPCHF",0,per2,0,Mode,Price,i))*10000
            +
            (iMA("CHFJPY",0,per2,0,Mode,Price,i)-
            iMA("CHFJPY",0,per1,0,Mode,Price,i))*100
            ;
        JPY[i]=
            (iMA("USDJPY",0,per1,0,Mode,Price,i)-
            iMA("USDJPY",0,per2,0,Mode,Price,i))*100
            +
            (iMA("EURJPY",0,per1,0,Mode,Price,i)-
            iMA("EURJPY",0,per2,0,Mode,Price,i))*100
            +
            (iMA("GBPJPY",0,per1,0,Mode,Price,i)-
            iMA("GBPJPY",0,per2,0,Mode,Price,i))*100
            +
            (iMA("CHFJPY",0,per1,0,Mode,Price,i)-
            iMA("CHFJPY",0,per2,0,Mode,Price,i))*100
            ;
         //double Summa=USD[i]+EUR[i]+GBP[i]+CHF[i]+JPY[i];
         //Print("Summa: ",Summa);
       }
  //----
    return(0);
  }
//+------------------------------------------------------------------+

Comments