OPEN-SOURCE SCRIPT
RSI Pattern Matcher & Forward Projection

RSI Pattern Matcher & Forward Projection is an advanced RSI-based analysis tool
that combines historical pattern matching, statistical forward projection,
Bollinger Bands, and an EMA overlay — all applied directly on the RSI panel.
Instead of using RSI as a simple overbought/oversold indicator, this script
treats the RSI as a pattern signal. It scans hundreds of historical bars to find
past moments where RSI behavior and price direction closely matched the current
market structure, then statistically projects what RSI is most likely to do next.
### How It Works
The indicator builds a fingerprint of the current market using the last N bars
(Pattern Length), capturing:
- RSI value for each bar in the window
- Price direction per bar (rising, falling, or flat)
It then scans the full lookback window and marks a historical bar as a match when:
- Each RSI value falls within the defined tolerance (e.g. ±4 points per bar)
- At least 60% of the price direction steps align with the current pattern
Once matches are collected, the script averages what happened to RSI over the
following bars after each match. This averaged path is rendered as a step-by-step
dashed projection line extending to the right of the last bar.
Bollinger Bands (length 14, multiplier 2.0) and EMA 12 are computed on the RSI
itself — not on price. Both indicators are also extended forward by the same
projection length using linear slope extrapolation, giving a complete forward
context for the RSI forecast.
### What It Displays
RSI Line — main aqua line (standard RSI)
RSI EMA 12 — orange line tracking the short-term RSI average; crossovers
signal early momentum shifts
Bollinger Bands on RSI:
• Yellow middle band (SMA 14)
• Red upper band (overbought pressure zone)
• Green lower band (oversold pressure zone)
• Gray fill between bands
Forward Projection (dashed lines extending beyond last bar):
• RSI forecast path — averaged from historical analogs, color-coded by zone
• BB Upper extension — red dashed
• BB Lower extension — green dashed
• BB Basis extension — yellow dashed
• EMA 12 extension — orange dashed
Live RSI Label — current RSI value displayed next to the last bar,
color-coded in real time (red ≥ 70, green ≤ 30, aqua otherwise)
Forecast Label — projected RSI value shown at the end of the forward window
Info Table (top right):
• Matches found vs maximum
• Dominant directional bias (Up / Down / Flat)
• Direction distribution percentages
• Average, best-case, and worst-case price change across all matches
• Estimated RSI value N bars ahead
• Confidence score based on match count
### Confidence Score
≥ 10 matches → 90%
≥ 7 matches → 75%
≥ 5 matches → 60%
≥ 3 matches → 40%
< 3 matches → 20%
A warning is displayed on the table when fewer than 3 matches are found.
In this case, increase RSI Tolerance or Lookback to find more historical analogs.
### Inputs
RSI Period — RSI calculation length (default: 14)
RSI Source — price input for RSI (default: close)
Pattern Length — bars used to build the current pattern fingerprint (2–20, default: 3)
Projection Length — bars ahead to project all forward lines (1–20, default: 3)
RSI Tolerance — max RSI difference per bar allowed when matching (±0.5–10, default: ±4.0)
Lookback — historical bars to scan for matches (50–999, default: 500)
Max Matches — maximum historical matches to average (3–20, default: 10)
### How To Use
1. Add the indicator to any chart — it plots on a separate RSI panel
2. Check the info table for match count; if below 3, raise RSI Tolerance or Lookback
3. Read the dominant direction and confidence score for a quick bias assessment
4. Follow the dashed projection line to see where RSI is historically likely to go
5. Use the extended BB bands to anticipate whether RSI may reach overbought or
oversold territory within the projection window
6. Watch the EMA extension — if the projected RSI crosses above or below the
extended EMA, it can signal a momentum shift ahead
7. Compare the forecast RSI label against the 70 and 30 levels for reversal context
8. Use best-case and worst-case % change figures to frame risk/reward expectations
9. Higher timeframes (1H, 4H, Daily) generally produce cleaner RSI patterns
and more meaningful matches
### Best Used For
- Anticipating RSI direction before price confirms
- Identifying overbought/oversold exhaustion using historical analogs
- Spotting early momentum shifts via RSI EMA crossovers
- Using BB band position to contextualize RSI extremes
- Filtering trade entries with forward projection confluence
- Multi-layer RSI analysis combining pattern matching, bands, and trend
### Originality
This script combines four independent analytical layers into a single RSI panel:
a historical analog pattern matcher, a statistical forward projection engine,
Bollinger Bands applied to RSI (not price), and a linear slope extrapolation
system for all forward indicators. The specific combination — simultaneous RSI
and price direction fingerprinting, 60% direction alignment threshold, per-bar
averaged projection, and slope-based BB/EMA extension — represents the author's
own approach to making RSI forecasting both visual and statistically grounded.
### Disclaimer
This indicator is for educational and analytical purposes only. Pattern matching
based on historical RSI behavior does not guarantee future results. Past analogs
may not repeat. Always apply proper risk management and combine this tool with
additional analysis before making any trading decisions.
Short Description:
Scans historical RSI and price direction patterns to project the most likely RSI
path forward. Includes Bollinger Bands and EMA on RSI, full forward extension of
all indicators, directional bias stats, and a confidence score.
that combines historical pattern matching, statistical forward projection,
Bollinger Bands, and an EMA overlay — all applied directly on the RSI panel.
Instead of using RSI as a simple overbought/oversold indicator, this script
treats the RSI as a pattern signal. It scans hundreds of historical bars to find
past moments where RSI behavior and price direction closely matched the current
market structure, then statistically projects what RSI is most likely to do next.
### How It Works
The indicator builds a fingerprint of the current market using the last N bars
(Pattern Length), capturing:
- RSI value for each bar in the window
- Price direction per bar (rising, falling, or flat)
It then scans the full lookback window and marks a historical bar as a match when:
- Each RSI value falls within the defined tolerance (e.g. ±4 points per bar)
- At least 60% of the price direction steps align with the current pattern
Once matches are collected, the script averages what happened to RSI over the
following bars after each match. This averaged path is rendered as a step-by-step
dashed projection line extending to the right of the last bar.
Bollinger Bands (length 14, multiplier 2.0) and EMA 12 are computed on the RSI
itself — not on price. Both indicators are also extended forward by the same
projection length using linear slope extrapolation, giving a complete forward
context for the RSI forecast.
### What It Displays
RSI Line — main aqua line (standard RSI)
RSI EMA 12 — orange line tracking the short-term RSI average; crossovers
signal early momentum shifts
Bollinger Bands on RSI:
• Yellow middle band (SMA 14)
• Red upper band (overbought pressure zone)
• Green lower band (oversold pressure zone)
• Gray fill between bands
Forward Projection (dashed lines extending beyond last bar):
• RSI forecast path — averaged from historical analogs, color-coded by zone
• BB Upper extension — red dashed
• BB Lower extension — green dashed
• BB Basis extension — yellow dashed
• EMA 12 extension — orange dashed
Live RSI Label — current RSI value displayed next to the last bar,
color-coded in real time (red ≥ 70, green ≤ 30, aqua otherwise)
Forecast Label — projected RSI value shown at the end of the forward window
Info Table (top right):
• Matches found vs maximum
• Dominant directional bias (Up / Down / Flat)
• Direction distribution percentages
• Average, best-case, and worst-case price change across all matches
• Estimated RSI value N bars ahead
• Confidence score based on match count
### Confidence Score
≥ 10 matches → 90%
≥ 7 matches → 75%
≥ 5 matches → 60%
≥ 3 matches → 40%
< 3 matches → 20%
A warning is displayed on the table when fewer than 3 matches are found.
In this case, increase RSI Tolerance or Lookback to find more historical analogs.
### Inputs
RSI Period — RSI calculation length (default: 14)
RSI Source — price input for RSI (default: close)
Pattern Length — bars used to build the current pattern fingerprint (2–20, default: 3)
Projection Length — bars ahead to project all forward lines (1–20, default: 3)
RSI Tolerance — max RSI difference per bar allowed when matching (±0.5–10, default: ±4.0)
Lookback — historical bars to scan for matches (50–999, default: 500)
Max Matches — maximum historical matches to average (3–20, default: 10)
### How To Use
1. Add the indicator to any chart — it plots on a separate RSI panel
2. Check the info table for match count; if below 3, raise RSI Tolerance or Lookback
3. Read the dominant direction and confidence score for a quick bias assessment
4. Follow the dashed projection line to see where RSI is historically likely to go
5. Use the extended BB bands to anticipate whether RSI may reach overbought or
oversold territory within the projection window
6. Watch the EMA extension — if the projected RSI crosses above or below the
extended EMA, it can signal a momentum shift ahead
7. Compare the forecast RSI label against the 70 and 30 levels for reversal context
8. Use best-case and worst-case % change figures to frame risk/reward expectations
9. Higher timeframes (1H, 4H, Daily) generally produce cleaner RSI patterns
and more meaningful matches
### Best Used For
- Anticipating RSI direction before price confirms
- Identifying overbought/oversold exhaustion using historical analogs
- Spotting early momentum shifts via RSI EMA crossovers
- Using BB band position to contextualize RSI extremes
- Filtering trade entries with forward projection confluence
- Multi-layer RSI analysis combining pattern matching, bands, and trend
### Originality
This script combines four independent analytical layers into a single RSI panel:
a historical analog pattern matcher, a statistical forward projection engine,
Bollinger Bands applied to RSI (not price), and a linear slope extrapolation
system for all forward indicators. The specific combination — simultaneous RSI
and price direction fingerprinting, 60% direction alignment threshold, per-bar
averaged projection, and slope-based BB/EMA extension — represents the author's
own approach to making RSI forecasting both visual and statistically grounded.
### Disclaimer
This indicator is for educational and analytical purposes only. Pattern matching
based on historical RSI behavior does not guarantee future results. Past analogs
may not repeat. Always apply proper risk management and combine this tool with
additional analysis before making any trading decisions.
Short Description:
Scans historical RSI and price direction patterns to project the most likely RSI
path forward. Includes Bollinger Bands and EMA on RSI, full forward extension of
all indicators, directional bias stats, and a confidence score.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.