Correlpic_1

Author: Copyright � 2005, Yuri Makarov.
Correlpic_1

This tool is designed to provide traders with a synthesized view of market movements by calculating a custom "Index" based on a basket of major global currencies. Rather than looking at a single currency pair in isolation, it aggregates data from several significant pairs—specifically EURUSD, GBPUSD, AUDUSD, USDCHF, USDJPY, and USDCAD—to create a more comprehensive picture of market sentiment.

How the Logic Works:

1. Data Collection The script automatically gathers historical closing price data for six major currency pairs. It acts as a collector, pulling in the latest information for the Euro, British Pound, Australian Dollar, Swiss Franc, Japanese Yen, and Canadian Dollar against the US Dollar.

2. The Mathematical Synthesis The core of the tool lies in its calculation of a "Base USD Value." It takes the prices of these six pairs, performs a specific series of multiplications and divisions, and applies a geometric mean (the 1/7th power). This process effectively blends the performance of all these currencies into a single unified value, smoothing out the volatility that might occur in any one individual pair.

3. Dynamic Currency Conversion Once the "Base USD Value" is calculated, the script allows you to choose your preferred primary currency through a user setting. Depending on which currency you select (e.g., EUR, GBP, JPY, etc.), the tool automatically converts that unified index into your chosen currency's perspective:

  • For most currencies: It multiplies the base value by the specific exchange rate of your chosen currency.
  • For inverted relationships: For certain pairs where the USD is the quote currency (like CHF, JPY, or CAD), it performs a division to ensure the index correctly reflects the value relative to your selected currency.

Purpose for the Trader

Instead of monitoring six different charts to understand global trends, this script provides a single, consolidated line on your screen. It allows you to see how a "basket" of major global economies is moving as a whole, helping you identify broader market trends and shifts in strength or weakness across multiple markets simultaneously.

Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
Correlpic_1
//+------------------------------------------------------------------+
//|                                                       MIndex.mq4 |
//|                                  Copyright © 2005, Yuri Makarov. |
//|                                       http://mak.tradersmind.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Yuri Makarov."
#property link      "http://mak.tradersmind.com"
//----
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 OrangeRed
//----
extern string Curency="USD";
//----
double EurUsd[],UsdChf[],GbpUsd[],UsdJpy[],AudUsd[],UsdCad[];
double Idx[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorShortName(Curency);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,Idx);
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void start()
  {
   int copy,min=Bars;
   ArrayCopySeries(EurUsd,MODE_CLOSE,"EURUSD");
   ArrayCopySeries(GbpUsd,MODE_CLOSE,"GBPUSD");
   copy=ArrayCopySeries(AudUsd,MODE_CLOSE,"AUDUSD");
   if(copy<=0)
     {
      Print("Not found AUDUSD");
      return;
     }
   else
      copy=MathMin(copy,min);
   copy=ArrayCopySeries(UsdChf,MODE_CLOSE,"USDCHF");
   if(copy<=0)
     {
      Print("Not found AUDUSD");
      return;
     }
   else
      copy=MathMin(copy,min);
   copy=ArrayCopySeries(UsdJpy,MODE_CLOSE,"USDJPY");
   if(copy<=0)
     {
      Print("Not found AUDUSD");
      return;
     }
   else
      copy=MathMin(copy,min);
   copy=ArrayCopySeries(UsdCad,MODE_CLOSE,"USDCAD");
   if(copy<=0)
     {
      Print("Not found AUDUSD");
      return;
     }
   else
      copy=MathMin(copy,min);
//----
   int counted_bars=IndicatorCounted();
   double USD;
//----
   if(counted_bars<0) return;
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   if(counted_bars==0) limit--;
   for(int i=0; i<limit; i++)
     {
      USD=MathPow(UsdChf[i]*UsdJpy[i]*UsdCad[i]/EurUsd[i]/GbpUsd[i]/AudUsd[i],1./7.);
      if(Curency=="USD") Idx[i]=USD;
      if(Curency=="EUR") Idx[i]=USD*EurUsd[i];
      if(Curency=="GBP") Idx[i]=USD*GbpUsd[i];
      if(Curency=="AUD") Idx[i]=USD*AudUsd[i];
      if(Curency=="CHF") Idx[i]=USD/UsdChf[i];
      if(Curency=="JPY") Idx[i]=USD/UsdJpy[i];
      if(Curency=="CAD") Idx[i]=USD/UsdCad[i];
     }
  }
//+------------------------------------------------------------------+

Comments