channel builds parallel trend channels by pairing the top rising and falling trendline candidates with their farthest opposite extreme and scoring containment, opposite-rail touches, and channel width.
Parameters
Parameter
Default
Range
Type
Timeframe overrides
window
500
60..2000
integer
—
pivotSpan
3
2..10
integer
4 on <= 5m, 2 on >= 1d
tolAtr
0.25
0.05..1.5
number
—
maxPivots
24
4..40
integer
—
minTouches
3
2..10
integer
—
Algorithm & Nuances
Candidate pool: Takes up to 3 deduplicated rising trendlines and 3 falling trendlines from trendScan (using the same minTouches = 2 fallback as trend).
Opposite rail fitting (channelFit): For each candidate starting at bar a, scans [a, n) to locate the farthest opposite extreme far (highest high above rising support, or lowest low below falling resistance) defining channel vertical width dist.
Containment & opposite touches: Counts bars closing within [lo - tol, hi + tol] (inside) and opposite-rail touches within tol spaced by at least TOUCH_GAP = 3 bars (oppTouches).
Penalizing widthAtr > 8 prevents overly wide, uninformative channels from beating tight structures. Picks the single highest-scoring channel across both directions (tie-break: newer second anchor b, then rising).
Drawings & Facts
Drawings: 0 or 1channel overlay showing a solid base rail, a dashed parallel rail through offset, a faint dashed 50% median line, and a translucent fill, projected to the right edge. Labeled (Rising|Falling) channel · baseT+oppT touches · widthAtr ATR.
Facts (ChannelFacts): base (anchor line), offset (opposite anchor), width, widthAtr, closesInside, oppositeTouches, medianAtEnd, and positionInChannel (all null when no qualifying base trendline exists).