> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xarchive.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Liquidation clusters

> The single biggest long and short liquidation level within 10% of the price, as of each bar.

<Frame caption="BTC on 15-minute bars in the 0xArchive Terminal, 2026-10-15.">
  <img src="https://mintcdn.com/0xarchive-e895b8e7/_p6Z1TtSEb5DBnPX/images/terminal/examples/liquidation-clusters.webp?fit=max&auto=format&n=_p6Z1TtSEb5DBnPX&q=85&s=c73c16f6fe94f38bd9f42f3134776643" alt="Liquidation clusters on a BTC chart" width="1038" height="664" data-path="images/terminal/examples/liquidation-clusters.webp" />
</Frame>

<Card title="Open on a chart" icon="chart-candlestick" href="https://terminal.0xarchive.io/?symbol=BTC&interval=15m&scripts=example%3Aliquidation-clusters" horizontal>
  Load it on BTC 15m in the terminal, then change its settings or open it in the script editor.
</Card>

On every bar, a dot at the price of the biggest cluster of long liquidations and of short liquidations, from the snapshot as of that bar. Watching the dots over time shows where the market's pain points sat and when price went to collect them.

## How it works

The dots use `autoscale: false`, so levels up to 10% away do not squash the candles into a line: they are drawn where they fall, and the parts outside the view are simply not seen. See [Liquidation levels ahead](/terminal/examples/liquidation-levels-ahead) for the newest snapshot drawn as lines.

## The script

```ts liquidation-clusters.ts theme={"theme":"github-dark"}
// The biggest cluster of long and short liquidations within 10% of the price, from the snapshot as of each bar.
// Clusters sit up to 10% away, so they leave the price scale to the candles (autoscale: false).
indicator('Liquidation clusters', { overlay: true });

const chart = bars();
const map = liquidationLevels();
const longs = plot.points('Long cluster', { color: color.down, autoscale: false });
const shorts = plot.points('Short cluster', { color: color.up, autoscale: false });

chart.onBar(() => {
  let bestLong = 0;
  let bestShort = 0;
  let longAt = na;
  let shortAt = na;
  for (const level of map.levels()) {
    if (level.longUsd > bestLong) { bestLong = level.longUsd; longAt = level.price; }
    if (level.shortUsd > bestShort) { bestShort = level.shortUsd; shortAt = level.price; }
  }
  longs.set(longAt);
  shorts.set(shortAt);
});
```

## Next step

See the next example, [Tape CVD](/terminal/examples/cvd).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.