> ## 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.

# Dealer gamma

> Draw where BTC option dealers flip from damping moves to chasing them, and their biggest gamma strikes.

![Dealer gamma on a BTC chart](https://mintcdn.com/0xarchive-e895b8e7/DrnrnwWnW7x-wb89/images/terminal/examples/dealer-gamma.webp?fit=max\&auto=format\&n=DrnrnwWnW7x-wb89\&q=85\&s=f03f9e26a9b2f9feade6169e167790e4)

BTC on 15-minute bars in the 0xArchive Terminal, 2026-10-24.

> **[Open on a chart](https://terminal.0xarchive.io/?symbol=BTC\&interval=15m\&scripts=example%3Adealer-gamma)**
>
> Load it on BTC 15m in the terminal, then change its settings or open it in the script editor.

Option dealers hedge. Long gamma, they sell rises and buy dips, which damps moves; short gamma, they buy rises and sell dips, which feeds them. This script draws the **gamma flip**, the price where dealers' total gamma changes sign, in blue while dealers are long gamma at BTC's price and red while they are short, with dashed levels at the strikes within 5% of the price where their long and short gamma is largest now. It is the Dealer exposure panel's model, every 5 minutes, on the nearest expiry as the panel opens.

## How it works

`dealerExposure()` is a sample stream: each handler reads the last snapshot at or before its bar. `gamma` is dealers' total at the snapshot's price, in BTC of delta per \$1,000 of price, and `strikes()` lists each strike's net dealer position and what it adds. **Dealer positions from** picks the model: block flow, where dealers hold the other side of block trades, or all trades. **Expiries** picks the nearest expiry, which dominates gamma near the price, or all of them; with all, dealers often stay long gamma well past 6% either way, and the flip reads `na`.

Dealer exposure reaches back 7 days, and starts on 25 September 2026.

## Try changing

* Plot `dealers.charm` in a pane of its own to see what dealers must buy or sell each hour as time passes.
* Alert when the price crosses the flip: dealers stop damping the move there.

## The script

```ts dealer-gamma.ts theme={"theme":"github-dark"}
// Where BTC option dealers flip from damping moves to chasing them, on the chart: the
// gamma flip, blue while dealers are long gamma at BTC's price (they sell rises and buy dips) and
// red while they are short (they buy rises and sell dips), and as levels the strikes within 5% of
// the price where their long and short gamma is largest now. From the Dealer exposure panel's
// model, every 5 minutes, the last 7 days. The nearest expiry dominates gamma near the price, so it
// is the default, as in the panel; with every expiry dealers often stay long gamma all the way out,
// and there is no flip.
indicator('Dealer gamma', { overlay: true, shortName: 'Dealer gamma' });

const model = input.choice('Dealer positions from', 'block', ['block', 'all'], { labels: { block: 'Block flow', all: 'All trades' } });
const expiries = input.choice('Expiries', 'next', ['next', 'all'], { labels: { next: 'Next', all: 'All' } });

const chart = bars();
const dealers = dealerExposure({ model, expiries });
const flip = plot.line('Gamma flip', { width: 2 });

const LONG = color.rgb(77, 148, 240);
const SHORT = color.rgb(239, 79, 90);

chart.onBar(() => {
  if (!dealers.available) return;
  flip.set(dealers.flip, dealers.gamma >= 0 ? LONG : SHORT);
  if (!chart.isLast) return;
  // Now: the strikes that add the most gamma each way at the snapshot's price, as levels across the chart.
  let most = 0;
  let least = 0;
  let mostAt = na;
  let leastAt = na;
  for (const k of dealers.strikes()) {
    if (Math.abs(k.strike / dealers.spot - 1) > 0.05) continue;
    if (k.gamma > most) { most = k.gamma; mostAt = k.strike; }
    if (k.gamma < least) { least = k.gamma; leastAt = k.strike; }
  }
  for (const [at, ink, words] of [[mostAt, LONG, 'Long gamma'], [leastAt, SHORT, 'Short gamma']] as const) {
    if (isNa(at)) continue;
    draw.line({ from: { bar: chart.index - 1, price: at }, to: { bar: chart.index, price: at }, extend: 'left', color: color.withAlpha(ink, 0.7), style: 'dashed' });
    draw.label({ at: { bar: chart.index, price: at }, text: `${words} ${fmt.price(at)}`, style: 'lowerRight', color: color.withAlpha(color.panel, 0.85), textColor: ink, size: 'small' });
  }
});
```

## Next step

See the next example, [Liquidations](https://docs.0xarchive.io/terminal/examples/liquidations.md).


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