OPEN-SOURCE SCRIPT
EMA Ribbon + Smoothed RSI Trend Strategy

EMA Ribbon Trend Filter + Smoothed RSI Entry Strategy
BEST IS 1/1RR
Overview
This strategy combines a moving-average trend filter with a smoothed RSI trigger to time entries in the direction of an established trend, with stop-loss levels placed at real market structure rather than a fixed distance.
How it works
1. Trend Filter (Ribbon)
An EMA(10) and EMA(20) are plotted on the chart. The strategy only considers trades when EMA(10) is above EMA(20) — treated here as confirmation of underlying bullish structure. Two additional SMAs (20/50) are plotted alongside for visual context but aren't part of the trade logic.
2. Entry Trigger — Smoothed RSI
Rather than using raw RSI, this script smooths RSI(21) with a 50-period SMA. That smoothed line is the actual decision value:
Crosses above 51 → long signal
Crosses below 49 → short signal
Smoothing the RSI this way filters out a lot of the noise a raw RSI produces, at the cost of some lag.
3. Structure-Based Stop Loss
Instead of a fixed pip/point stop, SL is placed at the nearest swing low (for longs) or swing high (for shorts) over a configurable lookback window, plus a small buffer. Take-profit is set as a configurable risk:reward multiple of that stop distance.
4. Trade Visualization
Every trade taken draws two boxes on the chart: a green "profit zone" from entry to TP, and a red "risk zone" from entry to SL. These extend in real time while the trade is open, so you can see the live risk/reward geometry of each position at a glance.
5. Non-Repainting
Signals only evaluate on confirmed, closed bars (barstate.isconfirmed), so what you see in the backtest is what would have fired in real time — no mid-bar flip-flopping.
Inputs
EMA/SMA ribbon lengths (default 10/20/20/50)
RSI length and smoothing length (default 21 / 50)
Buy/sell trigger levels (default 51 / 49)
Cross-only trigger toggle
Swing lookback, SL buffer, minimum SL distance
Risk:reward ratio 1/1 IS BEST
Box colors and visibility toggle
Optional date range filter for backtesting
Alerts
Built-in alertcondition() calls for both long and short signals, ready to connect to a webhook or notification service if you want to act on signals outside of TradingView.
⚠️ Disclaimer: This script is provided for educational and informational purposes only. Past performance shown in backtests does not guarantee future results. Backtest results can be affected by commission/slippage assumptions and do not account for real-world execution factors such as liquidity and order rejection. This is not financial advice — use proper risk management and test thoroughly before trading with real capital.
BEST IS 1/1RR
Overview
This strategy combines a moving-average trend filter with a smoothed RSI trigger to time entries in the direction of an established trend, with stop-loss levels placed at real market structure rather than a fixed distance.
How it works
1. Trend Filter (Ribbon)
An EMA(10) and EMA(20) are plotted on the chart. The strategy only considers trades when EMA(10) is above EMA(20) — treated here as confirmation of underlying bullish structure. Two additional SMAs (20/50) are plotted alongside for visual context but aren't part of the trade logic.
2. Entry Trigger — Smoothed RSI
Rather than using raw RSI, this script smooths RSI(21) with a 50-period SMA. That smoothed line is the actual decision value:
Crosses above 51 → long signal
Crosses below 49 → short signal
Smoothing the RSI this way filters out a lot of the noise a raw RSI produces, at the cost of some lag.
3. Structure-Based Stop Loss
Instead of a fixed pip/point stop, SL is placed at the nearest swing low (for longs) or swing high (for shorts) over a configurable lookback window, plus a small buffer. Take-profit is set as a configurable risk:reward multiple of that stop distance.
4. Trade Visualization
Every trade taken draws two boxes on the chart: a green "profit zone" from entry to TP, and a red "risk zone" from entry to SL. These extend in real time while the trade is open, so you can see the live risk/reward geometry of each position at a glance.
5. Non-Repainting
Signals only evaluate on confirmed, closed bars (barstate.isconfirmed), so what you see in the backtest is what would have fired in real time — no mid-bar flip-flopping.
Inputs
EMA/SMA ribbon lengths (default 10/20/20/50)
RSI length and smoothing length (default 21 / 50)
Buy/sell trigger levels (default 51 / 49)
Cross-only trigger toggle
Swing lookback, SL buffer, minimum SL distance
Risk:reward ratio 1/1 IS BEST
Box colors and visibility toggle
Optional date range filter for backtesting
Alerts
Built-in alertcondition() calls for both long and short signals, ready to connect to a webhook or notification service if you want to act on signals outside of TradingView.
⚠️ Disclaimer: This script is provided for educational and informational purposes only. Past performance shown in backtests does not guarantee future results. Backtest results can be affected by commission/slippage assumptions and do not account for real-world execution factors such as liquidity and order rejection. This is not financial advice — use proper risk management and test thoroughly before trading with real capital.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。