OPEN-SOURCE SCRIPT
Aggiornato

Options Buyer's Edge Weekly

1 282
Overview

Options Buyer's Edge — Weekly is a decision-support panel for the weekly index option buyer. Most option tools chase directional "smart-money flow," but on retail-dominated weeklies that flow is largely uninformed — so the durable edge for a buyer isn't direction, it's the premium environment you actually pay for: is implied volatility cheap or rich, is it expanding or crushing, how hard is theta biting toward expiry, and where is the pin magnet pulling price. This script auto-builds an ATM strike ladder for the current weekly, reads the option tape directly, adds a skew-gated directional layer, and then tests every call it makes against your own history. It is a context-and-timing map for buying premium — not a signal generator.

Why these components are ONE tool (mashup justification)

This is a deliberate dependency chain, not a stack of independent indicators. Each layer answers a question the previous one leaves open, and the buyer needs all of them to price what they're doing:


IV / straddle state (primary). The buyer's number-one enemy is paying rich premium into a crush. The ATM straddle gives an IV proxy (percentiled so "rich/cheap" is relative to this instrument's own history) and its slope tells you whether IV is expanding (tailwind) or crushing (bleed). A second read, Prem vs RV, compares that implied vol against realized vol — the variance-risk-premium — so "rich" means rich relative to what the market is actually delivering, not just rich in the abstract.
Theta clock (primary). Premium decays non-linearly into expiry. The panel converts hours-to-weekly-expiry into an escalating decay zone (Normal → Elevated → High → Extreme) so you know when time decay alone makes a long option a bad trade regardless of direction.
Pin magnet (primary). Option volume concentrates at a strike that price tends to gravitate toward near expiry. The tool finds the max-volume strike and draws it — the level a buyer is fighting against.
Underlying character (confirming). Futures basis pulse and India VIX behaviour describe whether the underlying move carries conviction or is unwinding — a cross-check on the directional read.
Directional flow (secondary, gated). A delta-weighted signed CE/PE buyer-pressure imbalance, gated by option skew and trusted only when the calibration Edge for it is positive. Directional option flow predicts returns mainly from informed traders and reverses at longer horizons; on retail weeklies it may be noise — so it earns trust from measured Edge, never from assertion.
The calibration harness (the honesty layer). Two forward tests run continuously: an underlying test (did a strong directional read actually precede a k×ATR move, versus the unconditional base rate?) and a thinner option-outcome test (did the ATM option gain the target % over the horizon?). Both resolve only on confirmed bars, and both are shown as Hit / Base / Edge so you can see whether any layer is carrying information on your instrument right now.


Remove any one layer and the buyer is flying on premium they can't price. The straddle is a picture; theta and pin are mechanics; flow is a hypothesis; the harness is the proof.

How it works

