VolatilityContractionPattern
How many swing pullbacks in a row have each been shallower than the one before, with higher lows.
A swing high is a bar whose high is at least as high as every bar within lookback bars on either side; a swing low mirrors it. The indicator keeps the latest max_pullbacks + 1 swing highs and lows, pairs them by recency, and measures each pair's pullback as (high - low) / high. The count is the trailing run of steps where a pullback is shallower than the one before and the swing low rose; the marker fires when that run reaches min_contractions.
How to read it
- Markers sit on the candles where the pattern holds, in runs. On the September 2026 SPY sample there were about 7.5 runs a day, covering 8% of one-minute bars.
- The count and depth panes are steps. They change only when a new swing high or low is confirmed, then hold flat until the next one.
- Depth is the newest pullback as a fraction of its swing high, so 0.001 is 0.1%. 95% of sample readings were below 0.23%.
What it outputs
- Pattern holds
- Drawn on bars where the run of steps reaches min_contractions: that many pullbacks in a row, each shallower than the one before with a higher swing low.
- Contraction count
- Length of the current run of steps, from 0 up to max_pullbacks. 0 means the latest pullbacks are not tightening.
- Latest pullback depth
- Depth of the newest swing high to swing low pair, as a fraction of the high: (high - low) / high. Negative when the swing low sits above its high.
When it fires
Fires on bars where the tightening run reaches min_contractions: with defaults, three pullbacks in a row, each shallower than the last with a higher swing low. A run starts at a swing confirmation and lasts until a later swing breaks it. It describes range shape, not direction.
Settings
- lookback
- Bars on each side a bar must beat to count as a swing. Raising it (10 or more) keeps only larger swings and confirms each one later; lowering it (3 or less) catches small swings sooner, with more noise and more steps.
- min_contractions
- Steps in a row needed before the marker fires. The default 2 means three pullbacks in a row. Raising it to 3 or 4 fires much less often; lowering it to 1 fires on any single tightening step.
- max_pullbacks
- How many recent swing highs and lows are kept, which caps the run at this many steps. Raising it lets longer runs count; lowering it below min_contractions means the marker never fires.
Pitfalls
- Confirmation lags: a swing counts only lookback bars after it forms, so every marker and step arrives that late, after the turn it describes.
- Highs and lows pair by recency, not by time, so a pullback can join unrelated swings. Depth goes negative (down to -0.34% in the sample) when the swing low sits above its paired high.
- Zero is ambiguous: count and depth read 0 until two swing pairs exist, and min_contractions above max_pullbacks can never fire because the count cannot exceed max_pullbacks.