This custom indicator is designed to provide traders with a smoothed, refined visual of market momentum by layering two distinct mathematical processes. Instead of showing raw, jittery price data, it filters the information to help identify clearer trends and potential reversal points.
How the Logic Works
The tool operates in two primary stages:
1. The Foundation (HLR Analysis) The script begins by pulling data from a base calculation known as "HLR." This primary component looks at specific price ranges over a user-defined period. It serves as the raw material for the indicator, capturing the fundamental movement of the market's highs and lows.
2. The Smoothing Process (T3 Filtering) Once the base data is gathered, the script applies a sophisticated smoothing technique called the T3MA logic. While standard moving averages can sometimes be "laggy" (reacting too slowly to price changes) or too "noisy" (jumping around erratically), the T3 logic uses a series of weighted calculations to balance both.
- Weighting: It assigns specific weights to different parts of the data to ensure that the most relevant price information remains prominent.
- Multi-Stage Calculation: The script runs the data through a sequence of five successive smoothing passes. This creates a "triple-smoothed" effect that eliminates market noise while maintaining a tight, responsive line that follows the trend closely.
Key Features and Customization
- Dynamic Response: By adjusting the
T3_Period, you can control how "fast" or "slow" the indicator reacts to new price action. - Visual Benchmarks: The indicator includes pre-set visual levels (20, 50, and 80) on a separate window. These act as boundaries to help traders identify when the market is potentially overbought (near the top) or oversold (near the bottom).
- Efficiency: The logic is optimized to focus on the most recent price action, ensuring that the visual line updated on your chart provides the most current perspective of the market's momentum.
Summary for the Trader
Think of this indicator as a high-end optical lens for your charts. It takes the "blurry" and often chaotic movements of the market and clarifies them into a smooth, flowing line. It allows you to see the underlying trend of the price movement without being distracted by the minor fluctuations that often lead to false signals.
//+------------------------------------------------------------------+
//| WPR T3.mq4 |
//| Original Code by FX Sniper |
//| Copyright © 2007, Forex-TSD.com |
//| Written by Linuxser |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, Forex-TSD.com "
#property link "http://www.forex-tsd.com/"
//----
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_color1 Red
#property indicator_width1 3
#property indicator_level1 20
#property indicator_level2 50
#property indicator_level3 80
#property indicator_levelstyle STYLE_DASHDOT
#property indicator_levelcolor DodgerBlue
//----
extern int HLR_Range = 20;
extern bool LastBarOnly = true;
extern int T3_Period = 5;
extern double hot = 0.550;
//----
double e1, e2, e3, e4, e5, e6;
double c1, c2, c3, c4;
double n, w1, w2, b2, b3;
double HLR[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators setting
SetIndexBuffer(0, HLR);
//----
SetIndexStyle(0, DRAW_LINE);
//----
IndicatorShortName("HLR(" + HLR_Range + ", " + T3_Period + ")");
SetIndexLabel(0, "HLR T3");
//---- variable reset
b2 = hot*hot;
b3 = b2*hot;
c1 = -b3;
c2 = (3*(b2 + b3));
c3 = -3*(2*b2 + hot + b3);
c4 = (1 + 3*hot + b3 + 3*b2);
n = T3_Period;
//----
if(n < 1)
n = 1;
w1 = 2 / (2 + 0.5*(MathMax(1,n)-1));
w2 = 1 - w1;
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars = IndicatorCounted();
//---- check for possible errors
if(counted_bars < 0)
return(-1);
//---- last counted bar will be recounted
if(counted_bars > 0)
counted_bars--;
limit = Bars - counted_bars;
//---- indicator calculation
for(int i = Bars - 1; i >= 0; i--)
{
HLR[i] = iCustom(NULL, 0,"HLR",LastBarOnly,HLR_Range,0,i);
e1 = w1*HLR[i] + 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;
HLR[i] = c1*e6 + c2*e5 + c3*e4 + c4*e3;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments