Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
tradermonty avatar

Market Top Detector

  • 887 installs
  • 2.5k repo stars
  • Updated July 26, 2026
  • tradermonty/claude-trading-skills

Market Top Detector is a Claude Code skill that applies William O'Neil distribution day and stalling day rules to S&P 500 and NASDAQ Composite data for developers and traders monitoring major index uptrend health.

About

Market Top Detector is an agent skill from tradermonty/claude-trading-skills encoding William O'Neil market-top detection from "How to Make Money in Stocks." A Distribution Day occurs when a major index (S&P 500 or NASDAQ Composite) declines by 0.2% or more on volume higher than the previous trading day, signaling institutional selling. Stalling day criteria complement distribution signals to judge uptrend pressure. Both price decline and volume conditions must be met for a valid distribution day reading. Developers and quantitative traders reach for Market Top Detector when building or running agent-assisted market regime checks that flag when a major index uptrend is under institutional distribution rather than relying on headline price moves alone.

  • Defines distribution days: index down ≥0.2% on higher volume than the prior session
  • Defines stalling days (higher volume, gain <0.1%) counted as 0.5 distribution days
  • 25-trading-day expiration window for distribution signals
  • Explicit exclusions: lower-volume declines and weak participation do not count
  • Interpretation table tying effective distribution count to recommended action

Market Top Detector by the numbers

  • 887 all-time installs (skills.sh)
  • +47 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #167 of 1,136 Finance & Trading skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/tradermonty/claude-trading-skills --skill market-top-detector

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs887
repo stars2.5k
Security audit2 / 3 scanners passed
Last updatedJuly 26, 2026
Repositorytradermonty/claude-trading-skills

How do you detect market tops using distribution days?

Apply William O’Neil-style distribution and stalling day rules to judge when a major index uptrend is under institutional selling pressure.

Who is it for?

Developers building trading analysis agents who apply William O'Neil distribution and stalling day rules to major US index data.

Skip if: Long-term passive investors or developers seeking fundamental valuation models unrelated to O'Neil volume-and-price distribution patterns.

When should I use this skill?

User asks to detect market tops, count distribution days, or apply William O'Neil stalling day rules on S&P 500 or NASDAQ data.

What you get

Distribution day and stalling day signals with index decline percentages and volume comparisons against prior sessions.

  • distribution day signal report
  • stalling day analysis

By the numbers

  • Distribution Day requires index decline >= 0.2% with volume above the previous trading day

Files

SKILL.mdMarkdownGitHub ↗

Market Top Detector Skill

Purpose

Detect the probability of a market top formation using a quantitative 6-component scoring system (0-100). Integrates three proven market top detection methodologies:

1. O'Neil - Distribution Day accumulation (institutional selling) 2. Minervini - Leading stock deterioration pattern 3. Monty - Defensive sector rotation signal

Unlike the Bubble Detector (macro/multi-month evaluation), this skill focuses on tactical 2-8 week timing signals that precede 10-20% market corrections.

When to Use This Skill

English:

  • User asks "Is the market topping?" or "Are we near a top?"
  • User notices distribution days accumulating
  • User observes defensive sectors outperforming growth
  • User sees leading stocks breaking down while indices hold
  • User asks about reducing equity exposure timing
  • User wants to assess correction probability for the next 2-8 weeks

Japanese:

  • 「天井が近い?」「今は利確すべき?」
  • ディストリビューションデーの蓄積を懸念
  • ディフェンシブセクターがグロースをアウトパフォーム
  • 先導株が崩れ始めているが指数はまだ持ちこたえている
  • エクスポージャー縮小のタイミング判断
  • 今後2〜8週間の調整確率を評価したい

Prerequisites

Required:

  • FMP API Key: Set $FMP_API_KEY environment variable or pass --api-key. Free tier sufficient (~33 API calls per execution).
  • WebSearch Access: Required to collect S&P 500 breadth (50DMA %) and CBOE Put/Call ratio data.

Optional:

  • Margin Debt Data: Enhances sentiment scoring but typically 1-2 months lagged.
  • VIX Term Structure: Auto-detected from FMP API if VIX3M quote available; manual override via --vix-term.

Data Freshness: All manually collected data should be from the most recent 3 business days for accurate analysis.

Difference from Bubble Detector

AspectMarket Top DetectorBubble Detector
Timeframe2-8 weeksMonths to years
Target10-20% correctionBubble collapse (30%+)
MethodologyO'Neil/Minervini/MontyMinsky/Kindleberger
DataPrice/Volume + BreadthValuation + Sentiment + Social
Score Range0-100 composite0-15 points

---

Execution Workflow

Phase 1: Data Collection via WebSearch

Before running the Python script, collect the following data using WebSearch. Data Freshness Requirement: All data must be from the most recent 3 business days. Stale data degrades analysis quality.

1. S&P 500 Breadth (200DMA above %)
   AUTO-FETCHED from TraderMonty CSV (no WebSearch needed)
   The script fetches this automatically from GitHub Pages CSV data.
   Override: --breadth-200dma [VALUE] to use a manual value instead.
   Disable: --no-auto-breadth to skip auto-fetch entirely.

2. [REQUIRED] S&P 500 Breadth (50DMA above %)
   Valid range: 20-100
   Primary search: "S&P 500 percent stocks above 50 day moving average"
   Fallback: "market breadth 50dma site:barchart.com"
   Direct fallback when search snippets are poor: fetch `https://www.barchart.com/stocks/quotes/$S5FI/overview` and extract the embedded `lastPrice` / `tradeTime` for “S&P 500 Stocks Above 50-Day Average”.
   Record the data date

