T3_RSI
Download scriptThis tool is designed as a technical analysis indicator for the MetaTrader platform, specifically created to provide traders with a smoother, more refined view of market momentum. It combines two well-known financial concepts—the Relative Strength Index (RSI) and the T3 moving average—to help identify trends while filtering out the "noise" that often makes standard charts difficult to read.
How the Logic Works
The indicator operates by processing price data through a multi-layered mathematical filter:
1. Identifying Momentum (The RSI Layer) At its core, the script first calculates the Relative Strength Index (RSI). This is a standard momentum oscillator that measures the speed and change of price movements. By looking at the RSI, the tool establishes whether an asset is being bought or sold aggressively over a specific period.
2. Smoothing the Data (The T3 Layer) Standard indicators can often be "jittery," jumping up and down rapidly with every minor price tick. To solve this, the script applies a T3 Moving Average to the RSI data. Unlike a standard moving average, the T3 is specifically engineered to be much smoother while still reacting quickly to actual price turns. It uses a sophisticated weighting system (based on user-adjustable "curvature" settings) to reduce lag—the delay between a price change and the indicator's reaction.
3. The Combined Result Instead of showing you raw, jagged momentum data, the script outputs two distinct lines:
- The primary RSI line provides the basic movement.
- The T3-filtered line provides the "cleaned" version.
What This Means for the User
By layering these two calculations, the indicator aims to give you a clearer picture of the market's direction. Because it uses the T3 smoothing logic on the RSI, it helps traders distinguish between temporary price fluctuations and significant shifts in momentum. It essentially acts as a "stabilizer," allowing you to see the underlying trend of the market's strength more clearly than you could by looking at either component alone.
//+------------------------------------------------------------------+
//| T3_RSI.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_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Aqua
#property indicator_level1 50
#property indicator_level2 70
#property indicator_level3 30
extern int RSI_Period = 9;
extern int T3_Period = 9;
extern double T3_Curvature = 0.618;
double t3Array[];
double rsiArray[];
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);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
IndicatorShortName("T3 RSI "+T3_Period);
SetIndexBuffer(0,t3Array);
SetIndexLabel(0,"T3 "+T3_Period);
SetIndexBuffer(1,rsiArray);
SetIndexLabel(1,"RSI "+T3_Period);
//---- variable reset
e1=0; 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=T3_Curvature*T3_Curvature;
b3=b2*T3_Curvature;
c1=-b3;
c2=(3*(b2+b3));
c3=-3*(2*b2+T3_Curvature+b3);
c4=(1+3*T3_Curvature+b3+3*b2);
n=T3_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=Bars;
//---- indicator calculation
for(int i=limit; i>=0; i--)
{
rsiArray[i] = iRSI(NULL,0,T3_Period,PRICE_CLOSE,i);
e1 = w1*rsiArray[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;
t3Array[i]=c1*e6 + c2*e5 + c3*e4 + c4*e3;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments