Correl[i]_1

Download script
Author: Copyright � 2005, Yuri Makarov.
Correl[i]_1

This tool is designed to provide traders with a specialized visual metric that represents the relative strength of the US Dollar (USD) across multiple major global currencies simultaneously. Instead of looking at individual currency pairs in isolation, this script synthesizes data from six different markets to create a unified index.

How the Logic Works

The core functionality of the script relies on a mathematical "averaging" process. It gathers real-time closing price data from the following major currency pairs:

  • EUR/USD
  • GBP/USD
  • AUD/USD
  • USD/CHF
  • USD/JPY
  • USD/CAD

The Calculation Process: To determine the overall strength of the Dollar, the script takes the prices from these six pairs and combines them into a single calculation. By multiplying several pairs and dividing by others, it creates a weighted average. Specifically, it calculates the "Geometric Mean" of these currencies. This means that rather than just looking at one trend (like how the Dollar behaves against the Euro), it looks at the collective movement of the Dollar against all six major partners at once.

Customization and Output

The script allows users to choose a specific "base currency" via a settings menu. While the primary logic focuses on the USD, the final visual line shown on your chart can be adjusted to reflect different perspectives:

  • Standard USD View: Displays the calculated strength of the Dollar directly.
  • Cross-Currency Conversion: If you select other currencies (such as EUR, GBP, JPY, etc.), the script automatically performs an additional conversion step. It takes that core Dollar strength and translates it into the value of your chosen currency.

Visual Presentation

The result is displayed in a separate window below your main price chart as a continuous line. This allows you to see at a glance whether the US Dollar is gaining momentum, losing ground, or remaining stable on a global scale, helping you identify broader market trends more effectively than by watching individual charts alone.

Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
Correl[i]_1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                       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()
{
   ArrayCopySeries(EurUsd,MODE_CLOSE,"EURUSD");
   ArrayCopySeries(GbpUsd,MODE_CLOSE,"GBPUSD");
   ArrayCopySeries(AudUsd,MODE_CLOSE,"AUDUSD");
   ArrayCopySeries(UsdChf,MODE_CLOSE,"USDCHF");
   ArrayCopySeries(UsdJpy,MODE_CLOSE,"USDJPY");
   ArrayCopySeries(UsdCad,MODE_CLOSE,"USDCAD");

   int counted_bars=IndicatorCounted();
   double USD;

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   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