Market Top Detection and Capital Protection System
Before we begin this post,
A huge tribute to Indian Armed Forces which are protecting our country

Overview
This system aims to:
-
Identify Market Tops: Detect when the market might reverse from an uptrend.
-
Protect Capital: Exit positions using indicator-based signals and a stop-loss.
It combines trend-following, momentum, and overbought indicators with risk management:
-
10-week and 20-week EMAs: To track the trend.
-
MACD: To confirm momentum shifts.
-
RSI: To spot overbought conditions.
-
ATR-based Stop-Loss: To limit downside risk.
Strategy Rules
-
Entry (Long Position):
-
10-week EMA > 20-week EMA (uptrend).
-
MACD line > signal line (bullish momentum).
-
-
Exit (Close Position):
-
10-week EMA < 20-week EMA (trend reversal).
-
AND either:
-
MACD line < signal line (bearish momentum), OR
-
RSI > 70 (overbought).
-
-
-
Stop-Loss:
- Set at 2x ATR below the entry price, calculated at entry.
How It Works
-
Entry: You enter a long position when the market shows a strong uptrend confirmed by both EMA and MACD.
-
Exit: You exit when a potential market top is signaled by an EMA crossover, with confirmation from MACD or RSI.
-
Risk Management: The ATR-based stop-loss protects against sudden drops, adapting to market volatility.
TradingView Pine Script Code
Here’s the code you can copy and paste into TradingView’s Pine Editor. Apply it to a weekly chart to test or use it directly.

No pictures at end this week, but a glimpse into India’s evolving defence capabilities
Jai Hind