eur_V_usd2_001

Download script
Author: Mich99
eur_V_usd2_001

This script functions as a comprehensive currency analysis tool designed to measure the relative strength of two major economic "baskets": the Euro (EUR) and the US Dollar (USD). Instead of looking at single currency pairs in isolation, it aggregates data from multiple global markets to provide a broader perspective on market trends.

Core Logic and Methodology

The tool operates by evaluating several key currency pairs simultaneously to determine the momentum of the Euro and the US Dollar against a variety of global currencies.

1. The Euro Basket (EUR Strength) The script calculates the performance of the Euro by analyzing eight different pairings:

  • vs. Majors: EUR/USD, EUR/CHF, EUR/GBP, EUR/JPY.
  • vs. Commodities & Others: EUR/AUD, EUR/CAD, EUR/NZD, EUR/NOK.

For each pair, it calculates a percentage difference between two Moving Averages (a short-term and a long-term average). This identifies how much the Euro is currently gaining or losing value relative to those specific currencies. All these values are then added together to create a single "Euro Strength" score.

2. The US Dollar Basket (USD Strength) Similarly, the script evaluates the US Dollar by analyzing eight different pairings, often using inverted calculations to ensure the data reflects the strength of the Dollar specifically:

  • vs. Majors: USD/JPY, GBP/USD, USD/CHF, AUD/USD.
  • vs. Commodities & Others: USDCAD, NZD/USD, USDRUB.

By aggregating these figures, the script produces a single "US Dollar Strength" score.

3. Data Visualization and Output The tool provides three distinct lines on your chart to represent these calculations:

  • Euro Strength Line (Blue): Represents the aggregate momentum of the Euro basket. High values suggest the Euro is strengthening across the board.
  • USD Strength Line (Lime): Represents the aggregate momentum of the US Dollar basket. High values suggest the Dollar is gaining dominance.
  • Relative Difference (Gray): This final line calculates the difference between the Euro basket and the USD basket (Euro - USD). This serves as a "spread," helping traders identify which of the two major currencies is currently outperforming the other in a direct head-to-head comparison.

Summary for Traders

Essentially, this script filters out the "noise" of individual currency fluctuations by averaging the movements of multiple pairs. It allows you to see the underlying health of the Euro and US Dollar as unified blocks, making it easier to identify broad market shifts and choose which currency to trade based on relative strength.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
16 Views
0 Downloads
0 Favorites
eur_V_usd2_001

#property copyright "Mich99"
#property link      "mich99@o2.pl"

#property indicator_separate_window

#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Lime
#property indicator_color3 Gray
//---- input parameters



//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
      SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
   //------------------------------
   IndicatorShortName("EURbasket-v-USDbasket-AO%");
   SetIndexLabel(0,"eur");
   SetIndexLabel(1,"usd");
   SetIndexLabel(2,"eur-usd");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
 double w1 =  100;
 double w2 =  100;
 double w3 =  100;
 double w4 =  100;
 
   int    counted_bars=IndicatorCounted();
   int    limit=Bars-counted_bars;
   
   for(int i=0; i<limit; i++) {
   
   
   
   double a1 = (iMA("EURUSD",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("EURUSD",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("EURUSD",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//iAO("EURUSD",0,i)- iAO("EURUSD",0,i+2); 
   double a2 = (iMA("EURCHF",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("EURCHF",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("EURCHF",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//iAO("EURCHF",0,i)-iAO("EURCHF",0,i+2);
   double a3 = (iMA("EURGBP",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("EURGBP",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("EURGBP",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//iAO("EURGBP",0,i)-iAO("EURGBP",0,i+2);
   double a4 = (iMA("EURJPY",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("EURJPY",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("EURJPY",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//iAO("EURJPY",0,i)-iAO("EURJPY",0,i+2);
   double b1 = (iMA("EURAUD",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("EURAUD",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("EURAUD",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//iAO("EURAUD",0,i)-iAO("EURAUD",0,i+2); 
   double b2 = (iMA("EURCAD",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("EURCAD",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("EURCAD",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//iAO("EURCAD",0,i)-iAO("EURCAD",0,i+2); 
   double b3 = (iMA("EURNZD",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("EURNZD",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("EURNZD",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//iAO("EURNZD",0,i)- iAO("EURNZD",0,i+2); 
   double b4 = (iMA("EURNOK",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("EURNOK",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("EURNOK",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//iAO("EURNOK",0,i)-iAO("EURNOK",0,i+2); 
   
   double ua1 = -(iMA("EURUSD",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("EURUSD",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("EURUSD",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//(iAO("EURUSD",0,i)-iAO("EURUSD",0,i+2)); 
   double ua2 =  (iMA("USDJPY",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("USDJPY",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("USDJPY",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//iAO("USDJPY",0,i)-iAO("USDJPY",0,i+2);
   double ua3 = -(iMA("GBPUSD",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("GBPUSD",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("GBPUSD",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//(iAO("GBPUSD",0,i)-iAO("GBPUSD",0,i+2));
   double ua4 =  (iMA("USDCHF",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("USDCHF",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("USDCHF",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//iAO("USDCHF",0,i)- iAO("USDCHF",0,i+2);
   double ub1 = -(iMA("AUDUSD",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("AUDUSD",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("AUDUSD",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//(iAO("AUDUSD",0,i)-iAO("AUDUSD",0,i+2)); 
   double ub2 =  (iMA("USDCAD",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("USDCAD",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("USDCAD",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//iAO("USDCAD",0,i)-iAO("USDCAD",0,i+2); 
   double ub3 = -(iMA("NZDUSD",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("NZDUSD",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("NZDUSD",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//(iAO("NZDUSD",0,i)-iAO("NZDUSD",0,i+2)); 
   double ub4 =  (iMA("USDRUB",0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA("USDRUB",0,34,0,MODE_SMA,PRICE_MEDIAN,i) )/iMA("USDRUB",0,34,0,MODE_SMA,PRICE_MEDIAN,i)*100;//iAO("USDRUB",0,i)-iAO("USDRUB",0,i+2); 
  
     
   double res   =  (w1 * a1 + w2 * a2 + w3 * a3 + w4 * a4)+(w1 * b1 + w2 * b2 + w3 * b3 + w4 * b4);
   double bres   = (w1 * ua1 + w2 * ua2 + w3 * ua3 + w4 * ua4)+(w1 * ub1 + w2 * ub2 + w3 * ub3 + w4 * ub4);
  
ExtMapBuffer1[i]=res;
ExtMapBuffer2[i]=bres; 
ExtMapBuffer3[i]=res-bres; 
//if( ExtMapBuffer1[i]>ExtMapBuffer1[i+1]) ExtMapBuffer1[i]=res+bres;
//if( ExtMapBuffer1[i]<ExtMapBuffer1[i+1]) ExtMapBuffer2[i]=res+bres; 
} 
//----
   return(0);
  }
 
//+------------------------------------------------------------------+
 

Comments