The ATM strike is anchored from spot at the start of the calculation window and held constant (Pine can't mint new option symbols per bar, and request symbols must be fixed, not per-bar series). A ±3 ladder of CE/PE symbols is auto-built for the weekly expiry and each leg's price and volume are requested; invalid or illiquid strikes simply return nothing and are ignored. From the ladder the tool derives the straddle and IV proxy, the IV slope, volume PCR, the pin strike, an OTM skew read, and the delta-weighted buyer-pressure imbalance. Futures basis and India VIX add the underlying-character read, and an optional lower-timeframe slice (the finest your plan serves) sharpens it.

How to use it

Read the guidance panel top to bottom: the verdict (CE-buyable / PE-buyable / Avoid–crush or decay / Wait), the premium environment (IV cheap/rich, expanding/crushing), Prem vs RV, VIX behaviour, the theta zone, the pin, PCR, and the two Edge readings. Lean toward buying premium in a direction only when the environment is supportive and the theta zone isn't extreme. The flow-side (Option) Edge tells you whether the directional layer is working here; if it's near zero, ignore the flow and lean on IV / theta / pin. Everything is descriptive context — it never tells you to trade.

Plan-adaptive & data note

Intrabar precision auto-selects the finest slice your plan serves (seconds on Premium+, else 1-minute, else chart bar) and every stream is na-safe — any leg or feed your plan or the market doesn't serve simply contributes nothing, and the panel shows live leg coverage (x/14). The tool needs an underlying with real option data; on a symbol without it, the legs read empty. It is fully self-contained (nothing exported), so the whole request budget serves accuracy.

Non-repainting & honesty

The script works on confirmed closed bars with no higher-timeframe lookahead, and both calibration harnesses log and resolve only on confirmed bars, so their statistics never repaint intrabar. Important limits, stated plainly: NSE exposes no per-strike option OI, no tick tape and no greeks to scripts, so IV, skew and delta here are OHLCV proxies and flow is a buyer-pressure proxy. Option streams are session-anchored — re-add the script if spot travels more than ~2 strikes (a drift warning fires). The option-outcome Edge is inherently thin because a weekly contract lives only ~5 days; the underlying Edge matures faster. All Edge figures are in-sample, forward-measured at a fixed horizon, with no costs — a study aid, not a backtest.

Originality

The building blocks are public: volume-concentration (pin/max-pain) analysis, put-call flow, value-area logic, the ATM-straddle implied-volatility approximation, and the variance-risk-premium comparison. What's original is the integration for the buyer specifically — the auto-built weekly ATM ladder read directly off the option tape, the skew-gated directional layer that is trusted only on measured Edge, and the dual forward-calibration harness (underlying + option-outcome) that scores every call against its own base rate. This is a clean-room implementation; no third-party script code is reused.

Concept credits


ATM-straddle → implied-volatility approximation — Brenner & Subrahmanyam
Variance-risk-premium framing (implied vs realized vol) — standard volatility-research technique
Pin / max-pain volume concentration, put-call ratio, value-area analysis, option skew — standard public options techniques


Disclaimer

Research and education only. Not financial advice, no recommendation, no guarantee. Options carry the risk of total loss of premium, and time decay works against buyers. The Edge figures are in-sample with no costs and do not predict price. Test out-of-sample and make your own decisions. The author accepts no liability for any use of this script.
Note di rilascio
Options Buyer's Edge — Weekly v1.1: bounded Edge, costed option test, and a stateful-function fix

EDGE IS NOW BOUNDED, NOT ASSERTED

A raw Edge is a point estimate, and on a small sample a +4 point reading and pure noise are indistinguishable. This matters more here than in most tools because the option-side sample is thin by construction — a weekly contract lives about five days, so the option harness accumulates slowly.

Both harnesses now report a Wilson 95% lower bound alongside the point estimate: Edge LB = lower bound of the hit rate, minus the base rate. The panel turns green only when that lower bound clears zero with an adequate sample. A positive point estimate on its own is no longer coloured as though it were evidence, and a wide interval on a thin sample now looks as uncertain as it actually is.

COSTS ARE CHARGED TO THE OPTION TEST

Weekly option spreads are wide relative to premium, so a gross winner is frequently a net loser. The option-outcome test now requires the ATM option to clear the gain threshold plus a round-trip cost — spread crossed on entry and exit, brokerage and taxes, expressed as a percent of premium, defaulting to 4%.

The charge is applied to the signal and to the base rate alike, so the comparison remains fair: it raises the bar for both, and only a genuine edge survives it. Set it to your own execution reality. Liquid ATM weeklies are typically 3–6%; further-OTM or illiquid strikes are considerably worse.

STATEFUL-FUNCTION FIX

Four stateful series functions — the IV percentile, the IV slope EMA, and the basis and VIX change calculations — were being evaluated inside conditional expressions. Pine's stateful functions must be evaluated on every bar; when they are skipped, their internal history is corrupted. They are now computed unconditionally and masked afterwards. This affected the IV percentile, IV expansion/crush read, basis pulse and VIX behaviour.

Everything else is unchanged: the strike ladder, straddle and IV proxy, theta clock, pin magnet, skew-gated flow layer, plan-adaptive intrabar precision and non-repaint construction all behave as before.

Unchanged framing: this is a context and timing map for buying premium, not a signal generator. Edge figures are in-sample. Not investment advice.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.