Market Structure, Breakouts, and Regimes
18 algorithms in Geometric Chart Patterns · 18 with asserted arithmetic.
In this family#
-
Highest-High and Lowest-Low Primitives verified
The two rolling extremes every breakout rule is built on: the highest high and lowest low over a window of
periodbars ending at, and including, the current bar.highestHighAndLowestLowPrimitives(input) -
Single-Asset New-High/New-Low Signal verified
Flags whether a single instrument's close has cleared the highest high or undercut the lowest low of the preceding
periodbars. The channel excludes the current bar, so the comparison is against a level that was already known.singleAssetNewHighNewLowSignal(input) -
Breakout Strength verified
Expresses how far a close sits beyond its Donchian channel in units of ATR, so a two-tick break in a quiet market and a two-tick break in a violent one do not score the same. Values are negative while price is inside the channel.
breakoutStrength(input) -
Donchian Breakout verified
The Donchian channel over the preceding
periodbars plus the two breakout booleans it implies. This shares a byte-identical implementation with the single-asset new-high/new-low signal.donchianBreakout(input) -
Opening Range Breakout verified
Fixes the high and low of the session's first
opening_barsbars and then tests every later close against that frozen range. Unlike the rolling breakout topics the level never moves once the opening range is set.openingRangeBreakout(input) -
Price Compression Index verified
Compares short-horizon volatility to long-horizon volatility as
100 × ATR(short_period) / ATR(long_period). Readings well under 100 mark a market whose recent ranges have compressed against its own baseline.priceCompressionIndex(input) -
Range Expansion Index verified
Scores directional conviction as the signed sum of close-to-close changes over
periodbars divided by the sum of their absolute values, scaled to ±100. It is the net move as a percentage of the distance actually travelled.rangeExpansionIndex(input) -
Fractal Dimension Index verified
Compares the total path length walked by close over a window against the straight-line span of that window, on a log scale, and clamps the result to [1, 2]. Near 1 the path is a line; near 2 it fills the range.
fractalDimensionIndex(input) -
Hurst Exponent verified
A rolling rescaled-range estimate: over each window of
periodcloses it takes the range of the mean-adjusted cumulative sum, divides by the window's standard deviation, and reportslog(R/S) / log(period).hurstExponent(input) -
Efficiency Ratio verified
Kaufman's ratio of net displacement to gross travel: the absolute change in close over
periodbars divided by the sum of the absolute bar-to-bar changes across the same span. Near 1 the market went somewhere; near 0 it churned.efficiencyRatio(input) -
Market Meanness Index verified
Counts how often close crosses the median of its own
period-bar window and reports that as a percentage of theperiod - 1opportunities. High readings mean the series keeps returning to its centre.marketMeannessIndex(input) -
Trend/Range Regime Classifier verified
Labels each bar
trend,rangeoruncertainby requiring two independent readings to agree: efficiency ratio at or above 0.55 with Choppiness at or below 45 givestrend, efficiency at or below 0.25 with Choppiness at or above 55 givesrange, and anything else isuncertain.trendRangeRegimeClassifier(input) -
Volatility Regime Classifier verified
Computes realized volatility as the standard deviation of simple close returns over
periodbars, then ranks each reading against the lastrank_periodof them: bottom quartile islow, top quartile ishigh, everything between isnormal.volatilityRegimeClassifier(input) -
Directional Persistence verified
Maps each bar to +1, -1 or 0 by the sign of its close-to-close change, sums those signs over
periodbars, and reports the absolute total divided byperiod. It measures one-sidedness without caring which side.directionalPersistence(input) -
Swing Structure Detector verified
Confirms five-bar swing highs and lows and labels each one against the previous swing of the same kind -
HH,LH,HL,LL, orswing-high/swing-lowfor the first of each. The confirmation is causal: a swing at bar p is only reported at bar p+2.swingStructureDetector(input) -
Higher-High/Lower-Low Structure verified
Reduces price to the higher-high / lower-low sequence traders read structure from, labelling each confirmed five-bar swing
HH,LH,HLorLLagainst the previous swing of its kind. It shares a byte-identical state transition with the swing structure detector.higherHighLowerLowStructure(input) -
Inside/Outside Bar Structure verified
Classifies each bar against its immediate predecessor as
inside(high not above and low not below),outside(high not below and low not above), orneither. A bar that exactly repeats the previous range is classifiedinside, because that test is evaluated first.insideOutsideBarStructure(input) -
Market Entropy verified
Treats each bar as one of three states by the sign of its close change, then reports the Shannon entropy of the state distribution over a
period-bar window, normalised bylog(3)so a perfectly balanced mix scores 1.marketEntropy(input)
What they share#
Every topic here is a record-transform, so once you have
called one the rest follow the same shape. Import paths differ only in the final segment:
import { highestHighAndLowestLowPrimitives } from "fintech-algorithms/geometric-chart-patterns/market-structure-breakouts-and-regimes/highest-high-and-lowest-low-primitives";
import { singleAssetNewHighNewLowSignal } from "fintech-algorithms/geometric-chart-patterns/market-structure-breakouts-and-regimes/single-asset-new-high-new-low-signal";Read them in the order above — the sequence is pedagogical, not alphabetical.
Where this sits#
Geometric Chart Patterns collects 64 algorithms across 7 families. For the concept behind this family rather than the call signatures, see the concept guides.