VininI_Trend_WPR_MA
Download scriptThis script is designed as a specialized technical analysis tool that helps traders visualize market momentum and trend strength by combining three distinct layers of data processing. Instead of looking at price alone, it interprets the "speed" and "direction" of the market to provide a clearer picture of current trends.
Core Logic Breakdown
1. The Foundation: Relative Strength Tracking The process begins by calculating a base value using a standard momentum oscillator (the WPR). This component identifies where the current price sits relative to its high and low range over a specific timeframe. Essentially, it determines if the market is currently feeling "stretched" toward the top or bottom of its recent boundaries.
2. The Sentiment Filter: Aggregated Comparison Rather than just showing you that raw momentum value, the script performs a sophisticated multi-point comparison. It looks at a series of historical data points (defined by a set count and step) and compares them against the current state.
- For every point in this sequence, the script checks if the current value is higher or lower than the historical average.
- It then tallies these "wins" and "losses."
- The result is a normalized score that indicates whether the current market behavior is consistently stronger or weaker than its recent history.
3. The Smoothing Layer: Trend Visualization To prevent the data from appearing erratic or "noisy," the final step applies a smoothing filter to the scores generated in the previous step. This results in a flowing trend line (or histogram) that highlights the underlying direction of the market sentiment.
Practical Summary
In simple terms, this tool doesn't just tell you what the price is doing right now; it calculates whether the current market energy is stronger or weaker than it has been over a specific period. By filtering out minor fluctuations and focusing on the "sum" of historical comparisons, it provides a visual representation of sustained trend momentum, helping traders identify when a move has real staying power versus just a temporary spike.
//+------------------------------------------------------------------+
//| VininI_Trend_WPR_MA.mq4 |
//| Ñopyright 2008. Victor Nicolaev |
//| vinin@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Ñopyright 2008. Victor Nicolaev"
#property link "vinin@mail.ru"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Yellow
#property indicator_level1 0
#property indicator_maximum 1
#property indicator_minimum -1
extern int WPR_Period=100;
extern int Trend_MA_Period=3;
extern int MA_Start=10;
extern int MA_Step=10;
extern int MA_Count=50;
extern int MA_Mode=0;
extern int Limit=1440;
//---- buffers
double Buffer[];
double WPR[];
double Trend[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() {
//---- drawing settings
IndicatorBuffers(3);
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,Trend);
SetIndexBuffer(1,WPR);
SetIndexBuffer(0,Buffer);
return(0); }//int init()
//+------------------------------------------------------------------+
int start() {
int limit;
int counted_bars=IndicatorCounted();
int i,j;
double sum=0;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
if (Limit>0) limit=MathMin(Limit,limit);
for (i = limit;i>=0;i--) WPR[i]=iWPR(NULL,0,WPR_Period,i);
for (i = limit;i>=0;i--){
sum=0;
for (j=0;j<MA_Count;j++)
if (WPR[i]>iMAOnArray(WPR,0,MA_Start+j*MA_Step,0,MA_Mode,i)) sum+=1; else sum-=1;
Buffer[i]=sum/MA_Count;
}
for (i = limit;i>=0;i--)Trend[i]=iMAOnArray(Buffer,0,Trend_MA_Period,0,MA_Mode,i);
return(0);
}
Comments