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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.