3. [REQUIRED] CBOE Equity Put/Call Ratio
   Valid range: 0.30-1.50
   Primary search: "CBOE equity put call ratio today"
   Fallback: "CBOE total put call ratio current"
   Fallback: "put call ratio site:cboe.com"
   Direct fallback when Cboe CSV endpoints are stale: fetch `https://ycharts.com/indicators/cboe_equity_put_call_ratio` and parse the “Last Value” / “Latest Period” table fields. Treat this as a secondary source and cite it in freshness notes.
   Record the data date

4. [OPTIONAL] VIX Term Structure
   Values: steep_contango / contango / flat / backwardation
   Primary search: "VIX VIX3M ratio term structure today"
   Fallback: "VIX futures term structure contango backwardation"
   Note: Auto-detected from FMP API if VIX3M quote available.
   CLI --vix-term overrides auto-detection.

5. [OPTIONAL] Margin Debt YoY %
   Primary search: "FINRA margin debt latest year over year percent"
   Fallback: "NYSE margin debt monthly"
   Note: Typically 1-2 months lagged. Record the reporting month.

Phase 2: Execute Python Script

Run the script with collected data as CLI arguments:

python3 skills/market-top-detector/scripts/market_top_detector.py \
  --api-key $FMP_API_KEY \
  --breadth-50dma [VALUE] --breadth-50dma-date [YYYY-MM-DD] \
  --put-call [VALUE] --put-call-date [YYYY-MM-DD] \
  --vix-term [steep_contango|contango|flat|backwardation] \
  --margin-debt-yoy [VALUE] --margin-debt-date [YYYY-MM-DD] \
  --output-dir reports/ \
  --context "Consumer Confidence=[VALUE]" "Gold Price=[VALUE]"
# 200DMA breadth is auto-fetched from TraderMonty CSV.
# Override with --breadth-200dma [VALUE] if needed.
# Disable with --no-auto-breadth to skip auto-fetch.

The script will: 1. Fetch S&P 500, QQQ, VIX quotes and history from FMP API 2. Fetch Leading ETF (ARKK, WCLD, IGV, XBI, SOXX, SMH, KWEB, TAN) data 3. Fetch Sector ETF (XLU, XLP, XLV, VNQ, XLK, XLC, XLY) data 4. Calculate all 6 components 5. Generate composite score and reports

Phase 3: Present Results

Present the generated Markdown report to the user, highlighting:

  • Composite score and risk zone
  • Data freshness warnings (if any data older than 3 days)
  • Strongest warning signal (highest component score)
  • Historical comparison (closest past top pattern)
  • What-if scenarios (sensitivity to key changes)
  • Recommended actions based on risk zone
  • Follow-Through Day status (if applicable)
  • Delta vs previous run (if prior report exists)

---

6-Component Scoring System

#ComponentWeightData SourceKey Signal
1Distribution Day Count25%FMP APIInstitutional selling in last 25 trading days
2Leading Stock Health20%FMP APIGrowth ETF basket deterioration
3Defensive Sector Rotation15%FMP APIDefensive vs Growth relative performance
4Market Breadth Divergence15%Auto (CSV) + WebSearch200DMA (auto) / 50DMA (WebSearch) breadth vs index level
5Index Technical Condition15%FMP APIMA structure, failed rallies, lower highs
6Sentiment & Speculation10%FMP + WebSearchVIX, Put/Call, term structure

Risk Zone Mapping

ScoreZoneRisk BudgetAction
0-20Green (Normal)100%Normal operations
21-40Yellow (Early Warning)80-90%Tighten stops, reduce new entries
41-60Orange (Elevated Risk)60-75%Profit-taking on weak positions
61-80Red (High Probability Top)40-55%Aggressive profit-taking
81-100Critical (Top Formation)20-35%Maximum defense, hedging

---

API Requirements

Required: FMP API key (free tier sufficient: ~33 calls per execution) Optional: WebSearch data for breadth and sentiment (improves accuracy)

Output Files

  • JSON: market_top_YYYY-MM-DD_HHMMSS.json
  • Markdown: market_top_YYYY-MM-DD_HHMMSS.md

Reference Documents

references/market_top_methodology.md

  • Full methodology with O'Neil, Minervini, and Monty frameworks
  • Component scoring details and thresholds
  • Historical validation notes

references/distribution_day_guide.md

  • Detailed O'Neil Distribution Day rules
  • Stalling day identification
  • Follow-Through Day (FTD) mechanics

references/historical_tops.md

  • Analysis of 2000, 2007, 2018, 2022 market tops
  • Component score patterns during historical tops
  • Lessons learned and calibration data

When to Load References

  • First use: Load market_top_methodology.md for full framework understanding
  • Distribution day questions: Load distribution_day_guide.md
  • Historical context: Load historical_tops.md
  • Regular execution: References not needed - script handles scoring

Related skills

FAQ

What defines a Distribution Day in Market Top Detector?

Market Top Detector defines a Distribution Day when a major index (S&P 500 or NASDAQ Composite) declines by 0.2% or more from the previous session's close AND volume exceeds the previous day's volume. Both criteria must be met.

Which indexes does Market Top Detector analyze?

Market Top Detector applies William O'Neil distribution and stalling day rules to major stock indexes, specifically the S&P 500 and NASDAQ Composite. The skill judges whether an uptrend faces institutional selling pressure.

Is Market Top Detector safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.