Multiwprhist
Download scriptThe MultiWPR indicator is a sophisticated market analysis tool designed to synchronize the movements of four major global currency pairs simultaneously. Rather than looking at a single market in isolation, this script evaluates the momentum of the GBP/USD, EUR/USD, USD/CHF, and USD/JPY pairs to identify broader market trends and potential reversal points.
Core Logic and Methodology
The tool operates by calculating the Williams Percent Range (WPR) for each of the four specified currency pairs. The WPR is a momentum oscillator that measures how far the current price has moved relative to its high and low range over a set period.
By analyzing these four pairs together, the script performs the following actions:
- Multi-Currency Synthesis: It tracks the momentum of each major pair independently but aggregates their data into a single visual display. This allows traders to see the "big picture" of how major currencies are moving in relation to one another.
- Momentum Thresholds: The logic evaluates whether each currency's momentum has crossed specific thresholds. If a currency's momentum is sufficiently strong or weak based on the predefined settings, it assigns a numerical "trigger" value.
- Aggregated Signal Calculation: The script combines these individual triggers into a collective score. By adding and subtracting these scores across all four pairs, the tool calculates a unified market sentiment.
Visual Output and Signals
The indicator provides two primary types of visual information:
- Trend Lines: Depending on your settings, the tool can display individual lines for each currency pair. This helps in monitoring the independent strength of each specific market.
- Momentum Histograms: The most prominent feature is a histogram that represents the consolidated market sentiment.
- When the combined momentum across all pairs leans significantly toward a bullish (upward) direction, a positive bar appears on the histogram.
- When the combined momentum leans significantly toward a bearish (downward) direction, a negative bar appears.
- Currency Orientation Adjustment: To ensure accuracy, the logic automatically detects if the chart you are currently viewing is "USD-based." If it is, the script intelligently flips the signal to account for the inverse relationship between buying a currency against the dollar versus selling it.
Summary for Traders
Instead of guessing which way a single pair might move, this tool looks at the "gears" of the global forex market. It identifies when the majority of major currencies are moving in harmony, providing a visual cue (via the histogram) to help traders align their positions with the overall direction of the market.
/*-----------------------------+
| |
| 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 );
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)
{
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