Rectangle
A rectangle is a consolidation bounded by two roughly horizontal, parallel lines: price oscillates between a flat ceiling and a flat floor, with classical convention asking for at least two touches of each boundary before the pattern earns the name. Rectangle, also known as box, Darvas box, is a Chart & Candlestick Patterns concept. The Library holds 1 implementation, ready to run on Vela.
Top Rectangle indicator
The top custom implementation, built on the original standard Rectangle formula.
1 total
See the Rectangle implementation below on Vela, our next-generation charting platform, then ask Quant to turn it into a strategy you can backtest.
What is a Rectangle?
A rectangle is a consolidation bounded by two roughly horizontal, parallel lines: price oscillates between a flat ceiling and a flat floor, with classical convention asking for at least two touches of each boundary before the pattern earns the name. It is the chart-pattern formalization of a trading range, and the box variants popularized by Nicolas Darvas in the 1950s treat each completed rectangle as a building block in a trending stock.
The pattern has been in the canon since the earliest chart-pattern taxonomies, where it was catalogued alongside triangles as the basic sideways formation, and it acquired its most famous variant when Darvas described his box method in the 1960 bestseller about running his stock account up while touring as a dancer. The box's appeal was always its objectivity: a ceiling proven by failed pushes, a floor proven by held dips, and a rule for what to do when either gives way.
Rectangles resolve by breakout. Classical texts file them under continuation patterns because the break tends to go with the prior trend, but the boundaries carry no directional obligation and either side can give way. The standard measure rule projects the box's height from the breakout level to set a minimum objective.
What happens inside the box is the analytical question. A rectangle is two-sided by definition, sellers defending the ceiling, buyers the floor, and the volume pattern (conventionally contracting through the range, expanding on the resolution) plus the character of each boundary test hint at which side is absorbing. The pattern's known failure modes are the false breakout that traps one side before the real move goes the other way, and the slow bleed where a range simply dissolves into drift without ever resolving cleanly.
How to identify a rectangle on a chart
The boundaries must be proven by touches, not drawn by hope.
- 1Find a consolidation whose highs stall repeatedly at one level and whose lows hold repeatedly at another, with at least two genuine touches per boundary.
- 2Check the boundaries are roughly horizontal and parallel; sloping boundaries belong to channels and wedges, converging ones to triangles.
- 3Watch volume behavior: conventionally it contracts inside the box and expands on the resolution, so a quiet interior with busy boundary tests fits the pattern.
- 4Measure the box height at formation; that is the measure-rule projection base for the eventual break.
- 5Take the resolution on a decisive close beyond a boundary, not on an intrabar poke, and treat re-entry into the box as the failure signal.
- 6Grade the context: a rectangle after a strong advance resolving upward is the textbook continuation; the same box at a long-term top or bottom can be the reversal structure instead.
How traders use it
- Breakout trading: enter on a close beyond a boundary, target the box height projected from the break, and invalidate on a return inside the range; a failed break that falls back into the box is a standard cue to stand down or reverse.
- Range trading inside wide rectangles: fading the floor and ceiling while the box holds, with the known failure mode that the rotation which ends in a breakout stops out whoever faded it.
- Darvas-style trend following: in an uptrend, each new box forming above the previous one is read as continuation; entries go on the break of the box top with a stop under the box low, ratcheting upward as new boxes stack.
- Reading the interior lean: a partial rise that fails to reach the ceiling before rolling over, or a partial decline that never tests the floor, is a documented tendency toward the opposite boundary breaking, and traders use those incomplete rotations as an early bias read.
- Triggering off boundary candles: bar-level signals at the edges, a pin bar rejecting the floor or an engulfing bar at the ceiling, give range traders defined entries and stops inside the larger box logic.
Rectangle vs. neighboring patterns
Trading Range: Trading range names the market condition of two-sided rotation; rectangle is the drawn pattern, with touch conventions, boundary lines, and a measure-rule target attached.
Bull/bear Flag: Flags are brief pauses that slope against the preceding impulse; rectangles are horizontal, typically last longer, and need not sit on a flagpole.
Ascending/descending/symmetrical Triangle: Triangles have at least one converging boundary, so the range narrows toward an apex; a rectangle's boundaries stay parallel and the range width holds.
Rectangle FAQ
Turn Rectangle into a trading strategy.
Open the implementation from this page in Vela. Quant, our coding agent, builds the strategy with you and backtests it on real data.
Browse this familyChart & Candlestick Patterns88 concepts mapped · 88 in the Library
- Abandoned Baby
- Ascending Base
- Ascending/descending/symmetrical Triangle
- Bart Pattern
- Belt Hold
- Breakaway Gap
- Breakout Confirmation
- Broadening Formation
- Bull/bear Flag
- Bullish/bearish Engulfing
- Bump-and-run Reversal
- Candlestick Patterns
- Channel Continuation
- Classic Bar Setups
- Common Gap
- Complex H&S
- Cup & Handle
- Cup-with-handle Base
- Dark Cloud Cover
- Dead-cat Bounce
- Diamond Top/bottom
- Doji
- Double Top/bottom
- Double-bottom Base
- Dragonfly Doji
- Engulfing Bar
- Evening Star
- Exhaustion Bar
- Exhaustion Gap
- Final Flag
- Flat Base
- Gap Fill
- Gap-and-go
- Gravestone Doji
- Hammer
- Hanging Man
- Harami
- Head & Shoulders
- High Tight Flag
- High-wave Candle
- Hikkake
- Inside Bar
- Inverse Head & Shoulders
- Inverted Hammer
- IPO Base
- Island Reversal
- Key Reversal
- Kicking
- Marubozu
- Mat Hold
- Matching Low/high
- Measure Rule
- Measured-move Up/down
- Morning Star
- O'Neil Base Analysis
- On-neck / In-neck / Thrusting
- Outside Bar
- Pennant
- Piercing Line
- Pin Bar
- Rare Candlestick Formations
- Rare Reversal Patterns
- Rectangle
- Rising/falling Three Methods
- Rising/falling Wedge
- Rounding Top/bottom
- Runaway Gap
- Scallop
- Shooting Star
- Spike and Channel
- Spinning Top
- The Strat
- Three Black Crows
- Three Inside Up/down
- Three Outside Up/down
- Three Rising Valleys/falling Peaks
- Three White Soldiers
- Three-bar Reversal
- Tri-star
- Triple Top/bottom
- Tweezer Top/bottom
- Two-bar Reversal
- Upside/downside Tasuki Gap
- V-top/V-bottom
- Volume Signature per Pattern
- Weekend Gap
- Wide-range Bar
- Wolfe Waves
