Rectangle pattern screener: trading ranges and breakouts

Find rectangles on daily candles: flat trading ranges whose top and bottom were each tested at least twice, with the range’s length, height and touches, and fresh breakouts from either side. Opens on crypto with no key; switch markets above the table.

Crypto: daily candles from Binance’s public data. Crypto perps: OKX. US stocks and ETFs: Alpaca, with your own free key. CME futures: Massive, with your own free key. Not investment advice.

What qualifies

  • Box: the highest high and lowest low over 20 to 120 days. Its height is at least the larger of 5% and 2.5× ATR, and at most the larger of 20% and 6× ATR, never more than 35%.
  • Touches: at least two swing highs (3 days on each side) within 15% of the box height of the top and two swing lows as close to the bottom, at least 8 days apart. The box starts at one of these swings.
  • Flat: the average close of the box’s second half is within 30% of the box height of the first half’s, so steady trends don’t count.
  • Status: Inside, or Breaking out / Breaking down when the first close outside the box was in the last 10 days and every close since stayed outside on that side.

About this setup

What it is
A rectangle is a sideways range: buyers keep stepping in near the same low and sellers near the same high, so price moves between two roughly horizontal levels.
How traders use it
Range traders buy near the bottom and sell near the top while the range holds. Breakout traders wait for a close outside the box and often project the box height from the breakout level as a first target.
Caveats
Many range breakouts fail and price returns inside, so some traders wait for a retest or higher volume. A range that slowly drifts up or down may be better read as a channel.

Patterns are found mechanically on daily candles from the data provider. Not investment advice.

Frequently asked questions

What does the quality score mean?

It’s a 0–100 score of how cleanly the pattern fits the rules above (for example, how tight the flag is, how round the cup is, or how closely the two lows match). It isn’t a probability and says nothing about what price does next. Use it to sort the list, then look at the chart: click a symbol to open it on FreeCharting.

Are these patterns reliable?

Chart patterns are a way to describe price action, not a prediction. Many fail, and they work differently in different markets. The detection is mechanical: a pattern can qualify on the numbers and still look wrong to your eye, and a pattern you’d draw by hand may miss one rule. Nothing here is investment advice.

Which markets can it scan?

Four, picked with the Market buttons above the table. Crypto (the default) scans the 250 busiest USDT pairs on Binance. Crypto perps scans the 200 busiest USDT perpetual futures on OKX. Both are free public data and need no key. US stocks scans about 600 US stocks and ETFs with your own free Alpaca key, and CME futures scans about 25 front-month CME Group contracts (stock indexes, Treasuries, oil, gas, metals, grains, livestock, currencies and CME bitcoin) with your own free Massive key.

Why do stocks and futures need a key?

Stock and futures prices are licensed data, so a website can’t hand them out for free. Alpaca (for stocks) and Massive (for futures) give anyone a free data key. Your key is saved only in your browser and sent only to that provider. See how to get a free Alpaca key and how to get a free Massive key for futures.

Is the data real-time?

Crypto and crypto perps are live from Binance and OKX, on daily candles that start at 00:00 UTC (today’s candle is still forming). Alpaca’s free stock data is 15 minutes behind the market, and Massive’s free futures plan is 8 hours delayed. Turn on auto-refresh next to the results to update the table in place every 30 seconds, minute or 5 minutes.