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

This custom indicator is designed to provide a smoother, more stabilized visual representation of market momentum. Instead of showing the raw, often erratic fluctuations of standard price action indicators, this tool applies a mathematical "smoothing" layer to help traders identify clearer trends and reduce market noise.

Core Logic and Functionality

The script operates by utilizing a well-known momentum oscillator (the Williams Percent Range). On its own, this type of indicator can sometimes be "jittery," moving up and down rapidly in short periods, which can make it difficult to discern the primary direction of the market.

To solve this, the script performs the following logic:

  • Data Averaging: Rather than plotting a single data point at any given moment, the script looks back at a specific number of previous data points (defined by the "Moving" parameter).
  • Summation & Calculation: It calculates the total sum of these previous values and then divides that sum by the number of periods. This creates a Moving Average of the indicator itself.
  • Trend Smoothing: By calculating this average, the script produces a fluid line in a separate window below your main price chart. This line represents the "mean" momentum over a set timeframe.

How It Benefits the User

For a trader, the primary goal of this logic is clarity. Because the indicator calculates a moving average of an oscillator:

  1. Noise Reduction: It filters out minor, insignificant price flickers that might trigger false signals in a standard oscillator.
  2. Trend Identification: By following the smooth path of the blue line, it becomes easier to see whether momentum is steadily increasing or decreasing over time.
  3. Visual Confirmation: The script also displays the current calculated value directly on your screen as a comment, allowing for a quick numerical reference of the current momentum level alongside the visual trend.

In summary, this tool takes raw momentum data and refines it into a stabilized visual path, making it easier to interpret the underlying strength of the market movement.

Indicators Used
Larry William percent range indicator
Miscellaneous
Implements a curve of type %1
17 Views
0 Downloads
0 Favorites
ma-wpr_001
//+------------------------------------------------------------------+
//|                                                        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