T3_RSI_AC2
Download scriptThis tool is a specialized technical analysis indicator designed to help traders identify momentum shifts and potential entry points in the financial markets. It works by combining two distinct types of mathematical data: the Relative Strength Index (RSI) and a specialized smoothing filter known as the T3 Moving Average.
How it Works
The core logic of this script revolves around tracking two separate lines on your trading chart:
- The RSI Line: This represents the "pulse" of the market, showing whether an asset is becoming overbought or oversold based on its recent price action.
- The T3 Line: This is a sophisticated smoothing filter applied specifically to that RSI data. Unlike standard averages, the T3 is designed to reduce "noise" and lag while remaining highly responsive to actual price turns.
The Interaction Logic
The primary purpose of this script is to monitor the interaction between these two lines. It calculates how the momentum (RSI) moves in relation to its smoothed trend (T3).
- Smoothing Strategy: The script takes the raw RSI data and runs it through a multi-stage mathematical process. This "double-filtering" creates a smoother curve that helps traders see the underlying trend of the momentum more clearly, rather than getting distracted by minor price fluctuations.
- Crossover Detection: The logic focuses on "crossovers"—moments when the RSI line crosses above or below the T3 line.
- A crossover from below to above often suggests increasing bullish momentum.
- A crossover from above to below often suggests increasing bearish momentum.
Visual and Audio Alerts
To ensure traders do not miss these key moments, the script includes three specific automated features:
- Dynamic Visual Markers: The tool automatically scans the historical data for every point where a crossover occurs. When it detects one of these events, it places a red dotted marker on the chart to highlight the exact moment the momentum shifted.
- Real-Time Audio Alerts: If you have enabled alerts in the settings, the script will play a specific sound file (buy or sell) at the exact moment a crossover occurs on the current live candle. This allows for immediate reaction without needing to constantly watch the screen.
- Prevention of Duplicate Alerts: The logic is programmed to be intelligent; it tracks the time of each alert to ensure that you only receive one notification per candle, preventing the system from repeating sounds multiple times for the same price movement.
Summary for the User
In simple terms, this script acts as a "momentum scout." It takes volatile market data, smooths it out into a readable trend, and alerts you specifically when the current momentum breaks through that trend, providing both a visual history of past turns and an immediate audio signal for current ones.
//+------------------------------------------------------------------+
//| 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 = 50;
extern double T3_Curvature = 0.618;
extern bool Cross_Alert=true;
double t3Array[];
double rsiArray[];
double e1,e2,e3,e4,e5,e6;
double c1,c2,c3,c4;
double n,w1,w2,b2,b3;
//---- globals
int maxLines;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators setting
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,5,Red);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,White);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
IndicatorShortName("T3 RSI Alert "+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()
{
double crossing;
int limit=Bars;
static datetime prevtime = 0;
//---- 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;
}
if (Cross_Alert == true) {
if (prevtime == Time[0]) {
return(0);
}
else {
if((rsiArray[0] > t3Array[0]) && (rsiArray[1] < t3Array[1])) {
PlaySound("t3buy.wav"); //buy wav
}
else if((rsiArray[0] < t3Array[0]) && (rsiArray[1] > t3Array[1])) {
PlaySound("t3sell.wav"); //sell wav
}
prevtime = Time[0];
}
}
//----
DeleteLines();
for(i=WindowBarsPerChart(); i>0 ;i--)
{
crossing=(rsiArray[i]-t3Array[i])*(rsiArray[i+1]-t3Array[i+1]);
if (crossing < 0)
{
maxLines+=1;
ObjectCreate("T3Cross"+maxLines,0,0,Time[i],0);
ObjectSet("T3Cross"+maxLines,OBJPROP_COLOR,Red);
ObjectSet("T3Cross"+maxLines,OBJPROP_STYLE,STYLE_DOT);
}
}
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void DeleteLines()
{
for(int i=1;i<=maxLines;i++) ObjectDelete("T3Cross"+i); maxLines=0;
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
Comments