Agent skill

Downtrend Duration Analyzer

by tradermonty in tradermonty/claude-trading-skills

Analyze historical downtrend durations and generate interactive HTML histograms showing typical correction lengths by sector and market cap.

MITAuto-check passedFrontend & Design

Install Downtrend Duration Analyzer

skills CLI
$ npx skills add tradermonty/claude-trading-skills --skill downtrend-duration-analyzer -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install tradermonty/claude-trading-skills downtrend-duration-analyzer --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/tradermonty/claude-trading-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/downtrend-duration-analyzer .claude/skills/downtrend-duration-analyzer && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
downtrend-duration-analyzer
GitHub stars
3k
Used in
1 other repo
Token cost
~1.4k tokens
SKILL.md length
377 words
Files
9 (incl. scripts, references)
Skills in repo
74
Repo updated
First seen
Licence
MIT

At a glance

Analyze historical downtrend durations and generate interactive HTML histograms showing typical correction lengths by sector and market cap.

  • Works in 4 steps: Fetch Historical Price Data → Analyze Downtrend Durations → Generate Interactive HTML Visualization → …
  • Tasks that involve HTML artifacts
  • SKILL.md covers Overview, When to Use, Prerequisites and Workflow, plus 3 more sections
  • Runs Python scripts from its folder; calls python3; needs FMP_API_KEY

What it does

Downtrend Duration Analyzer is an agent skill from tradermonty/claude-trading-skills. Analyze historical downtrend durations and generate interactive HTML histograms showing typical correction lengths by sector and market cap.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 11 other files, including scripts and reference files (for example `references/downtrend_methodology.md`, `scripts/analyze_downtrends.py` and `scripts/generate_histogram_html.py`).

It sits in Frontend & Design, covering HTML artifacts. The repository describes itself as: Claude Code skills for equity investors and traders — market analysis, technical charting, economic calendars, screeners, and trading strategy development. The licence is MIT.

When your agent uses it

  • Tasks that involve HTML artifacts

Example prompts

  • “/downtrend-duration-analyzer”

Requirements

  • Python 3
  • A credential in FMP_API_KEY

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Fetch Historical Price Data
  2. Analyze Downtrend Durations
  3. Generate Interactive HTML Visualization
  4. Review Distribution Insights

What it can do on your machine

Read from SKILL.md and the folder at commit c8d58f0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 6 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • FMP_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Downtrend Duration Analyzer loads about 1.4k tokens when it runs, and up to ~2.9k if it reads all its reference files. Until then it costs about 42 tokens; SKILL.md has 377 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~42
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from tradermonty/claude-trading-skills at commit c8d58f0, republished under its MIT licence (© tradermonty). 377 words, ~1,383 tokens.

