Tooluck logoTooluck
SKILL.md

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)

skills/downtrend-duration-analyzer/SKILL.md

MITFull file
1# Downtrend Duration Analyzer
2
3## Overview
4
5Analyze 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.
6
7## When to Use
8
9- Trader asks about typical correction lengths for a sector or market cap tier
10- User wants to understand historical drawdown recovery times
11- Building mean reversion or pullback strategies that need realistic holding period estimates
12- Comparing correction behavior across different market segments
13- Setting stop-loss timeouts or position holding period limits
14
15## Prerequisites
16
17- 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)
20
21## Workflow
22
23### Step 1: Fetch Historical Price Data
24
25Run the analysis script to fetch OHLC data for a universe of stocks and identify downtrend periods.
26
27```bash
28python3 skills/downtrend-duration-analyzer/scripts/analyze_downtrends.py \
29 --sector "Technology" \
30 --lookback-years 5 \
31 --output-dir reports/
32```
33
34### Step 2: Analyze Downtrend Durations
35
36The script automatically:
371. Identifies local peaks and troughs using rolling window analysis
382. Calculates duration (trading days) and depth (% decline) for each downtrend
39…

Excerpt shown under the repository's MIT license.

More skills in claude-trading-skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates