MultiwprhistUSD

Download script
MultiwprhistUSD

Overview

This tool is a specialized multi-currency analysis indicator designed for traders who want to monitor the relationship between major currency pairs simultaneously. Instead of looking at just one chart at a time, this script aggregates data from four primary markets—GBP/USD, EUR/USD, USD/CHF, and USD/JPY—to provide a unified snapshot of market sentiment.

Core Logic and Functionality

The indicator operates by calculating the Williams Percent Range (WPR) for each of the four major pairs. The WPR is a momentum oscillator that helps identify overbought or oversold conditions. This script takes that raw data and processes it through several logic layers:

1. Multi-Currency Normalization The tool tracks the performance of four specific currency relationships. It calculates the relative strength of these pairs and adjusts the values so they can be compared on a single visual scale. By doing this, it allows you to see how different markets are moving in relation to one another at any given moment.

2. Trigger System The script evaluates whether each currency pair is hitting specific "thresholds." It checks if the market momentum is pushing strongly in one direction or the other based on a user-defined limit (the Williams Threshold). This determines if a specific currency is exhibiting enough strength to influence the overall trend.

3. Sentiment Aggregation (The BSI) This is the most sophisticated part of the logic. The script combines the "Triggers" from all four pairs into a single combined score.

  • It adds up the strengths of certain pairs and subtracts the strengths of others to find a net market direction.
  • If the combined score is significantly positive, it signals an upward bias; if significantly negative, it signals a downward bias.
  • The script also includes a "USD Symmetry" check: it detects if you are viewing a currency that is primarily based on the USD and automatically flips the signal to ensure the visual indicator aligns with your specific chart's perspective.

Visual Output

The tool provides three distinct types of visual information:

  • Trend Lines: You can choose to display lines representing the individual momentum of the four major pairs. This helps in seeing which specific currency is leading the move.
  • Dynamic Histograms: The tool features a "Buy" (Up) and "Sell" (Down) histogram system. When the combined logic from all four currencies reaches a significant consensus, these bars appear to signal a potential trend shift.
  • Unified Perspective: By consolidating four charts into one indicator, it reduces visual clutter and helps traders identify "confluence"—where multiple currency pairs agree on the same direction at the same time.
Indicators Used
Larry William percent range indicator
Miscellaneous
Implements a curve of type %1
15 Views
0 Downloads
0 Favorites
MultiwprhistUSD
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                     MultiWpr.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+

#property indicator_separate_window
#property indicator_buffers 6

#property indicator_color1 White
#property indicator_color2 Red
#property indicator_color3 LimeGreen
#property indicator_color4 LightBlue
#property indicator_color5 Yellow
#property indicator_color6 Red

extern int Williams_Period = 14;
extern double Williams_Threshold = 50;
extern bool Show_WPR_Lines=True;

#define GPB 0
#define EUR 1
#define CHF 2
#define JPY 3
#define up  4
#define dn  5




#define Gpb "GBPUSD"
#define Eur "EURUSD"
#define Chf "USDCHF"
#define Jpy "USDJPY"


/*
#define Gpb "AUDUSD"
#define Eur "AUDCAD"
#define Chf "USDJPY"
#define Jpy "GBPJPY"
*/


double GPBBuffer[];
double EURBuffer[];
double CHFbuffer[];
double JPYbuffer[];
double upbuffer[];
double dnbuffer[];



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   IndicatorShortName("Multi WPR - ONLY ON MAJORS!!!!");

   IndicatorBuffers(6);

   SetIndexBuffer( GPB, GPBBuffer );
   SetIndexLabel( GPB, Gpb );
   SetIndexStyle( GPB, DRAW_LINE, STYLE_SOLID, 1 );

   SetIndexBuffer( EUR, EURBuffer );
   SetIndexLabel( EUR, Eur );
   SetIndexStyle( EUR, DRAW_LINE, STYLE_SOLID, 1 );

   SetIndexBuffer( CHF, CHFbuffer );
   SetIndexLabel( CHF, Chf );
   SetIndexStyle( CHF, DRAW_LINE, STYLE_SOLID, 1 );

   SetIndexBuffer( JPY, JPYbuffer);
   SetIndexLabel( JPY, Jpy );
   SetIndexStyle( JPY, DRAW_LINE, STYLE_SOLID, 1 );
   
   SetIndexBuffer( up, upbuffer);
   SetIndexStyle( up, DRAW_HISTOGRAM, STYLE_SOLID, 1 );
   
   SetIndexBuffer( dn, dnbuffer);
   SetIndexStyle( dn, DRAW_HISTOGRAM, STYLE_SOLID, 1 );
   
   
   IndicatorDigits( MarketInfo( Symbol() ,MODE_DIGITS ) );
   
   return(0);
}

double WPR( string Currency, int Shift, int & Trig )
{
double Result = iWPR( Currency, Period(), Williams_Period, Shift );

   Trig = 0;
  	if (Result < -Williams_Threshold)
  	   Trig = -1;
  	else
      Trig = 1;
      
   return( 50 + Result );
}


int start()
{
static int PrevBars = 0,
           NameC = 0;

   if( Bars > PrevBars )
   {
   int J = 0, 
       I = Bars - PrevBars;

      for( ; I > 0; I--, J++ )
      {
      int GPB_Trig, EUR_Trig, CHF_Trig, JPY_Trig;
      double tempgbp,tempeur,tempchf,tempjpy;
         
         tempgbp = WPR( Gpb, J, GPB_Trig );
         tempeur = WPR( Eur, J, EUR_Trig );
         tempchf = WPR( Chf, J, CHF_Trig );
         tempjpy = WPR( Jpy, J, JPY_Trig );
         
         if (Show_WPR_Lines)
         {
         if (Symbol() == Gpb || Symbol() == Eur)
         {
         GPBBuffer[ J ] = tempgbp;
         EURBuffer[ J ] = tempeur;
         CHFbuffer[ J ] = -tempchf;
         JPYbuffer[ J ] = -tempjpy;
         }
         else
         {
         GPBBuffer[ J ] = -tempgbp;
         EURBuffer[ J ] = -tempeur;
         CHFbuffer[ J ] = tempchf;
         JPYbuffer[ J ] = tempjpy;
         }

         }
      int Trig = GPB_Trig + EUR_Trig - CHF_Trig - JPY_Trig,
          Bsi;
      
         if( Trig > 2 )
            Bsi = 1;
         else if( Trig < -2 )
            Bsi = -1;
         else
            Bsi = 0;

         if( Symbol() > "USD" )		// Any USD based Currency
            Bsi = -Bsi;

         upbuffer[ J ] = 0;
         dnbuffer[ J ] = 0;
         
         if( Bsi != 0 )
         {
            if( Bsi > 0 )
			   {
               upbuffer[ J ] = 55;
				}
            else
			   {
               dnbuffer[ J ] = -55;
			   }
			   NameC++;
         }			
      }      
      PrevBars = Bars;
   }
	return(0);
}

Comments