downtrend-duration-analyzer
Agent skill fromtradermonty/claude-trading-skills
Analyze historical downtrend durations and generate interactive HTML histograms showing typical correction lengths by sector and market cap.
How to install downtrend-duration-analyzer
install downtrend-duration-analyzer
# install the claude-trading-skills pack with the skills CLI
npx skills add tradermonty/claude-trading-skills# or add only this skill to Claude Code: copy the folder
skills/downtrend-duration-analyzer/
# into
~/.claude/skills/downtrend-duration-analyzer/ (all projects)
.claude/skills/downtrend-duration-analyzer/ (one project)
1# Downtrend Duration Analyzer23## Overview45Analyze historical price data to identify downtrend periods (peak-to-trough) and build statistical distributions of correction durations. Generate interactive HTML visualizations with histograms segmented by sector and market cap to help traders understand typical recovery timeframes and set realistic expectations for mean reversion strategies.67## When to Use89- Trader asks about typical correction lengths for a sector or market cap tier10- User wants to understand historical drawdown recovery times11- Building mean reversion or pullback strategies that need realistic holding period estimates12- Comparing correction behavior across different market segments13- Setting stop-loss timeouts or position holding period limits1415## Prerequisites1617- Python 3.9+18- FMP API key (set `FMP_API_KEY` environment variable or use `--api-key`)19- Required packages: `requests`, `pandas`, `numpy` (standard data analysis stack)2021## Workflow2223### Step 1: Fetch Historical Price Data2425Run the analysis script to fetch OHLC data for a universe of stocks and identify downtrend periods.2627```bash28python3 skills/downtrend-duration-analyzer/scripts/analyze_downtrends.py \29 --sector "Technology" \30 --lookback-years 5 \31 --output-dir reports/32```3334### Step 2: Analyze Downtrend Durations3536The script automatically:371. Identifies local peaks and troughs using rolling window analysis382. Calculates duration (trading days) and depth (% decline) for each downtrend39…
Excerpt shown under the repository's MIT license.
