Author: MojoFX - Conversion only
T3 THV

This technical tool is designed to provide a smoothed, high-precision visual representation of price movements on a trading chart. Unlike standard moving averages that may react too quickly to market "noise" or too slowly to significant trends, this script utilizes a specific mathematical smoothing process to filter out minor fluctuations while preserving the integrity of the overall price trend.

How the Logic Works

The core functionality of this tool relies on a multi-layered smoothing technique. Instead of calculating a single average, the script processes the market data through a series of sequential stages:

  • Sequential Smoothing Layers: The logic takes the closing price of an asset and passes it through six distinct layers of calculation. Each layer acts as a filter; by the time the data reaches the final stage, the "jagged" edges of short-term price volatility have been significantly rounded out.
  • Weighted Distribution: Rather than treating every historical price point with equal importance, the tool applies specific weights (determined by user-defined parameters) to balance how much influence recent prices have compared to older data. This helps in creating a curve that feels fluid and responsive.
  • Polynomial Transformation: After the data has been smoothed through the six layers, the script performs a final mathematical transformation. It combines these layers using specific coefficients to produce a single, clean line on your chart. This ensures that the resulting indicator is not just a simple average, but a sophisticated curve that represents a stabilized view of price momentum.

Key Features for the User

  • Trend Clarity: By removing the "jitter" from price action, the tool allows traders to see the underlying trend more clearly, making it easier to identify whether the market is moving higher or lower over a sustained period.
  • Customizable Sensitivity: Through the adjustable periods and coefficients, users can tune the tool to be either highly reactive to new information or extremely smooth for long-term trend analysis.
  • Visual Precision: The final output is a solid line rendered directly on the main chart window, providing a clean, professional visual aid that integrates seamlessly into any trading strategy.
Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
T3 THV
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//| T3.mq4 |
//| MojoFX |
//| http://groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/ |
//+------------------------------------------------------------------+
#property copyright "MojoFX - Conversion only"
#property link "http://groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red

extern int MA_Period = 8;
extern double b = 0.4;


double MapBuffer[];

double e1[],e2[],e3[],e4[],e5[],e6[];
double c1,c2,c3,c4;
double n,w1,w2,b2,b3;

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators setting
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,Aqua);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
IndicatorShortName("T3 THV"+MA_Period);
SetIndexDrawBegin(0,100);
SetIndexBuffer(0,MapBuffer);



//---- variable reset
//e2=0; e3=0; e4=0; e5=0; e6=0;
c1=0; c2=0; c3=0; c4=0; 
n=0; 
w1=0; w2=0; 
b2=0; b3=0;

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=MA_Period;

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

//----
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
if (counted_bars<0) return (-1);
if (counted_bars>0) counted_bars--;
limit=(Bars-counted_bars)-1;

//---- indicator calculation
ArrayResize(e1, Bars+1);
ArrayResize(e2, Bars+1);
ArrayResize(e3, Bars+1);
ArrayResize(e4, Bars+1);
ArrayResize(e5, Bars+1);
ArrayResize(e6, Bars+1);

for(int i=limit; i>=0; i--)
{
e1[Bars-i] = w1*Close[i] + w2*e1[(Bars-i)-1];
e2[Bars-i] = w1*e1[Bars-i] + w2*e2[(Bars-i)-1];
e3[Bars-i] = w1*e2[Bars-i] + w2*e3[(Bars-i)-1];
e4[Bars-i] = w1*e3[Bars-i] + w2*e4[(Bars-i)-1];
e5[Bars-i] = w1*e4[Bars-i] + w2*e5[(Bars-i)-1];
e6[Bars-i] = w1*e5[Bars-i] + w2*e6[(Bars-i)-1];
//Print ("I- ",i, "Bars-I ",Bars-i);
MapBuffer[i]=c1*e6[Bars-i] + c2*e5[Bars-i] + c3*e4[Bars-i] + c4*e3[Bars-i];
} 
//----
return(0);
}
//+------------------------------------------------------------------+

Comments