ibd-distribution-day-monitor
tradermonty/claude-trading-skills
Detect IBD Distribution Days on QQQ/SPY and recommend TQQQ/QQQ exposure adjustments based on market deterioration risk.
What is ibd-distribution-day-monitor?
Monitors for IBD-style Distribution Days (close down ≥0.2% on higher volume) on major indices, tracks their expiration and invalidation, and classifies overall market risk as NORMAL/CAUTION/HIGH/SEVERE. Use daily after market close to inform leveraged position sizing and rebalancing decisions.
- Detects Distribution Days when index closes ≥0.2% lower on higher volume than prior session
- Tracks active Distribution Days across 5, 15, and 25-session windows with automatic expiration and 5% gain invalidation
- Classifies market risk into four tiers (NORMAL/CAUTION/HIGH/SEVERE) based on Distribution Day counts and moving-average filters
- Generates TQQQ and QQQ exposure recommendations (100% down to 25%) with corresponding trailing-stop adjustments
- Produces JSON and Markdown reports with audit trails of skipped sessions and data quality flags
How to install ibd-distribution-day-monitor
npx skills add https://github.com/tradermonty/claude-trading-skills --skill ibd-distribution-day-monitor- FMP (Financial Modeling Prep) API key (free tier with 250 calls/day is sufficient)
- Python 3.7+ environment with skill installed via npx skills add
- Historical OHLCV data access for QQQ and SPY (provided via FMP API)
How to use ibd-distribution-day-monitor
- 1.Install the skill using: npx skills add https://github.com/tradermonty/claude-trading-skills --skill ibd-distribution-day-monitor
- 2.Obtain an FMP API key and set it via --api-key flag, config.data.api_key, or FMP_API_KEY environment variable
- 3.Run the monitor daily after market close with: 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
- 4.Review the generated JSON and Markdown reports in the output directory to see active Distribution Days, risk classification, and exposure recommendations
- 5.Use the risk tier and exposure target to inform position sizing decisions; do not execute trades directly from this skill
Use cases
- Review market deterioration daily after US market close before adjusting leveraged positions
- Evaluate whether an uptrend is becoming vulnerable to correction before adding TQQQ exposure
- Feed Distribution Day counts and risk classification into Follow-Through Day detection or broader market-state frameworks
- Backtest historical market conditions by specifying an as-of date to validate trading strategies
- Monitor broad-market spillover risk when both QQQ and SPY show elevated Distribution Day counts
- Traders managing leveraged ETF (TQQQ) positions who follow IBD market timing rules
- Quantitative analysts building multi-factor market-state detection systems
- Active investors evaluating when to reduce exposure during market deterioration phases
- Portfolio managers using technical distribution signals to inform risk management
ibd-distribution-day-monitor FAQ
A Distribution Day occurs when an index closes at least 0.2% lower than the previous close AND volume is higher than the previous day's volume. This signals institutional selling pressure.
A Distribution Day remains active for up to 25 trading sessions. It is removed earlier if the index gains 5% from the Distribution Day's close price, or if 25+ sessions have elapsed.
d5_count, d15_count, and d25_count track the number of active Distribution Days within the last 5, 15, and 25 trading sessions respectively. Higher counts indicate more recent or sustained selling pressure.
No. This skill only detects Distribution Days, classifies market risk, and recommends exposure targets. You must manually adjust positions or integrate the output into your own execution logic.
You can specify --symbols QQQ or --symbols SPY to monitor a single index. The risk classification and exposure recommendations will be based on that index alone.
Full instructions (SKILL.md)
Source of truth, from tradermonty/claude-trading-skills.
name: ibd-distribution-day-monitor description: Detect IBD-style Distribution Days for QQQ/SPY (close down at least 0.2% on higher volume), track 25-session expiration and 5% invalidation, count d5/d15/d25 clusters, classify market risk (NORMAL/CAUTION/HIGH/SEVERE), and emit TQQQ/QQQ exposure recommendations. Use after market close, before TQQQ exposure changes, or as input to FTD/market-state frameworks. Does not execute trades.
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-DDfor 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, orFMP_API_KEYenv var (in that priority order).
Core Rules
A Distribution Day is detected when:
- Today's close is at least 0.2% below yesterday's close.
- 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_countcount active records withage_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
| Risk | Trigger |
|---|---|
| NORMAL | d25 <= 2 |
| CAUTION | d25 >= 3 |
| HIGH | d25 >= 5 OR d15 >= 3 OR d5 >= 2 |
| SEVERE | d25 >= 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
| Risk | Action | Target Exposure | Trailing Stop |
|---|---|---|---|
| NORMAL | HOLD_OR_FOLLOW_BASE_STRATEGY | 100% | base |
| CAUTION | AVOID_NEW_ADDS | 75% | min(base, 7%) |
| HIGH | REDUCE_EXPOSURE | 50% | min(base, 5%) |
| SEVERE | CLOSE_TQQQ_OR_HEDGE | 25% | min(base, 3%) |
QQQ uses a less aggressive policy (HIGH=75%, SEVERE=50%) since it lacks 3x leverage.
Workflow
- Load OHLCV for the configured symbols via FMP (
get_historical_prices). - Validate data quality; record skipped sessions in audit.
- Rebase via
prepare_effective_historysoeffective_history[0]is the evaluation session. - Detect raw Distribution Days; enrich with
high_since, invalidation event, and status. - Count
d5/d15/d25active records. - Compute 21EMA and 50SMA filters; flag
market_below_21ema_or_50ma(None if data insufficient). - Classify each index, then combine using QQQ-weighted policy.
- Generate portfolio action for the configured instrument.
- Write JSON + Markdown reports to
--output-dirwith API keys redacted.
Outputs
Saved to reports/ (or --output-dir):
ibd_distribution_day_monitor_YYYY-MM-DD_HHMMSS.jsonibd_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.yamlis 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.
Related skills
More from tradermonty/claude-trading-skills and the wider catalog.

institutional-flow-tracker
Track institutional investor flows via 13F filings to identify smart money accumulation and distribution patterns.

kanchi-dividend-review-monitor
Monitor dividend portfolios for risk anomalies with Kanchi-style T1-T5 triggers, routing findings to human review without auto-selling.

kanchi-dividend-sop
Convert Kanchi-style dividend investing into a repeatable US-stock operating procedure.

kanchi-dividend-us-tax-accounting
US dividend tax classification and account-placement workflow for income portfolios.

macro-regime-detector
Detect 1-2 year macro regime transitions using cross-asset ratio analysis to inform strategic positioning.

market-breadth-analyzer
Quantify market breadth health with a 0-100 composite score using free public data.