New to Claude Skills? Learn how to install them →

tradermonty on GitHub

IBD Distribution Day Monitor

Free

Monitor market trends with IBD-style signals.

Get this skill

Free · Opens the source repo

What IBD Distribution Day Monitor does

The IBD Distribution Day Monitor is a Python-based tool designed for investors and traders who follow IBD (Investor's Business Daily) principles. This skill focuses on detecting Distribution Days for major market ETFs, specifically QQQ and SPY, which are proxies for the Nasdaq and S&P 500 indices, respectively. It provides a daily signal indicating market deterioration and offers recommendations for TQQQ/QQQ exposure based on the detected conditions. The skill is intended for use after the market closes, allowing users to analyze market behavior and adjust their strategies accordingly.

This tool operates by analyzing the closing prices and trading volumes of the specified ETFs. A Distribution Day is identified when the current day's close is at least 0.2% lower than the previous day's close, coupled with higher trading volume. The skill tracks the number of active Distribution Days and classifies overall market risk into categories such as NORMAL, CAUTION, HIGH, and SEVERE. These classifications help users gauge the market's health and make informed decisions about their exposure to leveraged positions like TQQQ.

The IBD Distribution Day Monitor also integrates with the FMP API to fetch historical price data, ensuring accurate calculations and risk assessments. Users can customize inputs such as the symbols to monitor and the lookback period for analysis. The skill generates detailed reports in JSON and Markdown formats, providing insights into the market's condition and the rationale behind exposure recommendations. This makes it a valuable tool for traders looking to adhere to disciplined investment strategies based on IBD methodologies.

Overall, this skill is well-suited for active traders and investors who want to incorporate systematic risk management into their trading practices. It is not intended for executing trades directly but rather for informing trading decisions based on established IBD rules.

When to use it

Use this skill daily after the market closes to evaluate market conditions and adjust TQQQ exposure.

When not to use it

Do not use this skill for executing trades or making discretionary predictions outside of IBD guidelines.

What you can build with it

Daily Market Review

Run this skill after market close to assess the day's performance and determine if adjustments to TQQQ exposure are needed.

Risk Management

Utilize the risk classification output to inform your trading strategy and manage exposure to leveraged ETFs.

Backtesting Strategies

Use the `--as-of` option to backtest against historical sessions and evaluate past market conditions.

How to install IBD Distribution Day Monitor

View source

1. Install with the skills CLI

npx skills add tradermonty/claude-trading-skills/ibd-distribution-day-monitor --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by tradermonty

IBD Distribution Day Monitor

Purpose

Detect IBD-style Distribution Days for major market ETFs (QQQ as Nasdaq proxy, SPY as S&P 500 proxy) and produce a daily market deterioration signal plus a TQQQ/QQQ exposure recommendation. Designed for post-market review.

When to Use

Invoke this skill:

  • Daily after the US market close.
  • Before increasing TQQQ exposure or rebalancing leveraged positions.
  • When evaluating whether an uptrend is becoming vulnerable to a correction.
  • As an upstream input to FTD (Follow-Through Day) detection or other market-state frameworks.

Do NOT use this skill to:

  • Execute trades or modify orders.
  • Generate discretionary market predictions outside of the IBD ruleset.

Inputs

  • Symbols (default: QQQ, SPY) and lookback (default 80 trading sessions).
  • Optional --as-of YYYY-MM-DD for backtesting against a historical session.
  • Strategy context: instrument (TQQQ or QQQ), current exposure %, base trailing stop %.
  • FMP API key via --api-key, config.data.api_key, or FMP_API_KEY env var (in that priority order).

Core Rules

A Distribution Day is detected when:

  1. Today's close is at least 0.2% below yesterday's close.
  2. Today's volume is greater than yesterday's volume.

A Distribution Day is removed from the active count when either:

  • More than 25 trading sessions have elapsed since the DD.
  • The index has gained 5% from the DD close (using post-DD high by default; configurable to close-source).

Today's DD is never invalidated immediately because there are no post-DD sessions to evaluate the 5% gain against.

Counting Conventions

  • d5_count / d15_count / d25_count count active records with age_sessions <= N.
  • This means N+1 sessions are inspected (age 0..N inclusive). Reports therefore say "within N elapsed sessions" rather than "直近 N 取引日" to avoid ambiguity.

Risk Classification

RiskTrigger
NORMALd25 <= 2
CAUTIONd25 >= 3
HIGHd25 >= 5 OR d15 >= 3 OR d5 >= 2
SEVEREd25 >= 6 OR d15 >= 4 OR (market_below_21ema_or_50ma AND d25 >= 5)

When both QQQ and SPY are loaded, QQQ-weighted overall logic applies (TQQQ-aware): a single SEVERE escalates to SEVERE; QQQ HIGH escalates to overall HIGH; QQQ NORMAL + SPY HIGH still escalates to HIGH (broad-market spillover).

TQQQ Exposure Policy

RiskActionTarget ExposureTrailing Stop
NORMALHOLD_OR_FOLLOW_BASE_STRATEGY100%base
CAUTIONAVOID_NEW_ADDS75%min(base, 7%)
HIGHREDUCE_EXPOSURE50%min(base, 5%)
SEVERECLOSE_TQQQ_OR_HEDGE25%min(base, 3%)

QQQ uses a less aggressive policy (HIGH=75%, SEVERE=50%) since it lacks 3x leverage.

Workflow

  1. Load OHLCV for the configured symbols via FMP (get_historical_prices).
  2. Validate data quality; record skipped sessions in audit.
  3. Rebase via prepare_effective_history so effective_history[0] is the evaluation session.
  4. Detect raw Distribution Days; enrich with high_since, invalidation event, and status.
  5. Count d5 / d15 / d25 active records.
  6. Compute 21EMA and 50SMA filters; flag market_below_21ema_or_50ma (None if data insufficient).
  7. Classify each index, then combine using QQQ-weighted policy.
  8. Generate portfolio action for the configured instrument.
  9. Write JSON + Markdown reports to --output-dir with API keys redacted.

Outputs

Saved to reports/ (or --output-dir):

  • ibd_distribution_day_monitor_YYYY-MM-DD_HHMMSS.json
  • ibd_distribution_day_monitor_YYYY-MM-DD_HHMMSS.md

JSON is UTF-8 with ensure_ascii=False (Japanese explanations preserved). Sensitive keys (api_key, fmp_api_key, token, etc.) are redacted automatically.

Operating Principles

  • Do not override the IBD rule definitions unless config/default.yaml is changed deliberately.
  • Always explain which dates contributed to the active count.
  • Treat missing or unreliable volume data as a warning (audit_flag), not as a Distribution Day.
  • Do not place trades. The portfolio action is a risk-management suggestion, not an execution instruction.

CLI

python3 skills/ibd-distribution-day-monitor/scripts/ibd_monitor.py \
  --symbols QQQ,SPY \
  --lookback-days 80 \
  --instrument TQQQ \
  --current-exposure 100 \
  --base-trailing-stop 10 \
  --output-dir reports/

API Requirements

FMP API key required. Free tier (250 calls/day) is sufficient for daily QQQ + SPY runs.

Related Skills

  • ftd-detector: Bottom confirmation via Follow-Through Days (counterpart of this top-side signal).
  • market-top-detector: Composite 0-100 top probability score using O'Neil distribution + other components.
  • position-sizer: Convert risk-management recommendations into share counts.

Frequently asked questions about IBD Distribution Day Monitor

Similar skills