Finance & Investment Banking

Markov Hedge Fund Method (Regime Detection Skill)

Detects Bull / Bear / Sideways regimes on any asset and turns them into a tradeable signal or risk gate you can layer onto an existing strategy.

45/ 100
Not recommended

Current benefit does not outweigh risk or uncertainty.

See how it was scored ↓
Works as-is in
Codex · Claude Code
Stars
★ 487
Last updated
5mo ago
License
NOASSERTION
markov-chainregime-detectionhidden-markov-modelyfinance
+4walk-forward-backtestpine-scriptquant-tradingrisk-filter

What does this skill do, and when should you use it?

This skill accompanies video 1 of the Quant Series, built on a framework by Roan (@RohOnChain) and refactored into a plugin by Lewis Jackson. It labels each day of any asset's history Bull / Bear / Sideways via a rolling-return rule, fits a maximum-likelihood 3×3 Markov transition matrix, and forecasts n-steps ahead via Chapman-Kolmogorov, alongside the long-run stationary distribution and a no-lookahead walk-forward backtest (Sharpe, max drawdown). Input is either any yfinance ticker (stocks, ETFs, crypto, FX, futures) or your own CSV price file. It is explicitly designed to compose — as a confirmation layer, standalone signal, or tail-risk filter — without rewriting an existing trading agent.

Runs scripts/markov_regime.py: accepts --ticker (prices fetched via yfinance) or --csv (needs only date and close columns, with common column names auto-detected); labels each bar using defaults of a 20-day window and ±5% threshold over 10 years of history; estimates a 3×3 Markov transition matrix; computes next-state probabilities and the stationary distribution; emits signal = bull_prob − bear_prob in [-1, 1]; runs a re-estimated-every-step, no-lookahead walk-forward backtest reporting Sharpe and max drawdown; optionally fits an HMM via hmmlearn that degrades gracefully if it cannot compile. With -- it prints exactly one structured object containing current_regime, signal, transition_matrix, stationary_distribution, walk_forward, and more.

Good fit
  • A trader with an existing momentum strategy who wants regime confirmation before entries: take longs only when the strategy and regime signal agree
  • Risk management: scale position sizes down (or gate to zero) based on the asset's long-run Bear share in the stationary distribution
  • An individual investor who wants a quick read on where an asset like BTC-USD or AAPL stands, how sticky that state is, and directional probabilities
  • A quant with their own CSV price data who wants the same regime detection on any asset or timeframe their pipeline produces
  • A TradingView user who wants the companion Pine Script v5 indicator showing the regime ribbon, live transition matrix, and stationary-distribution table on a chart

How do you install this skill?

Before you use it
  • This is a static review; no code was executed. Script logic, backtest figures, and JSON output are independently unverified.
  • Dependencies resolve dynamically from PyPI via uv with no lockfile — a supply-chain risk. Inspect the PEP 723 inline metadata and pin versions.
  • yfinance may be unreachable from mainland-China networks; the ticker path may be unusable there — fall back to --csv with your own data.
  • Output is a trading signal for educational purposes; validate via the walk-forward Sharpe and max drawdown before any live use.
  • Repo license metadata is NOASSERTION and the publisher is unverified; SKILL.md lacks versioning and a changelog — diff carefully on updates.
Before you start
Your agent needs
  • Shell / CLI
  • Network access
  • Local filesystem
Install first
  • uv (PEP 723)
  • Python
  • yfinance
  • hmmlearn (optional, degrades gracefully)

Two commands in Claude Code: /plugin marketplace add jackson-video-resources/markov-hedge-fund-method then /plugin install markov-hedge-fund-method@markov-hedge-fund-method. No API keys, no accounts, no sudo; dependencies resolve on first run via uv (PEP 723 inline metadata, roughly 10–20 seconds). If you prefer not to install from a marketplace, markov-hedge-fund-method.md in the repo is the original one-shot onboarding prompt — paste it into Claude Code (agent mode) and it builds the identical skill from scratch locally, as a zero-trust fallback.

Generic route: install into Claude Code manually (macOS / Linux)
tmp="$(mktemp -d)"
git clone --depth 1 https://github.com/jackson-video-resources/markov-hedge-fund-method.git "$tmp"
mkdir -p ~/.claude/skills
cp -R "$tmp/skills/regime" ~/.claude/skills/
rm -rf "$tmp"

Generated from the source repository and skill path; it copies only this skill's folder. If the author's install steps above differ, follow those first. To scope it to one project, replace ~/.claude/skills with that project's .claude/skills.

How do you use this skill?

Try saying

Once installed, send your agent any of these to trigger it:

  • detect the regime on BTC-USD
  • add a regime confirmation filter to my SPY momentum strategy
  • what's the long-run regime mix of AAPL

Invoke with /markov-hedge-fund-method:regime or plain English prompts like "detect the regime on BTC-USD", "add a regime confirmation filter to my SPY momentum strategy", or "what's the long-run regime mix of AAPL". Programmatic use: uv run ${CLAUDE_PLUGIN_ROOT}/scripts/markov_regime.py --ticker BTC-USD --, or swap in --csv ./my_prices.csv. Drop -- for the pretty terminal output (matrix, persistence diagonal, walk-forward metrics, HMM line). All defaults (--window 20, --threshold 0.05, --years 10, --min-train 252) are overridable.

