Source profileQuality 90/100Review permissions

tradermonty/claude-trading-skills/skills/downtrend-duration-analyzer/SKILL.md

downtrend-duration-analyzer

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

Source repository stars
2,715
Declared platforms
0
Static risk flags
1
Last source update
2026-08-23
Source checked
2026-08-25

Decision brief

What it does: where it fits

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

Best for

  • 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

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/tradermonty/claude-trading-skills --skill "skills/downtrend-duration-analyzer"
Safe inspection promptEditorial

Inspect the Agent Skill "downtrend-duration-analyzer" from https://github.com/tradermonty/claude-trading-skills/blob/51c790740048c4cbc9b7cc82a7f3ddc7b12d31d0/skills/downtrend-duration-analyzer/SKILL.md at commit 51c790740048c4cbc9b7cc82a7f3ddc7b12d31d0. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    Workflow

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

    Identifies local peaks and troughs using rolling window analysisCalculates duration (trading days) and depth (% decline) for each downtrendSegments results by sector and market cap tier (Mega, Large, Mid, Small)
  2. 02

    Step 1: Fetch Historical Price Data

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

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

    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…

    Identifies local peaks and troughs using rolling window analysisCalculates duration (trading days) and depth (% decline) for each downtrendSegments results by sector and market cap tier (Mega, Large, Mid, Small)
  4. 04

    Step 3: Generate Interactive HTML Visualization

    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

    Histogram of downtrend durationsFilters for sector and market capHover tooltips with percentile information
  5. 05

    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

    Short corrections (5-15 days): Typical pullbacks within uptrendsMedium corrections (15-40 days): Standard sector rotationsExtended corrections (40+ days): Trend changes or bear markets

Permission review

Static risk signals and limitations

Runs scripts

medium · line 25

The documentation asks the agent to run terminal commands or scripts.

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

Runs scripts

medium · line 28

The documentation asks the agent to run terminal commands or scripts.

python3 skills/downtrend-duration-analyzer/scripts/analyze_downtrends.py \

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score90/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars2,715SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
tradermonty/claude-trading-skills
Skill path
skills/downtrend-duration-analyzer/SKILL.md
Commit
51c790740048c4cbc9b7cc82a7f3ddc7b12d31d0
License
MIT
Collected
2026-08-25
Default branch
main
View the original SKILL.md

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.

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

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

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

{
  "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

# 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

Frequently asked questions

What to verify before installation and use

What does the downtrend-duration-analyzer source document cover?

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

How do I install downtrend-duration-analyzer?

The source record exposes this install command: npx skills add https://github.com/tradermonty/claude-trading-skills --skill "skills/downtrend-duration-analyzer". Inspect the command and pinned source before running it.

Which permission-related actions were detected?

Static rules flagged exec-script in the source; the page lists the matching lines and excerpts.

Alternatives

Compare before choosing

Computed 10024,921

alirezarezvani/claude-skills

app-store-optimization

App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist

Computed 10015,122

wanshuiyin/Auto-claude-code-research-in-sleep

citation-audit

Use it for operations and research tasks; the detail page covers purpose, installation, and practical steps.

Computed 10014,671

prowler-cloud/prowler

postgresql-indexing

PostgreSQL indexing best practices for Prowler: index design, partial indexes, partitioned table indexing, EXPLAIN ANALYZE validation, concurrent operations, monitoring, and maintenance. Trigger: When creating or modifying PostgreSQL indexes, analyzing query performance with EXPLAIN, debugging slow queries, reviewing index usage statistics, reindexing, dropping indexes, or working with partitioned table indexes. Also trigger when discussing index strategies, partial indexes, or index maintenance

Computed 9965

brucesongs/kali-claw

insecure-design

Insecure Design (OWASP A06:2025) focuses on security flaws in system architecture and design phases, rather than code implementation-level bugs.