OPEN-SOURCE SCRIPT
업데이트됨 MA200 + RSI Pullback + Hard Close

A long-only swing-trading indicator that signals entries when an
uptrending stock pulls back to oversold levels — but only during a
confirmed bullish market regime. Force-exits all signals when SPY
breaks its 200-day MA ("hard close").
═══ RULES ═══
• Entry: Close > MA200 AND RSI(14) < 40 AND SPY > SPY MA200 AND VIX < 30
• Exit : RSI > 70 OR Close < MA200 OR 2×ATR(14) trailing stop
• Hard close: exit ALL signals when SPY < SPY MA200 (regime kill switch)
═══ BACKTEST (499 S&P 500 stocks, 2008–2025, 0.1% commission) ═══
• Sharpe ratio: 1.25
• CAGR: 18.6%
• Max drawdown: -17.2%
• Trades: 1,719
• Win rate: 45.8%
• Avg hold: 18.7 days
═══ WALK-FORWARD VALIDATION ═══
• In-sample (2008–2018) Sharpe: 1.59
• Out-of-sample (2018–2025) Sharpe: 1.11
• IS → OOS degradation: ~30% (acceptable; classic edges often degrade 50%+)
• The hard-close filter cuts max drawdown ~9pp vs. the same strategy
without it — and makes IS/OOS more consistent (less regime-dependent).
═══ HOW TO USE ═══
• Daily timeframe, one ticker at a time (S&P 500 large-caps work best)
• Green triangle below bar = LONG signal
• Red triangle above bar = EXIT signal
• Red background = hard-close regime active (SPY in downtrend)
• Status table top-right = current state at a glance
• Five alert conditions provided (entry, all four exits)
═══ WHY IT WORKS ═══
The MA200 filter avoids catching falling knives. RSI < 40 in an uptrend
catches institutional panic that mean-reverts. The market filter and
hard close prevent participation in broad bear markets where mean-
reversion edges break down (2008, 2020, 2022).
═══ HONEST CAVEATS ═══
• Past performance ≠ future results.
• Backtested with ~10bps round-trip costs; higher costs degrade results.
• This is an INDICATOR, not an auto-executing strategy.
• Tested on US large-caps only. Behavior on small-caps, international,
ETFs, or crypto is untested or shown to underperform.
Not financial advice. Trade your own account. DYOR.
uptrending stock pulls back to oversold levels — but only during a
confirmed bullish market regime. Force-exits all signals when SPY
breaks its 200-day MA ("hard close").
═══ RULES ═══
• Entry: Close > MA200 AND RSI(14) < 40 AND SPY > SPY MA200 AND VIX < 30
• Exit : RSI > 70 OR Close < MA200 OR 2×ATR(14) trailing stop
• Hard close: exit ALL signals when SPY < SPY MA200 (regime kill switch)
═══ BACKTEST (499 S&P 500 stocks, 2008–2025, 0.1% commission) ═══
• Sharpe ratio: 1.25
• CAGR: 18.6%
• Max drawdown: -17.2%
• Trades: 1,719
• Win rate: 45.8%
• Avg hold: 18.7 days
═══ WALK-FORWARD VALIDATION ═══
• In-sample (2008–2018) Sharpe: 1.59
• Out-of-sample (2018–2025) Sharpe: 1.11
• IS → OOS degradation: ~30% (acceptable; classic edges often degrade 50%+)
• The hard-close filter cuts max drawdown ~9pp vs. the same strategy
without it — and makes IS/OOS more consistent (less regime-dependent).
═══ HOW TO USE ═══
• Daily timeframe, one ticker at a time (S&P 500 large-caps work best)
• Green triangle below bar = LONG signal
• Red triangle above bar = EXIT signal
• Red background = hard-close regime active (SPY in downtrend)
• Status table top-right = current state at a glance
• Five alert conditions provided (entry, all four exits)
═══ WHY IT WORKS ═══
The MA200 filter avoids catching falling knives. RSI < 40 in an uptrend
catches institutional panic that mean-reverts. The market filter and
hard close prevent participation in broad bear markets where mean-
reversion edges break down (2008, 2020, 2022).
═══ HONEST CAVEATS ═══
• Past performance ≠ future results.
• Backtested with ~10bps round-trip costs; higher costs degrade results.
• This is an INDICATOR, not an auto-executing strategy.
• Tested on US large-caps only. Behavior on small-caps, international,
ETFs, or crypto is untested or shown to underperform.
Not financial advice. Trade your own account. DYOR.
릴리즈 노트
A long-only trend mean-reversion system for stocks. It buys qualitynames that are in an uptrend (price > 200-day MA) but temporarily
oversold (RSI < 40) — institutional panic that historically recovers.
Exits on RSI > 70, a close below the 200-MA, or a 2×ATR stop.
WHAT MAKES THIS DIFFERENT
This isn't a backtest fantasy. It was walk-forward validated:
parameters fit on 2008–2018, then tested untouched on 2018–2025.
The edge degraded ~30% out-of-sample — which is GOOD. A degradation
that small means the edge is real, not curve-fit. Most published
scripts hide their out-of-sample results. I lead with mine.
THE "HARD CLOSE" RULE
When SPY drops below its own 200-MA, the system closes everything
regardless of individual signals. This cut max drawdown from -25.9%
to -17.2% across 2008–2025 on the S&P 500 universe.
HONEST LIMITATIONS (rare on TV, I know)
• It's mean-reversion — it WILL catch some falling knives.
• Win rate is ~46%. The edge is in the asymmetry (avg win +8.2%
vs avg loss -3.9%), not in being right often.
• Tested on US large-caps. Don't assume it ports to crypto/forex.
• Backtest uses today's S&P 500 members (survivorship bias), so the
point-in-time numbers would be lower. The walk-forward DEGRADATION
is the honest signal here — not the absolute Sharpe.
HOW TO USE
Daily timeframe, one ticker at a time. The SPY-trend filter and the
VIX < 30 filter are toggles. The status table (top-right) shows
exactly which conditions are met right now.
Open-source under MPL 2.0 — read every line, change what you want.
If it earns a boost, it tells me the honest approach is worth
continuing. Comments welcome, especially critical ones.
릴리즈 노트
A long-only trend mean-reversion system for stocks. It buys qualitynames that are in an uptrend (price > 200-day MA) but temporarily
oversold (RSI < 40) — institutional panic that historically recovers.
Exits on RSI > 70, a close below the 200-MA, or a 2×ATR stop.
WHAT MAKES THIS DIFFERENT
This isn't a backtest fantasy. It was walk-forward validated:
parameters fit on 2008–2018, then tested untouched on 2018–2025.
The edge degraded ~30% out-of-sample — which is GOOD. A degradation
that small means the edge is real, not curve-fit. Most published
scripts hide their out-of-sample results. I lead with mine.
THE "HARD CLOSE" RULE
When SPY drops below its own 200-MA, the system closes everything
regardless of individual signals. This cut max drawdown from -25.9%
to -17.2% across 2008–2025 on the S&P 500 universe.
HONEST LIMITATIONS (rare on TV, I know)
• It's mean-reversion — it WILL catch some falling knives.
• Win rate is ~46%. The edge is in the asymmetry (avg win +8.2%
vs avg loss -3.9%), not in being right often.
• Tested on US large-caps. Don't assume it ports to crypto/forex.
• Backtest uses today's S&P 500 members (survivorship bias), so the
point-in-time numbers would be lower. The walk-forward DEGRADATION
is the honest signal here — not the absolute Sharpe.
HOW TO USE
Daily timeframe, one ticker at a time. The SPY-trend filter and the
VIX < 30 filter are toggles. The status table (top-right) shows
exactly which conditions are met right now.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.