Rectangle
By LuxAlgoApr 7, 2026
Rectangle finds the sideways box the classical way: confirmed swing highs clustering into a flat ceiling, confirmed swing lows into a flat floor, each boundary proven by at least two genuine touches within an ATR-scaled tolerance, and no decisive close beyond either side across the formation. Once confirmed, the rectangle has no expiry — the box extends until a boundary gives way — with the proving touches dotted on the chart.
How to Trade the Rectangle?
- Decisive close beyond a boundary: the breakout label prints with volume as a multiple of its recent average — a conspicuously quiet break earns suspicion.
- Measured target: the box height projected from the broken boundary — the classical minimum objective — drawn dotted until reached.
- Failed breakout: a close back inside before the objective traps one side; a cue to stand down or consider the reverse.
- Partial rise / partial decline: an incomplete rotation — the documented lean toward the opposite side breaking.
Ceiling and floor tests inside the box carry their own alerts — nine in total.
Rectangle Settings
- Swing Length (default 5): bars each side to confirm swing touches.
- Minimum Touches per Boundary (default 2): the classical proof standard.
- Boundary Tolerance (default 0.5) with Tolerance ATR Length (default 14): how far touches may spread and still count as one boundary.
- Maximum Formation Length (default 200): the bar span allowed between the first and last touch.
- Measured Target, Mark Failed Breakouts, Volume Note on Breakouts (all default enabled) with Volume Average Length (default 20).
- Partial Rises & Declines (default enabled) with Minimum Rotation % (default 50); style inputs cover colors and touch markers.
Frequently Asked Questions
How does a rectangle differ from a triangle?
Boundaries. A rectangle's ceiling and floor are horizontal and parallel, so the range never contracts; ascending, descending and symmetrical triangles have at least one sloping boundary converging toward an apex. The tolerance check exists to reject touch clusters that slope.
Which way does a rectangle break?
The pattern is two-sided by construction — the box stays direction-neutral until it resolves. Classical texts file it as continuation because breaks tend to go with the prior trend, but neither boundary carries an obligation.
What do partial rises and declines signal?
A rotation that leaves one boundary, travels at least half the box height by default, then rolls over before tagging the other side. Pattern studies document them as a lean toward the opposite boundary breaking — a tilt, not a trigger.
The Library is free. Quant makes it yours.
Pull any concept or indicator into Quant: rebuild it, retune it, or turn it into a backtested strategy of your own.
