Streak Choppiness Index

1 028
Streak Choppiness Index

OVERVIEW
Streak Choppiness Index measures how often candle color flips (green to red or red to green) over a rolling window. Frequent flips mean the market is choppy and mean-reverting. Long unbroken runs of one color mean it is trending. The indicator classifies each bar into a regime (Choppy, Neutral or Trendy) and flags "fade setups": a same-color streak reaching a chosen length inside a choppy regime. It works on any symbol and any timeframe.

THEORY
If candle colors were random coin flips, each candle would have a 50% chance of differing from the previous one. A flip rate near 50 is therefore the "random" baseline:
• Above 50: colors alternate more often than chance. Streaks are short and tend to reverse (anti-persistent, mean-reverting behavior).
• Below 50: colors repeat more often than chance. Streaks tend to extend (persistent, trending behavior).
This is the same idea as a runs test: counting color changes in a sequence reveals whether it is alternating, random or clustering. Average streak length gives the same information in candle units. Random data averages about 2 candles per streak; shorter means chop, longer means trend.

HOW IT WORKS
1. Color: a candle is green when close ≥ open, otherwise red.
2. Flip: a flip is counted when a candle's color differs from the previous candle's.
3. Chop index: flips in the window / window length × 100, smoothed with an EMA.
100 = color flips every candle (pure chop)
0 = one unbroken streak (pure trend)
4. Baseline: the long-run average of the raw chop index (SMA), used to judge whether current choppiness is high or low for this market.
5. Average streak: window / (flips + 1), the approximate mean streak length in candles.
6. Live streak: the current run of same-color candles, counted back up to 31 candles.
7. Regime:
• Choppy – chop index ≥ Choppy threshold
• Trendy – chop index ≤ Trendy threshold
• Neutral – in between
8. Fade setup: Choppy regime AND live streak ≥ Max streak length.

PLOTS
- Chop index line – green when Choppy, yellow when Neutral, red when Trendy.
- Baseline – gray long-run average.
- Threshold lines – Choppy, Trendy and a 50 midline.
- Background – light green in Choppy, light red in Trendy, stronger green on a fade setup.
- Table – regime, chop index, value vs baseline, average streak, live streak (color × length), reversion status (ON in Choppy, OFF otherwise) and fade setup.

HOW TO USE
- Choppy regime: streaks are short and reverse often, so mean-reversion approaches (fading the current streak) have better conditions.
- Trendy regime: streaks extend, so fading tends to fail. Stand aside or trade with the direction.
- Fade setup: the current streak has reached your maximum expected length while the market is choppy. This is a candidate point for a reversal entry, not a guaranteed one.
- Use the baseline to compare current choppiness with what is normal for the symbol and timeframe.

SETTINGS
- Rolling window – number of candles used to count flips (default 5). Small windows react fast; larger windows give a steadier regime.
- Smoothing – EMA length on the chop index.
- Baseline window – length of the long-run average.
- Choppy / Trendy thresholds – regime boundaries.
- Max streak length – live streak length that triggers a fade setup in a choppy regime.
- Table, table position and regime background toggles.

NOTES
Candles with close equal to open are counted as green. With a small window the index moves in large steps (for example 0, 20, 40… for a window of 5); smoothing softens this.

This script is for analysis and education only and is not financial advice.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.