Author: Copyright � 2006, HomeSoft-Tartan Corp.
ExtraWPR

This technical tool is designed for the MetaTrader trading platform to provide visual analysis of market momentum and price extremes. It operates by calculating a specialized mathematical derivative based on the Williams Price Range (WPR)—a common oscillator used to identify whether an asset is overbought or oversold.

Instead of showing raw price data, this script processes market information through several logical layers:

Core Processing Logic

The tool begins by taking the raw Williams Price Range values and applying a sequence of weighted moving averages. This is achieved through a multi-stage "smoothing" process where each subsequent calculation feeds into the next. By doing this six times in succession, the script filters out minor market "noise," leaving behind a much cleaner trend line that represents the underlying momentum of the asset.

Dynamic Calculation

The script employs specific mathematical coefficients to balance these smoothed values. It uses a weighted distribution system (calculating weights based on a defined period) to ensure that the indicator reacts appropriately to recent price action while maintaining a stable, non-jittery visual output.

Signal Generation and Visualization

The logic concludes by translating these complex calculations into two distinct visual elements on your chart:

  1. Momentum Tracking (Gold Line): This represents the smoothed calculation of the market's strength. It helps traders see the general "flow" of the price movement.
  2. Threshold Triggers (Red Markers): The script monitors the resulting value against specific intensity levels. When the momentum drops below a certain threshold, it triggers a specific visual signal. This is intended to highlight areas where the price may have moved too far in one direction, potentially signaling a reversal or a period of exhaustion.

In summary, this tool acts as a sophisticated filter. It takes volatile market data, smooths it out significantly to reveal the true trend, and provides clear visual cues when that trend reaches extreme mathematical boundaries.

Indicators Used
Larry William percent range indicator
Miscellaneous
Implements a curve of type %1
15 Views
0 Downloads
0 Favorites
ExtraWPR
#property copyright " Copyright © 2006, HomeSoft-Tartan Corp."
#property link      " spiky@transkeino.ru"

#property indicator_separate_window
#property indicator_color1 Gold
#property indicator_buffers 2
#property indicator_color2 Red


int LastTradeTime;
double ExtHistoBuffer[];
double ExtHistoBuffer2[];

void SetLoopCount(int loops)
{
}

void SetIndexValue(int shift, double value)
{
  ExtHistoBuffer[shift] = value;
}

void SetIndexValue2(int shift, double value)
{
  ExtHistoBuffer2[shift] = value;
}


int init()
{
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(0, ExtHistoBuffer);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(1, ExtHistoBuffer2);
   return(0);
}
int start()
{

double e1 = 0;
double e2 = 0;
double e3 = 0;
double e4 = 0;
double e5 = 0;
double e6 = 0;
double c1 = 0;
double c2 = 0;
double c3 = 0;
double c4 = 0;
double n = 0;
double w1 = 0;
double w2 = 0;
double b2 = 0;
double b3 = 0;
double t3 = 0;
int shift = 0;
double wpr = 0;
double trig = 0;
bool ft = true;
double psel = 0;
double pbuy = 0;
double mBar = 0;
double per = 0;
double b = 0;
double t3_period = 0;


b=0.7;
t3_period=8;
psel=-25;pbuy=-75;
mBar=100;per=96;
if( ft ) { 
b2=b*b;
b3=b2*b;
c1=-b3;
c2=(3*(b2+b3));
c3=-3*(2*b2+b+b3);
c4=(1+3*b+b3+3*b2);
n=t3_period;

if( n<1 ) n=1;
n = 1 + 0.5*(n-1);
w1 = 2 / (n + 1);
w2 = 1 - w1;ft=false;} 




SetLoopCount(0); 
// loop from first bar to current bar (with shift=0)
for(shift=Bars-1;shift>=0 ;shift--){ SetIndexValue(shift, 0); SetIndexValue2(shift, 0); } 
 
for(shift=mBar;shift>=0 ;shift--){ 
wpr=iWPR(NULL, 0, per,shift);

  e1 = w1*wpr + w2*e1;
  e2 = w1*e1 + w2*e2;
  e3 = w1*e2 + w2*e3;
  e4 = w1*e3 + w2*e4;
  e5 = w1*e4 + w2*e5;
  e6 = w1*e5 + w2*e6;

  t3 = c1*e6 + c2*e5 + c3*e4 + c4*e3;

   
  if( t3>=-50 ) trig=psel; 
  if( t3<-50 ) trig=pbuy;
  SetIndexValue2(shift,trig); 
  SetIndexValue(shift,t3);}   return(0);
}

Comments