OPEN-SOURCE SCRIPT
RSI MA Cross + Divergence Signal (fixed)

🔹 Core Logic
RSI + Moving Average
The script calculates a standard RSI (default 14).
It then overlays a moving average (SMA/EMA/WMA, default 9).
When RSI crosses above its MA → bullish momentum.
When RSI crosses below its MA → bearish momentum.
Divergence Filter
Signals are only valid if there’s confirmed divergence:
Bullish divergence: Price makes a lower low, RSI makes a higher low.
Bearish divergence: Price makes a higher high, RSI makes a lower high.
Overbought / Oversold Filter
Optional extra:
Bullish signals only valid if RSI ≤ 30 (oversold).
Bearish signals only valid if RSI ≥ 70 (overbought).
This ensures signals happen in “stretched” conditions.
Risk & Trade Management
Entries taken only when all conditions align.
Exits can be managed with ATR stops, partial take-profits, breakeven moves, and trailing stops (we coded these in the strategy version).
Cooldown, session filters, and daily loss guard to keep risk tight.
🔹 Strengths
✅ High selectivity: Combining RSI cross + divergence + OB/OS means signals are rare but higher quality.
✅ Great at catching reversals: Divergence highlights where price may be running out of steam.
✅ Risk management baked in: ATR stops + partial exits smooth out equity curve.
✅ Works across markets: ES, FX, crypto — anywhere RSI divergences are respected.
✅ Flexible: You can loosen/tighten filters depending on aggressiveness.
🔹 Weaknesses
❌ Lag from pivots: Divergence only confirms after a few bars → you enter late sometimes.
❌ Choppy in ranges: In sideways markets, RSI divergences appear often and whipsaw.
❌ Filters reduce signals: With all filters ON (divergence + OB/OS + trend + session), signals can be very rare — may under-trade.
❌ Not standalone: Needs higher-timeframe context (trend, liquidity pools) to avoid counter-trend entries.
🔹 Best Ways to Trade It
Use Higher Timeframe Bias
Run the strategy on 15m/1H, but only trade in direction of higher timeframe trend (e.g., 4H EMA).
Example: If daily is bullish → only take bullish divergences.
Pair With Structure
Look for signals at key zones: HTF support/resistance, VWAP, or FVGs.
Divergence + RSI cross inside an FVG is a strong entry trigger.
Adjust OB/OS for Volatility
For crypto/FX: use 35/65 instead of 30/70 (markets trend harder).
For ES/S&P: 30/70 works fine.
Risk Management Is King
Use partial exits: take profit at 1R, trail rest.
Size by % of equity (we coded this into the strategy).
Avoid News Spikes
Divergences break down around CPI, NFP, Fed announcements — stay flat.
🔹 When It Shines
Trending markets that make extended pushes → clean divergences.
Reversal zones (oversold → bullish bounce, overbought → bearish fade).
Swing trading (15m–4H) — less noise than 1m/5m scalping.
🔹 When to Avoid
Low volatility chop → lots of false divergences.
During high-impact news → RSI swings wildly.
In strong one-way trends without pullbacks — divergence keeps calling tops/bottoms too early.
✅ Summary:
This is a reversal-focused RSI divergence strategy with strict filters. It’s powerful when combined with higher-timeframe bias + structure confluence, but weak if traded blindly in choppy or news-driven conditions. Best to treat it as a precision entry trigger, not a full system — layer it on top of your FVG/ORB framework for maximum edge.
RSI + Moving Average
The script calculates a standard RSI (default 14).
It then overlays a moving average (SMA/EMA/WMA, default 9).
When RSI crosses above its MA → bullish momentum.
When RSI crosses below its MA → bearish momentum.
Divergence Filter
Signals are only valid if there’s confirmed divergence:
Bullish divergence: Price makes a lower low, RSI makes a higher low.
Bearish divergence: Price makes a higher high, RSI makes a lower high.
Overbought / Oversold Filter
Optional extra:
Bullish signals only valid if RSI ≤ 30 (oversold).
Bearish signals only valid if RSI ≥ 70 (overbought).
This ensures signals happen in “stretched” conditions.
Risk & Trade Management
Entries taken only when all conditions align.
Exits can be managed with ATR stops, partial take-profits, breakeven moves, and trailing stops (we coded these in the strategy version).
Cooldown, session filters, and daily loss guard to keep risk tight.
🔹 Strengths
✅ High selectivity: Combining RSI cross + divergence + OB/OS means signals are rare but higher quality.
✅ Great at catching reversals: Divergence highlights where price may be running out of steam.
✅ Risk management baked in: ATR stops + partial exits smooth out equity curve.
✅ Works across markets: ES, FX, crypto — anywhere RSI divergences are respected.
✅ Flexible: You can loosen/tighten filters depending on aggressiveness.
🔹 Weaknesses
❌ Lag from pivots: Divergence only confirms after a few bars → you enter late sometimes.
❌ Choppy in ranges: In sideways markets, RSI divergences appear often and whipsaw.
❌ Filters reduce signals: With all filters ON (divergence + OB/OS + trend + session), signals can be very rare — may under-trade.
❌ Not standalone: Needs higher-timeframe context (trend, liquidity pools) to avoid counter-trend entries.
🔹 Best Ways to Trade It
Use Higher Timeframe Bias
Run the strategy on 15m/1H, but only trade in direction of higher timeframe trend (e.g., 4H EMA).
Example: If daily is bullish → only take bullish divergences.
Pair With Structure
Look for signals at key zones: HTF support/resistance, VWAP, or FVGs.
Divergence + RSI cross inside an FVG is a strong entry trigger.
Adjust OB/OS for Volatility
For crypto/FX: use 35/65 instead of 30/70 (markets trend harder).
For ES/S&P: 30/70 works fine.
Risk Management Is King
Use partial exits: take profit at 1R, trail rest.
Size by % of equity (we coded this into the strategy).
Avoid News Spikes
Divergences break down around CPI, NFP, Fed announcements — stay flat.
🔹 When It Shines
Trending markets that make extended pushes → clean divergences.
Reversal zones (oversold → bullish bounce, overbought → bearish fade).
Swing trading (15m–4H) — less noise than 1m/5m scalping.
🔹 When to Avoid
Low volatility chop → lots of false divergences.
During high-impact news → RSI swings wildly.
In strong one-way trends without pullbacks — divergence keeps calling tops/bottoms too early.
✅ Summary:
This is a reversal-focused RSI divergence strategy with strict filters. It’s powerful when combined with higher-timeframe bias + structure confluence, but weak if traded blindly in choppy or news-driven conditions. Best to treat it as a precision entry trigger, not a full system — layer it on top of your FVG/ORB framework for maximum edge.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。