Market Top Detection and Capital Protection System

Written by 1 min read

Before we begin this post,

A huge tribute to Indian Armed Forces which are protecting our country

Terror camps of Ajmal Kasab, David Headley destroyed to justice for  Pahalgam: 10 things govt said on Operation Sindoor
image source: The Indian Express

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.

Weekly S&P 500 chart with the Market Top Detector, 2022 to 2025, showing long entries and an exit signal near 18 Feb 2025 before a sharp fall

link to code

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

Jai Hind

Keep reading

New writing, by email

Free posts arrive in your inbox. Paid subscribers read new research six months before it comes to this site.

Subscribe