T3 RSI
Download scriptThis technical tool is designed to provide traders with a specialized visual aid for analyzing market momentum and price trends. By combining two distinct mathematical concepts—the Relative Strength Index (RSI) and the T3 Moving Average—it aims to create a smoother, more responsive view of market behavior than standard indicators might offer.
Core Logic Overview
The script functions by processing historical price data through a multi-layered calculation to produce two specific visual lines on your trading chart:
1. The RSI Foundation The tool first calculates the Relative Strength Index (RSI). In basic terms, the RSI measures the speed and change of price movements to determine if an asset is overbought or oversold. This serves as the primary raw data for the indicator's logic.
2. The T3 Smoothing Process Rather than plotting the RSI directly—which can often be "noisy" or jump around erratically—the script passes the RSI values through a T3 moving average calculation. The T3 is a sophisticated smoothing technique known for reducing lag while maintaining the integrity of the trend's shape.
To achieve this, the logic performs the following:
- Weighting: It calculates specific weights based on a user-defined "Period" (the amount of time the tool looks back).
- Multi-Stage Filtering: The script puts the data through a series of consecutive mathematical filters (represented as internal variables). Each step takes the result of the previous one, refining the data progressively.
- Curvature Adjustment: It uses a "Curvature" constant to fine-tune how aggressively the line follows the price. This allows the indicator to stay closer to the actual trend without creating the jagged edges often seen in simpler moving averages.
How it Appears on Your Chart
When you apply this script, you will see two distinct lines in a separate window below your main price chart:
- The RSI Line: Represents the raw momentum of the market.
- The T3 Line: Represents the smoothed, "filtered" version of that momentum.
Summary for Traders
By viewing these two lines together, traders can observe the relationship between raw market energy and the underlying trend. The goal of this logic is to help identify when the market's momentum is becoming exhausted or when a new trend is gaining enough strength to be considered significant, providing a clearer picture of the market's "pulse" than looking at price 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 White
extern int RSI_Period = 8;
extern int T3_Period = 8;
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,3,Red);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,White);
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