Complex'_001

Download script
Author: SemSemFX@rambler.ru
Complex'_001

This script is designed as a specialized technical analysis tool for the MetaTrader platform. It provides a multi-currency overview by calculating and visualizing specific price movements across several major global currencies (USD, EUR, GBP, CHF, and JPY) simultaneously on a single chart.

Core Logic and Functionality

The primary purpose of this script is to synthesize complex data from multiple currency pairs into five distinct visual lines. Instead of looking at just one chart (like EUR/USD), it looks at the relationship between many different pairs to determine the relative strength or momentum of each major currency.

1. Data Aggregation The tool monitors a wide array of currency pairings. It specifically tracks how these currencies interact against each other in real-time. By analyzing several pairs at once, the script filters out "noise" and focuses on the underlying movement of the individual base currencies.

2. Moving Average Differentiation To identify trends, the script utilizes a "Moving Average" calculation. However, it doesn't just look at the current price; it measures the difference between two different points in time (controlled by a user-defined offset). By calculating the gap between these points across multiple pairs, the script can determine:

  • Strength: Which currency is gaining momentum compared to the others?
  • Velocity: How fast is that specific currency moving relative to the rest of the market?

3. Currency-Specific Calculations The logic applies different mathematical weights to each currency to ensure they are displayed accurately on the same scale:

  • USD, EUR, and GBP: These are processed using a standard multiplier to harmonize their values.
  • CHF and JPY: Because of their specific market behaviors and decimal precisions, these are treated with unique weighting to ensure their trends are represented clearly alongside the other three currencies.

4. Visual Output The result is a dedicated window at the bottom of your trading screen containing five separate lines, each color-coded to a specific currency:

  • Green: USD
  • Navy: EUR
  • Red: GBP
  • Black: CHF
  • Maroon: JPY

How it helps the trader

Rather than manually checking five or six different charts to see which currency is leading the market, this script provides a "bird's-eye view." It allows you to see at a glance which currencies are trending upward or downward in relation to one another. When these lines move in sync or diverge, it provides a visual cue regarding the prevailing market sentiment and the relative power of each major global currency.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
Complex'_001
//+------------------------------------------------------------------+
//|                                                      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=14;
extern int D=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+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
            ;
        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
            ;
        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
            ;
        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
            ;
        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
            ;
         //double Summa=USD[i]+EUR[i]+GBP[i]+CHF[i]+JPY[i];
         //Print("Summa: ",Summa);
       }
  //----
    return(0);
  }
//+------------------------------------------------------------------+

Comments