Risk reversal skew
Risk reversal skew shows whether puts, which pay when price falls, cost more than calls, which pay when it rises.
It compares their implied volatility (how big a move option prices expect), on options ending about 30 days out. A reading below zero means puts cost more and traders fear a drop, above zero the reverse. Bars under the chart show the gap at nine distances from the price, and a card names the verdict. Use it to gauge fear before a move, on any chart whose symbol has listed options.
Under the hood: the recipe reads options_chain.cells on the live bar with the atm and delta_band page views (Data sources, Chain page views). So the chart reads only each expiry's at-the-money contracts and, on the expiry nearest Days to expiry, those from 7.5 to 27.5 delta. It finds each wing with the options kit's IvTerm at the chain's as-of, optionsAsOfMs (Options kit). It names the expiry with TextBuilder.expiry and fbExpiryLabel (A second builder, Panel frames). It draws a panel.bars frame with a per-run title (Cards, frames and panels). A render.hud card with no look word sits beside it (HUD cards, The default look). It is also the skew template, the Risk Reversal Skew card under HUDs in the editor's starter list, and it compiles as written.
The wrun indicator
// Risk Reversal Skew: whether traders pay more for puts or for calls on this symbol's options, right now. A put pays
// when price falls, and a call pays when it rises. The risk reversal is the call's implied volatility (how big a move
// option prices expect) minus the put's. It compares options at the same distance from the price, on one expiry (the
// day the option ends). Below zero, puts cost more: traders pay up to protect against a drop. Above zero, calls cost
// more: traders chase a rise. Bars under the chart show this gap at nine distances from the price, and a card names the
// verdict. Use it to gauge fear or greed before a move.
//
// Technical notes: how the chart's own option chain prices its two wings for one expiry, the one nearest 30 days out by
// default. The risk reversal is the call's implied volatility minus the put's at the same distance from the money, in
// vol points: below zero the puts are richer (downside protection costs more), above zero the calls. Bars under the
// chart read it at nine deltas, from 27.5 near the money to 7.5 in the wings; a card reads the skew in one plain line
// first (Puts rich: protection against a drop costs more), then the 25 and 10 delta risk reversals, the four wing IVs,
// the at-the-money IV and the smile's asymmetry. Each wing is the strike where the contract's delta, read off its own
// IV at the expiry's forward, equals the target, interpolated between the two listed strikes around it. This reads call
// minus put; some tools quote put minus call, the same number with the sign flipped. Where the expiry lists no 25 delta
// wing, the asymmetry falls back to the calls' mean IV within 7% above spot minus the puts' within 7% below. The chain
// rides the live bar only: history bars draw nothing; it is read at its as-of, the live bar's close (optionsAsOfMs), so
// a coarse bar's open never stretches the time to expiry.
section("Expiry");
param.number("days", 30, { min: 1, max: 400, step: 1, label: "Days to expiry", description: "Reads the expiry nearest this many calendar days away. An expiry that ends today never counts." });
param.number("flat_points", 1, { min: 0, max: 10, step: 0.25, label: "Flat band, IV points", description: "The card calls the skew flat while the call and put IVs sit this close to each other." });
param.number("rate_pct", 4, { min: 0, max: 20, step: 0.25, label: "Interest rate, percent", description: "The interest rate that projects a US stock's price to the expiry. Futures and crypto options do not need it." });
input("close", ohlcv.close); // the chart's own close: spot where a contract reports no underlying
input("chain", options_chain.cells, { max_cells: 16000, venue: "auto", page_views: ["atm", "delta_band"], expiry: "@days", lo: 0.075, hi: 0.275, rate: "@rate_pct", description: "This symbol's options: US listed options on a stock, CME options on a future, Deribit options on BTC and ETH. It reads each expiry's at-the-money contracts and, on the chosen expiry, those from 7.5 to 27.5 delta." }); // [strike, expiry_ms, side, oi, gamma, delta, mark_iv, underlying, multiplier, vega] per contract, in the chain's order
market.zone(); // the market's clock: 0 UTC (crypto), 1 New York (US stocks), 2 Chicago (CME): the expiry's date and the forward
chart.interval_sec(); // the bar's length: the chain's as-of is the live bar's close time, the block naming none
// The readings, data-only: the card's tiles read them and the Console can too. Each is NaN on history bars.
output("rr25", none, overlay, { description: "The 25 delta risk reversal: the call's IV minus the put's, in IV points. Below zero, puts cost more. Live bar only." });
output("rr10", none, overlay, { description: "The 10 delta risk reversal: the call's IV minus the put's, in IV points" });
output("call25_iv", none, overlay, { color: "theme.up", description: "The 25 delta call's IV, in percent" });
output("put25_iv", none, overlay, { color: "theme.down", description: "The 25 delta put's IV, in percent" });
output("call10_iv", none, overlay, { color: "theme.up", description: "The 10 delta call's IV, in percent" });
output("put10_iv", none, overlay, { color: "theme.down", description: "The 10 delta put's IV, in percent" });
output("atm_iv", none, overlay, { description: "The expiry's at-the-money IV, in percent: the mean of the call and put IV at the strike nearest the price" });
output("asymmetry", none, overlay, { description: "The smile's tilt in IV points: the 25 delta risk reversal. Without 25 delta options, it compares calls up to 7% above the price with puts up to 7% below." });
output("asymmetry_fallback", none, overlay, { description: "1 when the tilt uses the 7% fallback, 0 when it is the 25 delta risk reversal" });
output("expiry_days", none, overlay, { description: "Days until the chosen expiry, on the market's own calendar" });
output("tone", none, overlay, { description: "The headline's verdict: 0 puts rich, 1 flat or no reading, 2 calls rich. Live bar only." });
string("read", { max_bytes: 64 }); // the headline: the skew in one plain line, or why there is no reading
string("title", { max_bytes: 48 }); // the card's title: the expiry, its days to go and the convention
const rr_rows = frame("rr_rows", { max_bytes: 2048 }); // the bars: [delta, call minus put] per delta, near the money first
// Under the chart: one bar per delta, the up colour where the call side is richer, the down colour where the put side
// is, the expiry in the title (written per run into the frame); the card's headline names the verdict.
panel.bars({ name: "rr_by_delta", title: "Call minus put by delta", x: "category", place: "below", frame: rr_rows, orientation: "vertical", color_mode: "sign", positive_color: "theme.up", negative_color: "theme.down", series: [{ name: "Call minus put" }], format: "0.00", unit: "pts", x_title: "Delta", hover_card: true, legend_style: "title", height_frac: 0.18 });
// The card: the plain line leads as the headline, the title names the expiry and the convention.
render.hud("skew", {
position: "bottom_center",
title: "{{title}}",
columns: 2,
tiles: [
tile.pill("Skew", "read", { headline: true }),
tile.value("25 delta, call minus put", "rr25", { format: "0.00" }),
tile.value("10 delta, call minus put", "rr10", { format: "0.00" }),
tile.rows([
["25 delta call IV", "call25_iv", "0.00"],
["25 delta put IV", "put25_iv", "0.00"],
["10 delta call IV", "call10_iv", "0.00"],
["10 delta put IV", "put10_iv", "0.00"],
["At-the-money IV", "atm_iv", "0.00"],
["Smile asymmetry", "asymmetry", "0.00"],
]),
],
});
const TUPLE = 10; // f64s per contract: strike, expiry_ms, side, oi, gamma, delta, mark_iv, underlying, multiplier, vega
const MAX_EXPIRIES = 64; // live expiries the term keeps, the nearest when the chain lists more
const WING_SHARE = 0.07; // the asymmetry fallback's strikes: within 7% of spot
const DELTAS: f64[] = [0.275, 0.25, 0.225, 0.2, 0.175, 0.15, 0.125, 0.1, 0.075]; // the bars, near the money first
const DELTA_LABELS: String[] = ["27.5", "25", "22.5", "20", "17.5", "15", "12.5", "10", "7.5"];
const expiryText = new TextBuilder(16); // the expiry's label, the kit's spelling, copied into the title
let term = new IvTerm(1); // the chain's expiries and their wings, built in onStart()
let days = 30.0; // settings, read in onStart()
let flatPoints = 1.0;
let rate = 0.04;
let zone = 0;
let intervalMs = 0.0; // the bar's length in milliseconds; 0 where the host writes none
let nowMs: f64 = NaN; // the chain's as-of, the live bar's close
let row = -1; // the expiry read on the live bar; -1 when there is none
let rr25: f64 = NaN; // the readings, measured on the live bar
let rr10: f64 = NaN;
let call25: f64 = NaN;
let put25: f64 = NaN;
let call10: f64 = NaN;
let put10: f64 = NaN;
let atm: f64 = NaN;
let asymmetry: f64 = NaN;
let fallback = false;
function onStart(): void {
term = new IvTerm(MAX_EXPIRIES); // the per-expiry buffers are the module's only allocation
days = p_days();
flatPoints = p_flat_points();
zone = i32(p_market_zone());
intervalMs = p_chart_interval_sec() * 1000.0;
rate = zone == 1 ? p_rate_pct() / 100.0 : 0.0; // a futures or crypto underlying already is the forward
}
// ── The expiry's wings ──
function riskReversal(e: i32, delta: f64): f64 { // the call's IV minus the put's at |delta|, vol points; NaN where a wing is missing
return (term.deltaIv(e, 1.0, delta) - term.deltaIv(e, -1.0, delta)) * 100.0;
}
function wingAsymmetry(cells: StaticArray<f64>, n: i32, e: i32): f64 { // the calls' mean IV within 7% above spot minus the puts' within 7% below, vol points
const expiry = term.expiry(e);
const spot = term.underlying(e);
let callSum = 0.0;
let callCount = 0;
let putSum = 0.0;
let putCount = 0;
for (let i = 0; i + TUPLE - 1 < n; i += TUPLE) {
const strike = cells[i];
if (cells[i + 1] != expiry || !(strike > 0.0) || !(cells[i + 6] > 0.0)) continue;
if (Math.abs(strike / spot - 1.0) > WING_SHARE) continue;
if (cells[i + 2] > 0.0) {
if (strike > spot) {
callSum += cells[i + 6]; // mark IV rides the chain in vol points already
callCount += 1;
}
} else if (strike < spot) {
putSum += cells[i + 6];
putCount += 1;
}
}
if (callCount == 0 || putCount == 0) return NaN;
return callSum / f64(callCount) - putSum / f64(putCount);
}
function measure(cells: StaticArray<f64>, n: i32, e: i32): void {
rr25 = riskReversal(e, 0.25);
rr10 = riskReversal(e, 0.1);
call25 = term.deltaIv(e, 1.0, 0.25) * 100.0;
put25 = term.deltaIv(e, -1.0, 0.25) * 100.0;
call10 = term.deltaIv(e, 1.0, 0.1) * 100.0;
put10 = term.deltaIv(e, -1.0, 0.1) * 100.0;
atm = term.atmIv(e) * 100.0;
fallback = isNaN(rr25);
asymmetry = fallback ? wingAsymmetry(cells, n, e) : rr25;
}
// ── The bars and the card's words ──
function writeBars(e: i32): void {
fb_clear();
fb_text("{\"title\":\"Call minus put by delta, ");
fbExpiryLabel(term.expiry(e), nowMs, zone); // the expiry's trade date: 21 Nov, or 15 Jan '27 in another year
fb_text("\",\"rows\":[");
for (let k = 0; k < DELTAS.length; k += 1) {
if (k > 0) fb_text(",");
fb_text("[");
fb_str(DELTA_LABELS[k]);
fb_text(",");
fb_num(riskReversal(e, DELTAS[k])); // null where a wing is missing
fb_text("]");
}
fb_text("]}");
writeFrameBuffer(rr_rows);
}
function writeWords(e: i32): void {
sb_clear();
if (isNaN(asymmetry)) sb_text("No puts and calls to compare on this expiry");
else if (asymmetry < -flatPoints) sb_text("Puts rich: protection against a drop costs more");
else if (asymmetry > flatPoints) sb_text("Calls rich: bets on a rise cost more");
else sb_text("Flat: puts and calls cost about the same");
str_read_sb();
sb_clear();
expiryText.clear().expiry(term.expiry(e), nowMs, zone);
for (let i = 0; i < expiryText.length(); i += 1) sb_char(load<u8>(<usize>expiryText.ptr() + <usize>i));
sb_text(", ");
const left = i64(term.days(e));
sb_int(left);
sb_text(left == 1 ? " day, call minus put" : " days, call minus put");
str_title_sb();
}
// onBar() runs once per bar: history rows carry an empty block and cost one read; the live bar loads the chain into the
// term, picks the expiry nearest the setting's days and reads its wings. Then the readings (NaN on history rows), the
// bars and the card's words on the live bar only.
function onBar(): void {
const close = bar.close();
const t = bar.time();
row = -1;
let chainCells = -1;
let kept = 0;
if (bar.isLast() && !isNaN(close) && !isNaN(t)) {
chainCells = in_chain_cells();
if (chainCells >= TUPLE) {
const cells = in_chain_view(); // the live chain in place: the first n values of the build's own buffer
nowMs = optionsAsOfMs(t * 1000.0, intervalMs); // the chain's as-of: the live bar's close time
kept = term.load(cells, chainCells, nowMs, close, zone, rate);
row = term.nearest(days); // an expiry after today with an at-the-money IV, nearest the setting's days
if (row >= 0) measure(cells, chainCells, row);
}
}
const reading = row >= 0;
out_rr25(reading ? rr25 : NaN);
out_rr10(reading ? rr10 : NaN);
out_call25_iv(reading ? call25 : NaN);
out_put25_iv(reading ? put25 : NaN);
out_call10_iv(reading ? call10 : NaN);
out_put10_iv(reading ? put10 : NaN);
out_atm_iv(reading ? atm : NaN);
out_asymmetry(reading ? asymmetry : NaN);
out_asymmetry_fallback(reading && !isNaN(asymmetry) ? (fallback ? 1.0 : 0.0) : NaN);
out_expiry_days(reading ? term.days(row) : NaN);
out_tone(reading && !isNaN(asymmetry) ? (asymmetry < -flatPoints ? 0.0 : asymmetry > flatPoints ? 2.0 : 1.0) : bar.isLast() ? 1.0 : NaN);
if (reading) {
writeBars(row);
writeWords(row);
} else if (bar.isLast()) {
// Nothing to read on the live bar: the headline says why, so the card is never a row of blanks.
sb_clear();
sb_text(chainCells < TUPLE ? "Waiting for the options chain" : kept == 0 ? "No expiry is still trading" : "No expiry with an at-the-money IV");
str_read_sb();
sb_clear();
sb_text("Skew, nothing to read yet");
str_title_sb();
}
}How it works
One expiry, picked by its distance. The chain loads into an IvTerm on the live bar, and term.nearest(days) picks the expiry whose time to expiry is nearest the Days to expiry setting (30), among the expiries after today that carry an at-the-money IV: an expiry settling today never counts, because its implied volatility swings with the hours left. Its time to expiry counts from the chain's as-of, optionsAsOfMs(): the live bar's close time, never its open. The card's title names it by its label, its trade date on the market's own calendar (TextBuilder.expiry), and its days to go.
A wing is a strike at a delta. For each target, 0.25 for the 25 delta wing, term.deltaIv(e, side, delta) finds the strike on the calls (or the puts) where the contract's delta, read off its own IV at the expiry's forward with no discount (N(d1) for a call, N(-d1) for a put, the convention skew is quoted in), equals the target, and interpolates the IV linearly in delta between the two listed strikes around it. The forward is the underlying times e^(rate * years) on a US stock, at the Interest rate setting (4%), and the underlying itself on futures and crypto, which already quote the forward. A target the expiry lists no strike beyond reads -: a narrow chain has no 10 delta wing.
The risk reversal is call minus put. rr25 is the 25 delta call's IV minus the 25 delta put's, rr10 the same at 10 delta, both in vol points; call25_iv, put25_iv, call10_iv and put10_iv are the four wings in percent, and atm_iv the expiry's at-the-money IV (the mean of the call and put IV at the strike nearest its forward). On most equity and index chains the puts are richer and the number is negative, steeper at 10 delta than at 25; a positive number means the market pays more for upside calls than for downside puts.
The smile's asymmetry. asymmetry is the 25 delta risk reversal. Where the expiry lists no 25 delta wing on one side, it falls back to the calls' mean IV over the strikes up to 7% above spot minus the puts' mean IV over the strikes up to 7% below, in vol points, and asymmetry_fallback reads 1.
The headline. Within the Flat band (1 vol point) of zero the card reads "Flat: puts and calls cost about the same"; below it, "Puts rich: protection against a drop costs more"; above it, "Calls rich: bets on a rise cost more". tone carries the same three answers as 0, 1 and 2 for the Console; the headline itself draws in the card's text colour.
The bars. One bar per delta under the chart, 27.5 nearest the money on the left out to 7.5 on the right, each the call's IV minus the put's at that delta; the frame carries the expiry's label in the panel's title (fbExpiryLabel: Call minus put by delta, 20 Nov), and the verdict reads on the card's headline only.
What the settings do
- Days to expiry: The card reads the expiry nearest this many calendar days away, never one that ends today.
- Flat band, IV points: The card calls the skew flat while the call and put IVs sit this close to each other.
- Interest rate, percent: The rate that projects a US stock's price to the expiry, which futures and crypto options do not need.
- Skew: The verdict in words: puts rich, calls rich or flat.
- 25 delta, call minus put: The call's IV minus the put's, both a moderate distance from the price (some tools flip the sign).
- 10 delta, call minus put: The same gap for options far from the price, where crash fear shows most.
- 25 delta call IV: The implied volatility of the call a moderate distance above the price.
- 25 delta put IV: The implied volatility of the put a moderate distance below the price.
- 10 delta call IV: The implied volatility of the call far above the price.
- 10 delta put IV: The implied volatility of the put far below the price.
- At-the-money IV: The implied volatility at the strike nearest the price, the expiry's baseline.
- Smile asymmetry: How lopsided the IV curve across strikes is, in IV points: below zero, the downside costs more.
Where it runs
It works on charts of coins that Deribit (a crypto options exchange) lists options for. Those are BTC, ETH, SOL and the rest of its list. A copy you run from the editor (the code panel beside the chart) reads those coins' options. On a US stock chart it reads that stock's US listed options. On a CME (Chicago futures exchange) futures chart it reads the options on that future. Every indicator reads US listed options, 15 minutes behind unless you have real-time US options data. Every indicator in your browser reads CME options too, once you accept the CME market data terms. They run 10 minutes behind unless you have real-time CME data, and the legend names the source. Editor copies, your published copies and Protected copies (their code stays on OpenMarket's servers) all read US listed options. So does a copy run with Run on Cloud (the editor switch that runs it on OpenMarket's servers). A Protected copy and a Run on Cloud copy do not run on a CME chart.
When data is missing
The headline always says why it has no verdict, so the card never goes blank. It reads "Waiting for the options chain" while the live bar has no options data yet. It reads "No expiry is still trading" when every listed expiry has passed. It reads "No expiry with an at-the-money IV" when the live expiries all end today or lack an IV. It reads "No puts and calls to compare on this expiry" when the expiry has no strikes to compare. That happens when neither the 25 delta options nor the 7% fallback have a strike on both sides. A distance the expiry does not reach shows "-" on its line and leaves its bar out.
Customize it
- Another horizon. Set Days to expiry to 7 for the weekly smile or 90 for the quarterly; the title names the expiry it reads.
- A tighter verdict. Lower the Flat band to call a smaller tilt rich, or raise it to keep the headline flat through ordinary equity skew.
- The other convention. Negate
rr25,rr10and the bars where you want put minus call; the risk reversal is the same number with its sign flipped.
Run it
- In the editor's Explorer, press the Templates icon ("Browse starter templates") and pick Risk Reversal Skew under HUDs.
- Press Run on a BTC chart: the bars stand under the chart once the chain arrives and the card appears at the bottom centre, titled by the expiry nearest 30 days.
- At the editor's Console prompt, type
rr25andasymmetryto read the 25 delta risk reversal and the smile's asymmetry on the live bar.
Concepts used
- Data sources for the
options_chaincelled class, its tuple and thevenueword - Options kit for
IvTerm,nearest,deltaIvand the expiry's forward, andoptionsAsOfMs - A second builder for
TextBuilder.expiryand Panel frames forfbExpiryLabel, the expiry's label in the card's title and the panel's - Cards, frames and panels for frames and
panel.barswith a per-run title - HUD cards, Blocks and tiles and The default look for the card, its tiles, the slot in the title and what a card with no
lookdraws