Download SKILL.mdSave it as .claude/skills/downtrend-duration-analyzer/SKILL.md (or your agent's skills folder). This skill also uses 8 other files; get the full folder from GitHub.
name
downtrend-duration-analyzer
description
Analyze historical downtrend durations and generate interactive HTML histograms showing typical correction lengths by sector and market cap.

Downtrend Duration Analyzer

Overview

Analyze 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.

When to Use

  • Trader asks about typical correction lengths for a sector or market cap tier
  • User wants to understand historical drawdown recovery times
  • Building mean reversion or pullback strategies that need realistic holding period estimates
  • Comparing correction behavior across different market segments
  • Setting stop-loss timeouts or position holding period limits

Prerequisites

  • Python 3.9+
  • FMP API key (set FMP_API_KEY environment variable or use --api-key)
  • Required packages: requests, pandas, numpy (standard data analysis stack)

Workflow

Step 1: Fetch Historical Price Data

Run the analysis script to fetch OHLC data for a universe of stocks and identify downtrend periods.

bash
python3 skills/downtrend-duration-analyzer/scripts/analyze_downtrends.py \
  --sector "Technology" \
  --lookback-years 5 \
  --output-dir reports/
Step 2: Analyze Downtrend Durations

The script automatically:

  1. Identifies local peaks and troughs using rolling window analysis
  2. Calculates duration (trading days) and depth (% decline) for each downtrend
  3. Segments results by sector and market cap tier (Mega, Large, Mid, Small)
  4. Computes summary statistics (median, mean, percentiles)
Step 3: Generate Interactive HTML Visualization
bash
python3 skills/downtrend-duration-analyzer/scripts/generate_histogram_html.py \
  --input reports/downtrend_analysis_*.json \
  --output-dir reports/

This creates an interactive HTML file with:

  • Histogram of downtrend durations
  • Filters for sector and market cap
  • Hover tooltips with percentile information
  • Summary statistics table
Show full SKILL.md (153 more words)Show less
Step 4: Review Distribution Insights

Load the generated markdown report to interpret the findings:

  • Short corrections (5-15 days): Typical pullbacks within uptrends
  • Medium corrections (15-40 days): Standard sector rotations
  • Extended corrections (40+ days): Trend changes or bear markets

Output Format

JSON Report
json
{
  "schema_version": "1.0",
  "analysis_date": "2026-03-28T07:00:00Z",
  "parameters": {
    "lookback_years": 5,
    "sector_filter": "Technology",
    "peak_window": 20,
    "trough_window": 20
  },
  "summary": {
    "total_downtrends": 1234,
    "median_duration_days": 18,
    "mean_duration_days": 24.5,
    "p25_duration_days": 10,
    "p75_duration_days": 32,
    "p90_duration_days": 55
  },
  "by_sector": {
    "Technology": {
      "count": 456,
      "median_days": 15,
      "mean_days": 20.3
    }
  },
  "by_market_cap": {
    "Mega": {"count": 200, "median_days": 12},
    "Large": {"count": 300, "median_days": 16},
    "Mid": {"count": 400, "median_days": 22},
    "Small": {"count": 334, "median_days": 28}
  },
  "downtrends": [
    {
      "symbol": "AAPL",
      "sector": "Technology",
      "market_cap_tier": "Mega",
      "peak_date": "2025-01-15",
      "trough_date": "2025-02-10",
      "duration_days": 18,
      "depth_pct": -12.5
    }
  ]
}
Markdown Report
markdown
# Downtrend Duration Analysis

**Date**: 2026-03-28
**Lookback**: 5 years
**Sector**: Technology

## Summary Statistics

| Metric | Value |
|--------|-------|
| Total Downtrends | 1,234 |
| Median Duration | 18 days |
| Mean Duration | 24.5 days |
| 25th Percentile | 10 days |
| 75th Percentile | 32 days |
| 90th Percentile | 55 days |

## By Market Cap Tier

| Tier | Count | Median | Mean |
|------|-------|--------|------|
| Mega ($200B+) | 200 | 12 days | 15.2 days |
| Large ($10-200B) | 300 | 16 days | 20.1 days |
| Mid ($2-10B) | 400 | 22 days | 28.4 days |
| Small (<$2B) | 334 | 28 days | 35.6 days |

## Key Insights

1. Larger companies recover faster from corrections
2. Technology sector shows shorter median correction than market average
3. 90% of corrections resolve within 55 trading days
HTML Visualization

Interactive histogram saved to reports/downtrend_histogram_YYYY-MM-DD.html with:

  • Plotly.js-based interactive charts
  • Sector and market cap dropdown filters
  • Duration distribution with bin controls
  • Percentile markers (P25, P50, P75, P90)

Reports are saved to reports/ with filenames:

  • downtrend_analysis_YYYY-MM-DD_HHMMSS.json
  • downtrend_analysis_YYYY-MM-DD_HHMMSS.md
  • downtrend_histogram_YYYY-MM-DD_HHMMSS.html

Resources

  • scripts/analyze_downtrends.py -- Main analysis script for fetching data and computing downtrend durations
  • scripts/generate_histogram_html.py -- HTML visualization generator with interactive histograms
  • references/downtrend_methodology.md -- Peak/trough detection algorithms and market cap tier definitions

Key Principles

  1. Statistical Rigor: Use robust peak/trough detection to avoid noise-induced false signals
  2. Segmentation Matters: Always analyze by sector and market cap; averages hide important differences
  3. Realistic Expectations: Use percentiles (not just means) to understand the full distribution of outcomes

© tradermonty, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 8 other files (scripts, references) in skills/downtrend-duration-analyzer of tradermonty/claude-trading-skills.

  • SKILL.md
  • references/downtrend_methodology.md
  • requirements.txt
  • scripts/analyze_downtrends.py
  • scripts/generate_histogram_html.py
  • scripts/tests/conftest.py
  • scripts/tests/test_analyze_downtrends.py
  • scripts/tests/test_fetch_stock_list.py
  • scripts/tests/test_generate_histogram_html.py

Open the folder on GitHubat commit c8d58f0

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in tradermonty/claude-trading-skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Downtrend Duration Analyzer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Downtrend Duration Analyzer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Downtrend Duration Analyzer this skilltradermonty/claude-trading-skills3k1 repos~1.4kAutomated safety check: PassMIT
Visualizecode-yeongyu/oh-my-openagent70k—~954Automated safety check: PassCustom licence
Report With HTMLdaymade/claude-code-skills1.4k—~11kAutomated safety check: PassMIT
LobeHub Interactive Prototypelobehub/lobehub83k—~1.6kAutomated safety check: PassCustom licence
Paperclip Pagepaperclipai/paperclip100k—~1kAutomated safety check: PassMIT
Openkb Deck NeonVectifyAI/OpenKB4.8k1 repos~4.3kAutomated safety check: PassApache-2.0

Similar skills

  • Visualize

    code-yeongyu/oh-my-openagent

    Builds a self-contained HTML page (chart, table, diagram, dashboard) to show inline in a thread.

    70k GitHub stars~954 tokensUpdated today
    Frontend & DesignAuto-check passed
  • Report With HTML

    daymade/claude-code-skills

    Produces the reader-facing HTML artifact — report, dashboard, architecture view, data browser, or review workbench — evidence-backed, browser-verified.

    1.4k GitHub stars~11k tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • Builds single-file interactive HTML prototypes rendered with the real LobeHub UI components and written as production-style React, so they can later be split into files.

    83k GitHub stars~1.6k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Paperclip Page

    paperclipai/paperclip

    Publish static HTML pages and asset folders to the Paperclip S3/CloudFront page host.

    100k GitHub stars~1k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Openkb Deck Neon

    VectifyAI/OpenKB

    A skill your agent uses when the user asks the openkb chat to make a deck / slide presentation / PPT / slides / 演示稿 / 幻灯片 from their compiled KB content AND wants a dark, high-tech, neon / glow /…

    4.8k GitHub starsUsed in 1 repo~4.3k tokens
    Frontend & DesignAuto-check passed
  • Build, review, debug, reverse-engineer data sources for, and package FongMi/WebHome custom homepage single-file HTML.

    1.7k GitHub stars~3.8k tokensUpdated 2 days ago
    Frontend & DesignAuto-check passed

More from tradermonty/claude-trading-skills

All 74 skills in this repo
  • Technical Analyst

    tradermonty/claude-trading-skills

    This skill should be used when analyzing weekly price charts for stocks, stock indices, cryptocurrencies, or forex pairs.

    3k GitHub starsUsed in 4 repos~4.6k tokens
    Auto-check passed
  • Theme Detector

    tradermonty/claude-trading-skills

    Detect and analyze trending market themes across sectors. An agent skill from tradermonty/claude-trading-skills.

    3k GitHub starsUsed in 2 repos~4.9k tokens
    Auto-check passed
  • Trader Memory Core

    tradermonty/claude-trading-skills

    Track investment theses across their lifecycle — from screening idea to closed position with postmortem.

    3k GitHub starsUsed in 2 repos~4.3k tokens
    Auto-check passed
  • Edge Strategy Reviewer

    tradermonty/claude-trading-skills

    Critically review strategy drafts from edge-strategy-designer for edge plausibility, overfitting risk, sample size adequacy, and execution realism.

    3k GitHub starsUsed in 1 repo~988 tokens
    Auto-check passed
  • Sector Analyst

    tradermonty/claude-trading-skills

    This skill should be used when analyzing sector rotation patterns and market cycle positioning.

    3k GitHub starsUsed in 1 repo~2.3k tokens
    Auto-check passed
  • Stanley Druckenmiller Investment

    tradermonty/claude-trading-skills

    Druckenmiller Strategy Synthesizer - Integrates 8 upstream skill outputs (Market Breadth, Uptrend Analysis, Market Top, Macro Regime, FTD Detector, VCP Screener, Theme Detector, CANSLIM Screener)…

    3k GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed

Questions about Downtrend Duration Analyzer

What does Downtrend Duration Analyzer do?

Analyze historical downtrend durations and generate interactive HTML histograms showing typical correction lengths by sector and market cap. Downtrend Duration Analyzer is an agent skill from tradermonty/claude-trading-skills. Analyze historical downtrend durations and generate interactive HTML histograms showing typical correction lengths by sector and market cap.

When should I use Downtrend Duration Analyzer?

Downtrend Duration Analyzer fits situations like: tasks that involve HTML artifacts.

How do I install Downtrend Duration Analyzer in Claude Code?

Run `npx skills add tradermonty/claude-trading-skills --skill downtrend-duration-analyzer -a claude-code`. Or copy the skill folder (skills/downtrend-duration-analyzer in tradermonty/claude-trading-skills) into .claude/skills/downtrend-duration-analyzer in your project. Claude Code loads it when a task matches its description.

How do I install Downtrend Duration Analyzer in Codex?

Run `npx skills add tradermonty/claude-trading-skills --skill downtrend-duration-analyzer -a codex`. Or copy the skill folder (skills/downtrend-duration-analyzer in tradermonty/claude-trading-skills) into .agents/skills/downtrend-duration-analyzer in your project. Codex loads it when a task matches its description.

Can I use Downtrend Duration Analyzer in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add tradermonty/claude-trading-skills --skill downtrend-duration-analyzer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/downtrend-duration-analyzer, .gemini/skills/downtrend-duration-analyzer, .github/skills/downtrend-duration-analyzer and .opencode/skills/downtrend-duration-analyzer in your project.

What does Downtrend Duration Analyzer need to run?

Going by SKILL.md and its folder, Downtrend Duration Analyzer needs Python for the scripts in its folder, the command-line tools its instructions call (python3) and credentials named FMP_API_KEY. Our summary lists: Python 3; A credential in FMP_API_KEY.

Does Downtrend Duration Analyzer access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Downtrend Duration Analyzer safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Downtrend Duration Analyzer use?

Downtrend Duration Analyzer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Downtrend Duration Analyzer use?

About 1.4k tokens (SKILL.md is roughly 5.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.5k tokens, read only when the agent opens those files.

What are the alternatives to Downtrend Duration Analyzer?

Skills that share tags, products or a category with Downtrend Duration Analyzer: Visualize (code-yeongyu/oh-my-openagent, 70k stars), Report With HTML (daymade/claude-code-skills, 1.4k stars), LobeHub Interactive Prototype (lobehub/lobehub, 83k stars) and Paperclip Page (paperclipai/paperclip, 100k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Downtrend Duration Analyzer?

tradermonty (a GitHub user) maintains it in tradermonty/claude-trading-skills, which has 2,982 GitHub stars. The repository holds 74 skills in this directory. The repository was last updated on October 11, 2026.

Source: tradermonty/claude-trading-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.