RSI-TC_NEWd
Download scriptThe RSI with Trend Catcher is a specialized technical analysis tool designed to help traders identify high-probability entry points by combining momentum tracking, volatility measurement, and trend detection. Rather than relying on a single indicator, it synthesizes three different types of market data to provide more reliable signals.
Core Components and Logic
1. Two-Tone Momentum Tracking (RSI) The foundation of this tool is the Relative Strength Index (RSI), which measures the speed and change of price movements. This script enhances the standard RSI by visually separating "Bullish" and "Bearish" momentum.
- When the market shows strong upward strength, the indicator highlights it in one color.
- When it shows strong downward strength, it shifts to another.
- This allows you to see at a glance which side of the market currently holds the dominant momentum.
2. The "Squeeze" Detection (Volatility Analysis) One of the most advanced features of this script is its ability to identify a "Squeeze." It does this by comparing two different types of price envelopes: Bollinger Bands and Keltner Channels.
- The Logic: Usually, these two indicators move together. However, when the Bollinger Bands contract inside the Keltner Channels, it signals that the market is in a state of "compressed" volatility.
- The Purpose: This identifies periods where the market is "coiling" like a spring, suggesting that a significant breakout in price is likely to occur soon.
3. Trend Breakout Signals The "Trend Catcher" logic acts as the final filter for your trades. It waits for specific conditions to align before generating a signal:
- Breakout Entry: It looks for a situation where a "Squeeze" has occurred and the price suddenly breaks out of its previous range, supported by the RSI momentum.
- Trend Continuation: It also monitors for instances where the price continues to move in the direction of the trend while maintaining specific relationship dynamics between the bands and the RSI.
Visual Signals and Alerts
To make the information easy to digest for the user, the script provides several visual cues:
- Arrows and Dots: The script places specific marks on the chart to highlight "Buy" and "Sell" opportunities based on the breakout logic.
- Dynamic Coloring: The RSI line changes behavior based on whether it is in a bullish or bearish zone.
- Real-Time Alerts: For active trading, the tool can trigger an audible alert and a pop-up notification on your screen the moment a new Buy or Sell signal is confirmed, ensuring you don't have to watch the screen constantly.
Summary of Workflow
The script essentially filters out "market noise" by following this sequence:
- Identify Compression: Is the market squeezing (low volatility)?
- Check Momentum: Is the RSI showing strength in a specific direction?
- Confirm Breakout: Did the price just break out of the compressed zone?
If all three conditions are met, the indicator signals a trend opportunity, aiming to catch the start of a new move rather than entering into a choppy or indecisive market.
/*
*********************************************************************
RSI with Trend Catcher signal
by Matsu
based on codes from various sources
*********************************************************************
*/
//mod obos levels
#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 DarkGreen
#property indicator_color2 Red
#property indicator_color3 Lime
#property indicator_color4 DeepPink
#property indicator_color5 Gold
#property indicator_color6 Green
#property indicator_level1 60
#property indicator_level2 50
#property indicator_level3 40
int BBPrd=20;
double BBDev=2.0;
int SBPrd=13;
int SBATRPrd=21;
double SBFactor=2;
int SBShift=1;
extern int RSIPeriod=21;
extern int OverBoughtLevel=60;
extern int OverSoldLevel=40;
extern int BullZoneLevel=50;
extern int BearZoneLevel=50;
extern bool DrawDots = true;
extern bool AlertOn = true;
double RSI[];
double DnRSI[];
double Buy[];
double Sell[];
double Squeeze[];
double UpRSI[];
//-----
int init()
{
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,RSI);
if (DrawDots)
{
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,159);
SetIndexEmptyValue(1,EMPTY_VALUE);
SetIndexBuffer(1,DnRSI);
SetIndexStyle(5,DRAW_ARROW);
SetIndexArrow(5,159);
SetIndexEmptyValue(5,EMPTY_VALUE);
SetIndexBuffer(5,UpRSI);
}
SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID);
SetIndexArrow(2,159);
SetIndexBuffer(2,Buy);
SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID);
SetIndexArrow(3,159);
SetIndexBuffer(3,Sell);
SetIndexStyle(4,DRAW_ARROW,STYLE_SOLID);
SetIndexArrow(4,159);
SetIndexBuffer(4,Squeeze);
IndicatorShortName("RSI("+RSIPeriod+")");
IndicatorDigits(2);
return(0);
}
int start()
{
int counted_bars=IndicatorCounted();
int shift,limit,ob,os;
double BBMA, SBMA, TopBBand, BotBBand, TopBBandPrev, BotBBandPrev, TopSBand, BotSBand;
bool dn = false;
double BuyNow, BuyPrevious, SellNow, SellPrevious;
static datetime prevtime = 0;
if (counted_bars<0) return(-1);
if (counted_bars>0) counted_bars--;
limit=Bars-31;
if(counted_bars>=31) limit=Bars-counted_bars-1;
for (shift=limit;shift>=0;shift--)
{
RSI[shift]=iRSI(NULL,0,RSIPeriod,PRICE_CLOSE,shift);
// ob = indicator_level1;
// os = indicator_level3;
ob = OverBoughtLevel;
os = OverSoldLevel;
// ========= Two-tone RSI
DnRSI[shift]=EMPTY_VALUE; UpRSI[shift]=EMPTY_VALUE;
if (RSI[shift]>BullZoneLevel)
{
DnRSI[shift]=EMPTY_VALUE; UpRSI[shift]=RSI[shift];
}
else
if (RSI[shift]<BearZoneLevel)
{
DnRSI[shift]=RSI[shift]; UpRSI[shift]=EMPTY_VALUE;
}
else
{
DnRSI[shift]=EMPTY_VALUE; UpRSI[shift]=EMPTY_VALUE;
}
// ========= Two-tone RSI Ends
// ========= Squeeze Signals
BBMA = iMA(NULL,0,BBPrd,0,MODE_SMA,PRICE_CLOSE,shift);
SBMA = iMA(NULL,0,SBPrd,0,MODE_EMA,PRICE_CLOSE,shift+SBShift);
TopBBand = iBands(NULL,0,BBPrd,BBDev,0,PRICE_CLOSE,MODE_UPPER,shift);
BotBBand = iBands(NULL,0,BBPrd,BBDev,0,PRICE_CLOSE,MODE_LOWER,shift);
TopSBand = SBMA + (SBFactor * iATR(NULL,0,SBATRPrd,shift+SBShift));
BotSBand = SBMA - (SBFactor * iATR(NULL,0,SBATRPrd,shift+SBShift));
TopBBandPrev = iBands(NULL,0,BBPrd,BBDev,0,PRICE_CLOSE,MODE_UPPER,shift+1);
BotBBandPrev = iBands(NULL,0,BBPrd,BBDev,0,PRICE_CLOSE,MODE_LOWER,shift+1);
if (TopBBand<TopSBand && BotBBand>BotSBand) Squeeze[shift]=50;
// ========= Squeeze Signals Ends
// ========= BB Breakout Signals
//if(Squeeze[shift+2]==50 && RSI[shift]>50 && BotBBand<BotSBand)
if((Squeeze[shift+2]==50 || Squeeze[shift+1]==50) && RSI[shift]>50 && BotBBand<BotSBand)
{
Buy[shift]=ob;
Sell[shift]=EMPTY_VALUE;
}
else
//if(Squeeze[shift+2]==50 && RSI[shift]<50 && TopBBand>TopSBand)
if((Squeeze[shift+2]==50 || Squeeze[shift+1]==50) && RSI[shift]<50 && TopBBand>TopSBand)
{
Buy[shift]=EMPTY_VALUE;
Sell[shift]=os;
}
else
if(Buy[shift+1]==ob && BotBBand<BotBBandPrev && RSI[shift]>50)
{
Buy[shift]=ob;
Sell[shift]=EMPTY_VALUE;
}
else
if(Sell[shift+1]==os && TopBBand>TopBBandPrev && RSI[shift]<50)
{
Buy[shift]=EMPTY_VALUE;
Sell[shift]=os;
}
else
{
Buy[shift]=EMPTY_VALUE;
Sell[shift]=EMPTY_VALUE;
}
// ========= BB Breakout Signals Ends
}
// ======= Alert =========
if(AlertOn)
{
if(prevtime == Time[0])
{
return(0);
}
prevtime = Time[0];
BuyNow = Buy[1];
BuyPrevious = Buy[2];
SellNow = Sell[1];
SellPrevious = Sell[2];
if((BuyNow ==ob) && (BuyPrevious ==EMPTY_VALUE) )
{
Alert("RSI TC: ",Symbol(), " M", Period(), " Buy Alert");
}
else
if((SellNow ==os) && (SellPrevious ==EMPTY_VALUE) )
{
Alert("RSI TC: ",Symbol(), " M", Period(), " Sell Alert");
}
IndicatorShortName("RSI("+RSIPeriod+") (Alert on)");
}
// ======= Alert Ends =========
return(0);
}
Comments