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.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.