Research with options levels
Options levels are data your own scripts can read. This page has three scripts to start from on the SP500 chart: an indicator that draws the walls and the gamma flip, a definition that marks every touch of the put wall, and a study that measures what price did next. How each level is worked out is on How options levels are calculated.
Reading the levels needs Pro. Scripts are TypeScript: Pine indicators cannot read options data.
Ask the Agent
The Agent knows the options data and writes these scripts for you. Describe what you want on SP500:
Draw the call wall, put wall and gamma flip on SP500.
Mark every time SP500 trades down to the put wall and closes back above it, then tell me what happened over the next hour.
Split SP500's put wall touches by whether price was above or below the gamma flip.
The rest of this page is for writing them yourself.
Draw the levels
Paste this into a new indicator from Tools → Indicators (see Build a custom indicator) and add it to an SP500 chart.
meta({ shortName: "Walls", kind: "overlay" });
dialog({ title: "Options walls" });
const lv = dataset("options.eod.levels", {
where: { instrument: { fromInstrument: true }, view: "combined" },
});
output.line({ id: "callWall", color: "#26a69a", name: "Call wall" });
output.line({ id: "putWall", color: "#ef5350", name: "Put wall" });
output.line({ id: "flip", color: "#ffb300", name: "Gamma flip" });
export function onBar(ctx) {
const r = lv.last;
if (!r) return;
if (r.callWall !== undefined) ctx.plot("callWall", r.callWall);
if (r.putWall !== undefined) ctx.plot("putWall", r.putWall);
if (r.flip !== undefined) ctx.plot("flip", r.flip);
}Each line steps to the new day's level at about 09:50 New York time, when that day's levels take effect. Change view to "index" for SPX and SPXW alone, or "etf" for SPY.
Mark every put wall touch
This definition fires once a day, on the first closed bar that opens above the put wall and trades down to it. rejected records whether the bar closed back above.
meta({ name: "Put wall touch", kind: "flow", slug: "put-wall-touch", shortName: "PutWall" });
const lv = dataset("options.eod.levels", {
where: { instrument: { fromInstrument: true }, view: "combined" },
});
events.declare({
id: "put_wall_touch",
intent: "signal",
payload: {
wall: { type: "number", description: "The put wall the bar traded down to, in chart prices" },
close: { type: "number", description: "Close of the bar that touched the put wall" },
rejected: { type: "boolean", description: "True when the bar closed back above the put wall" },
tradeDate: { type: "string", description: "The options close the put wall comes from, YYYY-MM-DD" },
},
oncePer: { keys: ["tradeDate"] },
});
outputs.declare({ id: "put_wall", kind: "line", name: "Put wall", color: "#ef5350" });
export function onBar(ctx) {
const r = lv.last;
if (!r || r.putWall === undefined) return;
ctx.plot("put_wall", r.putWall);
if (ctx.barConfirmed === false) return;
if (ctx.open > r.putWall && ctx.low <= r.putWall) {
ctx.emit(
"put_wall_touch",
{ wall: r.putWall, close: ctx.close, rejected: ctx.close > r.putWall, tradeDate: r.tradeDate },
{ label: `Put wall ${r.putWall.toFixed(0)}`, price: r.putWall },
);
}
}Build it from Tools → Definitions with Build it yourself (see Build a definition), then run it over history on SP500 from 19 March 2026, the first day with levels on the chart. For the call wall, swap putWall for callWall and flip the comparisons.
Measure what happened next
This study reads the definition's events, splits them by where price stood against the gamma flip when the put wall was touched, and measures the return over the next hour.
meta({
name: "Put wall reaction",
kind: "study",
params: { horizonMin: { type: "number", def: 60, min: 5, max: 1440, step: 5 } },
});
flows.declare({ slug: "put-wall-touch", as: "touch", version: 1 });
const lv = dataset("options.eod.levels", {
where: { instrument: { fromInstrument: true }, view: "combined" },
});
dimensions.declare({
id: "regime",
title: "Gamma regime",
description: "Whether price was above or below the gamma flip when it touched the put wall",
values: ["above flip", "below flip"],
});
results.declare({ id: "readout__touches", kind: "metric", title: "Touches measured", description: "Put wall touches with a bar at the horizon." });
results.declare({ id: "by_regime", kind: "table", title: "Reaction by regime", description: "Touches, share that bounced and median return over the horizon, above and below the flip.", indexedBy: ["regime"] });
results.declare({ id: "answer", kind: "prose", role: "answer", title: "Answer", description: "How price reacted to the put wall, in one sentence." });
export function scope(ctx) {
if (ctx.event.flow !== "touch") return null;
const r = lv.asOf(ctx.event.knownAt)?.last;
if (!r || r.flip === undefined) return null;
return { regime: ctx.event.payload.close > r.flip ? "above flip" : "below flip" };
}
export function onEvent(ctx, scope) {
const entry = ctx.event.payload.close;
const after = ctx.candles.forward({ minutes: ctx.params.horizonMin });
ctx.collect("rows", { regime: scope.regime, bp: after ? ctx.priceUnits.inBP(after.close, entry) : null });
}
export function onFinish(ctx) {
const rows = ctx.collected("rows").filter((r) => r.bp !== null);
const table = ["above flip", "below flip"].map((regime) => {
const bps = rows.filter((r) => r.regime === regime).map((r) => r.bp);
return {
regime,
n: bps.length,
bounced: bps.length ? bps.filter((b) => b > 0).length / bps.length : 0,
medianBp: bps.length ? ctx.stat.median(bps) : 0,
};
});
ctx.publish("readout__touches", { value: rows.length, label: "Touches" });
ctx.publish("by_regime", table);
const [above, below] = table;
ctx.publish("answer", {
role: "answer",
body: `Above the flip ${Math.round(above.bounced * 100)}% of ${above.n} touches bounced; below it ${Math.round(below.bounced * 100)}% of ${below.n}.`,
});
}lv.asOf(ctx.event.knownAt) is the options data as it stood when the event fired, so the split uses only levels a trader had at that moment. Open the definition's Studies tab, click New study, and paste it in. Read the results explains the run card.
Practise in a backtest
Add the indicator to an SP500 chart in a backtest session. Levels switch at the same time of day they did live, so you trade each session with the levels that were on the chart that morning, and before 09:50 with the day before's.
More ideas
Fade the call wall when price is above the gamma flip, and compare with days below it.
Mark closes outside the expected-move band,
spotplus or minusexpectedMove, and measure the next day.Split any definition you already have by the distance to the nearest wall, read in
scope.On Pro, build your own levels from the per-contract chain in options.eod.contracts, such as gamma from this week's expiries only.
Every field you can read is on Options levels.
Sample size
Levels start with the 18 March 2026 close, on the chart from 19 March, so an event that fires at most once a day has at most one event per trading day since then, and a split by regime has fewer in each group. Check the n on every row before trusting a percentage.
