Author: Copyright � 2008, MOHAmad.Rahimi.
ma-wpr

This script is designed as a visual trading tool that helps smooth out market data to provide a clearer picture of price trends. Instead of showing you the raw, jagged movements of a market oscillator, it processes the data to create a more stable and readable trend line.

How it Works

The logic behind this tool relies on a two-step process:

1. Data Collection (The Wilsonochore Range) The script first looks at a specific market oscillator known as the Williams Percent Range (WPR). This oscillator is typically used to identify overbought or oversold conditions. By pulling this data, the script establishes a foundation of market momentum.

2. The Smoothing Process (Moving Average) Rather than plotting the WPR directly—which can often be "noisy" or fluctuate rapidly—the script applies a mathematical smoothing layer. It looks back at a specific number of previous data points (defined by your settings) and calculates their average.

By averaging these points, the tool "blurs" out minor price spikes and inconsistencies. The result is a much smoother blue line that reflects the underlying direction of the market movement.

Key Features for the User

  • Visual Clarity: Because it uses a moving average calculation, the resulting line is easier to follow visually than standard oscillators, making it simpler to identify whether the general trend is moving up or down.
  • Real-Time Feedback: The script is programmed to display the current calculated value directly on your chart as a comment, providing you with an instant numerical reading of the current trend strength.
  • Customizable Sensitivity: You can adjust how much "smoothing" occurs by changing the period settings. A higher number will result in a smoother, slower-moving line, while a lower number will make the tool more responsive to quick price changes.
Indicators Used
Larry William percent range indicator
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
ma-wpr
//+------------------------------------------------------------------+
//|                                                        tsf-2.mq4 |
//|                                Copyright © 2008, MOHAmad.Rahimi. |
//|                                           http://a162.blogfa.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MOHAmad.Rahimi."
#property link      "http://a162.blogfa.com"
//----
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Blue
#property indicator_width1 2
//---- input parameters
extern int       WPR=39;
extern int       Moving=10;
//---- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   if (counted_bars<0) return(-1);
   if (counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   double dif;
//----
   while(limit>0)
     {
      double sum=0,ma= 0;
      for(int j=0;j<Moving;j++)
      { sum=sum+ iWPR(NULL,0,WPR,limit+j);}
      ma=sum/Moving;
//----
      ExtMapBuffer1[limit]=ma;
      Comment(ma);
      limit--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments