OPEN-SOURCE SCRIPT
RSI Divergence + EMA Filter [Proozac]

RSI DIVERGENCE + EMA FILTER STRATEGY
A fully backtestable trading strategy that combines RSI divergences with an optional EMA trend filter to identify high-probability reversal entries while trading in the direction of the dominant trend.
I like to filter it in 5m and use it like its uploaded, that's my personal advice.
You will see good winrate in stocks and almost in any index.
The strategy automatically manages every position with ATR-based stop-loss and take-profit levels, with the option to use a trailing ATR stop instead of fixed exits.
FEATURES
RSI Divergence Detection
The strategy detects confirmed bullish and bearish RSI divergences using swing highs and swing lows.
• Bullish Divergence = Lower Low in price + Higher Low in RSI
• Bearish Divergence = Higher High in price + Lower High in RSI
An optional Overbought/Oversold filter can require divergences to begin from extreme RSI levels, reducing false signals.
EMA Trend Filter
When enabled:
• Long trades are only taken above the EMA.
• Short trades are only taken below the EMA.
This helps avoid taking reversal signals against the primary trend.
Risk Management
Every trade is managed automatically using ATR.
• ATR-based Stop Loss
• Configurable Risk:Reward Take Profit
• Optional ATR Trailing Stop
VISUALS
• Green Triangle = Bullish divergence
• Red Triangle = Bearish divergence
• Divergence lines connecting swing points
• Trend EMA
• LONG / SHORT entry labels
• Background color showing current position
ALERTS
• Long Entry
• Short Entry
INPUTS
RSI Settings
• RSI Length
• Pivot Left / Right Bars
• Overbought Level
• Oversold Level
• Optional OB/OS Filter
Trend Filter
• Enable/Disable EMA Filter
• EMA Length
Risk Management
• ATR Length
• ATR Stop Multiplier
• Risk:Reward Ratio
• Enable ATR Trailing Stop
• Trailing ATR Multiplier
Display
• Show Divergence Lines
• Show Entry Labels
SUGGESTED USE
This strategy performs best after optimizing the Pivot Left/Right settings for the instrument being tested. Lower values generate more signals with higher noise, while larger values produce fewer but stronger divergences.
The EMA trend filter is recommended to avoid trading against the dominant market direction.
The Overbought/Oversold filter further improves signal quality by requiring divergences to originate from extreme RSI conditions.
Always evaluate performance using the Strategy Tester and adjust commission, slippage and risk parameters to match your market and trading conditions.
A fully backtestable trading strategy that combines RSI divergences with an optional EMA trend filter to identify high-probability reversal entries while trading in the direction of the dominant trend.
I like to filter it in 5m and use it like its uploaded, that's my personal advice.
You will see good winrate in stocks and almost in any index.
The strategy automatically manages every position with ATR-based stop-loss and take-profit levels, with the option to use a trailing ATR stop instead of fixed exits.
FEATURES
RSI Divergence Detection
The strategy detects confirmed bullish and bearish RSI divergences using swing highs and swing lows.
• Bullish Divergence = Lower Low in price + Higher Low in RSI
• Bearish Divergence = Higher High in price + Lower High in RSI
An optional Overbought/Oversold filter can require divergences to begin from extreme RSI levels, reducing false signals.
EMA Trend Filter
When enabled:
• Long trades are only taken above the EMA.
• Short trades are only taken below the EMA.
This helps avoid taking reversal signals against the primary trend.
Risk Management
Every trade is managed automatically using ATR.
• ATR-based Stop Loss
• Configurable Risk:Reward Take Profit
• Optional ATR Trailing Stop
VISUALS
• Green Triangle = Bullish divergence
• Red Triangle = Bearish divergence
• Divergence lines connecting swing points
• Trend EMA
• LONG / SHORT entry labels
• Background color showing current position
ALERTS
• Long Entry
• Short Entry
INPUTS
RSI Settings
• RSI Length
• Pivot Left / Right Bars
• Overbought Level
• Oversold Level
• Optional OB/OS Filter
Trend Filter
• Enable/Disable EMA Filter
• EMA Length
Risk Management
• ATR Length
• ATR Stop Multiplier
• Risk:Reward Ratio
• Enable ATR Trailing Stop
• Trailing ATR Multiplier
Display
• Show Divergence Lines
• Show Entry Labels
SUGGESTED USE
This strategy performs best after optimizing the Pivot Left/Right settings for the instrument being tested. Lower values generate more signals with higher noise, while larger values produce fewer but stronger divergences.
The EMA trend filter is recommended to avoid trading against the dominant market direction.
The Overbought/Oversold filter further improves signal quality by requiring divergences to originate from extreme RSI conditions.
Always evaluate performance using the Strategy Tester and adjust commission, slippage and risk parameters to match your market and trading conditions.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.