What are this skill's strengths and limitations?

Pros
  • Zero-trust friendly: the original build prompt is kept in-repo so you can read every line before installing
  • No-lookahead walk-forward backtest that re-estimates the matrix at every step
  • Asset-agnostic: any yfinance ticker or your own CSV, with minimal input requirements (one date and one close column)
  • Graceful HMM degradation and a clean, well-documented JSON contract for programmatic integration
  • Includes a TradingView Pine Script indicator for visual verification of the framework
Limitations
  • Backtests are historical, not forward-looking — the repo itself states this repeatedly
  • GitHub license metadata is NOASSERTION; only the README claims MIT via an umbrella LICENSE in a parent directory, which you should verify
  • No evidence of a test suite or third-party audit; the repo has no topics and no formal releases
  • Walk-forward Sharpe/max drawdown can be NaN when history is too short; HMM states are labelled by ascending mean return, so a 'Bear' state can still be net-positive, requiring careful interpretation
  • The Pine indicator (v5) mirrors the Python defaults but is a separate implementation with no stated cross-verification

How does this skill compare with similar options?

Side by side with related skills; every score comes from the same FSRS standard.

Skill FS score Stars Last updated License
Markov Hedge Fund Method (Regime Detection Skill) this page 45 · Not recommended ★ 487 5mo ago NOASSERTION
Daisy Financial Research 55 · Use with care ★ 29 5mo ago —
Financial Analyst Skill 52 · Use with care ★ 62 7mo ago MIT
Kronos Technical Analysis Skill 44 · Not recommended ★ 21 5mo ago —
Monetary Sentinel 57 · Use with care ★ 2.1k 2mo ago AGPL-3.0

The repo names no competitors. Compared with quant backtesting frameworks that embed regime features internally, this skill is deliberately a lightweight, composable layer — it does not require replacing your existing strategy or backtesting stack.

How did FollowSkills review this skill?

FollowSkills review · FSRS-2.0
Not recommended
45/ 100 5-point scale 2.3 / 5
1Trust14 / 25 · 2.8/5

Read-only data analysis; no API keys/accounts/sudo; data flow (yfinance or user CSV) explicitly disclosed; graceful HMM degrade; clear disclaimers; MIT license with framework attribution to Roan. Deducted: the actual script is not provided for review, so least-privilege behavior and input validation cannot be verified; uv resolves dependencies dynamically from PyPI with no lockfile or dependency audit; no rollback mechanism.

2Reliability8 / 20 · 2.0/5

Documentation is self-consistent: field-by-field JSON contract, non-zero exit with {"error} on failure, HMM graceful-degrade path, no-lookahead walk-forward claim all align. Deducted: the script source is not in scope-provided evidence, so key paths (matrix estimation, NaN handling, CSV column auto-detection) cannot be statically confirmed; no tests or edge cases are visible.

3Adaptability7 / 15 · 2.3/5

Trigger semantics are precise: named scenarios (regime detection, confirmation layer, risk gate, sizing filter), clear inputs (ticker or CSV), stated defaults. Deducted: no Chinese-language support mentioned; yfinance may be unreachable from mainland-China networks, and core function depends on it; behavior on short histories only partially disclosed via walk_forward NaN note.

4Convention8 / 15 · 2.7/5

Well-layered docs (README → SKILL.md → JSON contract → composition patterns), complete MIT LICENSE, clear attribution, and a zero-trust manual install path. Deducted: repo license metadata is NOASSERTION; SKILL.md has no version or changelog; maintenance responsibility and update path are unclear (a personal YouTube link is not a maintenance commitment).

5Effectiveness5 / 15 · 1.7/5

Claimed capability is complete with copy-ready composition snippets and a concrete marginal value story (signal/risk layer). Deducted: static review cannot verify outputs are directly usable; walk-forward backtest correctness and reported Sharpe are unchecked; financial-benefit claims per anchors require executed evidence, which is absent.

6Verifiability3 / 10 · 1.5/5

Auditable primary material exists: full JSON contract, documented defaults, repro params matching the on-camera demo (--threshold 0.02), and reference to the original article. Deducted: no test suite, no committed third-party execution evidence, no sample outputs to cross-check results; fact/inference separation rests on author claims.

1 2 3 4 5 6

Open a dimension to read why it scored that way

Reviewed Sep 10, 2026 Reviewed revision fe24cf942687 Review evidence[1][2][3]

Evidence confidence:Low — Mostly static review, author material or a limited demo; useful for discovery, not high-risk decisions.

See the full review method →

FAQ

Does it cost anything or need API keys?
No. The README explicitly states no API keys, no accounts, no sudo; dependencies resolve via uv on first run. Fetching public data through yfinance is free.
What happens when it fails?
With --, failure prints {"error": "..."} and exits non-zero. If hmmlearn cannot compile (e.g. Windows without MSVC), the HMM degrades gracefully: hmm.available is false with a reason, and every other field remains valid.
Can I trade the signal directly?
SKILL.md advises sanity-checking the walk-forward Sharpe and max drawdown (run without --) before sizing real capital. The repo repeatedly stresses that backtests are historical and not forward-looking.
Can I use my own data, and what format does it need?
Yes, via --csv. Only a date column and a close column are needed; common names (date/time/timestamp, close/adj close/price/last) are auto-detected, and a single numeric column is used directly — no reformatting required.

Related skills