Pivots and Levels
13 algorithms in Geometric Chart Patterns · 13 with asserted arithmetic.
In this family#
-
Causal Pivot Detection verified
Finds swing highs and lows using only bars that had already arrived. Most pivot code confirms a pivot with bars that come *after* it and then plots it at the earlier index — which is lookahead bias, and it is invisible on a chart.
detectCausalPivots(bars, leftSpan, rightSpan, minSeparation) -
ZigZag Segmentation verified
Segments a series into alternating swings that exceed a percentage threshold. Useful for structure, and routinely misused: the final swing is provisional and can be revised by the next bar.
zigzagSegment(closes, threshold, minBars) -
Support/Resistance Clustering verified
Groups nearby pivots into levels. Clustering in basis points rather than absolute price is what makes the result meaningful across instruments — a $1 band is noise on one stock and a whole level on another.
clusterPivotLevels(pivots, epsBps, minTouches) -
Robust Trendline Fitting verified
Fits a trendline through pivots in log space with outlier resistance. Log space matters: a straight line in price implies a constant *dollar* change per bar, which is not what a trend on a long chart means.
fitRobustTrendline(pivots, kind, toleranceBps, minInliers, maxPoints, projectionIndex) -
Classic and Floor-Trader Pivot Points verified
Projects the classic floor-trader pivot and two resistance/support pairs for each bar from the previous bar's high, low, and close. The pivot is
(H + L + C) / 3,r1/s1reflect it across the prior low and high, andr2/s2add and subtract the prior bar's range.classicAndFloorTraderPivotPoints(input) -
Fibonacci Pivot Points verified
Takes the same
(H + L + C) / 3pivot as the classic variant but places the bands at Fibonacci fractions of the previous bar's range:r1/s1at 0.382 of it andr2/s2at 0.618.fibonacciPivotPoints(input) -
Camarilla Pivot Points verified
Anchors its bands on the previous bar's close rather than on the pivot:
r1/s1sit atclose ± 1.1 × range / 12andr2/s2atclose ± 1.1 × range / 6. Thepivotseries is still the conventional(H + L + C) / 3, which is why the bands are not symmetric around it.camarillaPivotPoints(input) -
Woodie Pivot Points verified
Weights the current bar's open into the pivot,
(H_prev + L_prev + 2 × open) / 4, then derivesr1/s1by reflecting that pivot across the previous low and high andr2/s2by adding and subtracting the previous bar's range.woodiePivotPoints(input) -
DeMark Pivot Points verified
Chooses one of three formulas for the intermediate
Xdepending on whether the previous bar closed below, above, or level with its open, then reportspivot = X / 4with a single band pairr1 = X / 2 - L_prevands1 = X / 2 - H_prev.demarkPivotPoints(input) -
Rolling Support and Resistance verified
Reports, for each bar, the lowest low and highest high of the
periodbars that came strictly before it. Excluding the current bar is what makes the level a thing price can break rather than a level price defines.rollingSupportAndResistance(input) -
Fractal Support and Resistance verified
Holds the most recent confirmed five-bar fractal high and low forward as resistance and support. This deliberately delegates to the same causal five-bar confirmation used by Fractal Chaos Bands, so a fractal at bar p is only reported from bar p+2 onward.
fractalSupportAndResistance(input) -
ATR Support and Resistance verified
Places support and resistance a volatility-scaled distance either side of a simple moving average of close:
center ± multiplier × ATR(period), where the ATR is Wilder-smoothed true range.atrSupportAndResistance(input) -
Pivot Range Width verified
Measures the central pivot range rather than its bands:
bottomis the previous bar's midpoint(H + L) / 2,topis that midpoint reflected through the pivot, andwidthis the absolute distance between them.pivotRangeWidth(input)
What they share#
Every topic here is a row-classify</code> or <code>record-transform, so once you have
called one the rest follow the same shape. Import paths differ only in the final segment:
import { detectCausalPivots } from "fintech-algorithms/geometric-chart-patterns/pivots-and-levels/causal-pivot-detection";
import { zigzagSegment } from "fintech-algorithms/geometric-chart-patterns/pivots-and-levels/zigzag-segmentation";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.