Skip to content
Skillpedia
Analysis & spreadsheets37k · #7566

volatility

What it does

This skill tests a strategy that bets volatility tends to return to its normal level. It is for traders who study how calm and stormy markets alternate.

When to use it

  • ✓When you think a quiet, low-volatility period may be followed by a bigger move.
  • ✓When a stock's volatility is at an unusually high level and you want to test an exit rule.
  • ✓When you want to compare volatility regimes in crypto or stock price data.

Skill link

https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/volatility/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/volatility/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Test a volatility strategy on this stock that buys when volatility is in the bottom 20 percent of its history.”

5 new skills a week. 1 minute to read.

How it works

It calculates historical volatility over a rolling window and ranks it against the recent past. It goes long when volatility is low, exits or shorts when it is high, and holds the current position in between.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Volatility Strategy

Purpose

Uses percentile ranking of historical volatility (HV) to capture volatility mean reversion: build positions in low-volatility regimes while waiting for volatility expansion, and exit or short in high-volatility regimes to capture contraction.

Signal Logic

  1. Compute HV: annualized standard deviation of returns over the past hv_window days
  2. Percentile ranking: percentile position of HV within the past lookback days (0-100)
  3. Signal generation:
    • Percentile < low_pct → go long (volatility is low, waiting for expansion)
    • Percentile > high_pct → exit / go short (volatility is high, waiting for contraction)
    • Middle region → keep the current position

Key Implementation Details

  • HV = returns.rolling(hv_window).std() * sqrt(252) (annualized)
  • Percentile = hv.rolling(lookback).rank(pct=True) * 100
  • For cryptocurrencies, use 365 instead of 252 as the annualization factor

Parameters

Parameter Default Description
hv_window 20 Historical volatility calculation window
lookback 120 Lookback period for percentile ranking
low_pct 20.0 Low-volatility threshold (percentile)
high_pct 80.0 High-volatility threshold (percentile)
annualize 252 Annualization factor (252 for China A-shares, 365 for crypto)

Common Pitfalls

  • Before the lookback window is filled, there is not enough data to compute percentiles, so the signal should be 0 (fillna)
  • Volatility is not direction. Going long in low-volatility regimes does not guarantee price appreciation; it only means volatility expansion is statistically more likely
  • Cryptocurrencies trade 7x24, so annualize should be set to 365

Dependencies

pip install pandas numpy

Signal Convention

  • 1 = long (low-volatility regime), -1 = short (high-volatility regime), 0 = stand aside
FAQ

What is historical volatility?

It is the annualized standard deviation of recent returns, which measures how much the price has been moving.

Why use 365 for crypto?

Crypto trades every day, so the skill uses 365 instead of 252 for annualizing volatility.

Does the strategy always work?

No. Volatility tends to revert, but there are no guarantees, so test it first.

Details

Original description by the author

Volatility strategy. Trades mean reversion based on percentile ranking of historical volatility (HV). Suitable for any OHLCV data.

repo: HKUDS/Vibe-Trading

Popularity

GitHub stars
37k
Ranking position
#7566
License
MIT
Updated
11/1/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills