OPEN-SOURCE SCRIPT
Zaktualizowano

Options Decision Dashboard CPR, Expected Move & Day Type

396
Overview

An index option buyer loses to theta unless the day actually moves. So the first question isn't "which way?" — it's "will this session trend at all, and is implied volatility cheap enough to pay for the ride?"

This dashboard answers that in one panel, before the session gets going:


DAY TYPE — from the Central Pivot Range. Narrow CPR historically precedes trending days; wide CPR precedes rangebound ones.
DIRECTION — from where price sits against the CPR, plus the two-day pivot-range relationship.
THE PRICE OF THE BET — from the volatility index: the expected move it's charging you for.
TIME — days to expiry, and the theta context.


It then states a plain-language verdict — BUY CE / BUY PE / SELL PREMIUM / STAY OUT — with the CPR and floor-pivot levels drawn on price, targets and invalidation marked.

What makes it different

Every CPR script asserts that a narrow CPR means a trending day. None of them check.

This one forward-tests its own core claim. Each session's CPR type is logged at the open, and at the close the day is scored as trending or not (by directional efficiency: how much of the day's range price actually closed away from its open). The panel then reports the trend-day hit rate for narrow-CPR sessions against the unconditional base rate, with a Wilson 95% lower bound.

If narrow CPR carries no edge on your instrument, the dashboard says so — and you should discount its day-type logic accordingly. It is built to be able to tell you it doesn't work.

Why the four layers are ONE tool

An option-buying decision needs all four at once:


Day type without volatility pricing tells you to buy an option that may be too expensive.
Volatility pricing without day type tells you it's cheap without telling you whether it will move.
Either without the levels gives you no entry, target or invalidation.
All three without the calibration is just another confident indicator.


Remove one and the decision isn't decidable.

How it works


CPR — Pivot = (H+L+C)/3 · BC = (H+L)/2 · TC = 2·Pivot − BC, from the prior session. Width is normalised as a % of the pivot and rank-scored against its own recent history, so "narrow" means narrow for this instrument — not a hard-coded point value. (10 points is narrow on NIFTY and wide on a mid-cap.)
Two-day relationship — higher / lower / overlapping / inside / outside value: the classic Pivot-Boss classifications, used as the directional prior.
Expected move — EM = Spot × (IV/100) × √t, shown for the day and to expiry, and drawn as a band. If the session stays inside that band, an option buyer typically loses to theta — which is exactly the trap this tool exists to flag.
Verdict — combines day type, direction, IV percentile and days-to-expiry into one call. Expensive IV can veto a buy; expiry-day theta can veto it too.


How to use it

Read it top-down at the open. Day type tells you whether to buy options at all. Direction tells you which side. Expected move tells you whether the premium is worth it. The verdict is the summary; the levels are your entry, target and invalidation.

Then — before you trust any of it — read the calibration row. If narrow CPR has no proven edge on this symbol, the day-type logic isn't carrying its weight here.

This is decision support. It does not place trades and it is not advice.

Data & scope

Built for NSE:NIFTY / BANKNIFTY index futures on intraday timeframes (5m or 15m is the CPR norm). Needs a volatility index for the expected-move layer (NSE:INDIAVIX by default); without one, that layer switches off cleanly and the rest still works.

Strike step, expiry weekday and volatility symbol are all inputs — so it runs on any index-options market. Set the expiry weekday to match your contract: the exchange has changed the index expiry day before, and this script does not assume, it asks.

On a daily+ chart the panel tells you to switch to intraday rather than showing a confident verdict built on a meaningless CPR.

Non-repainting

Prior-session values are requested as [1] on the daily series, so they're settled before the session opens and never move. The calibration harness logs at the session open and resolves at the session close, on confirmed bars only — a session is graded on the first bar of the next session, from completed data. Intraday readings (price vs level, day-so-far range) update as the session forms; that's a live read, not a repaint.

Concept credits

Central Pivot Range and the two-day pivot-range relationships — Frank Ochoa (Secrets of a Pivot Boss). Floor pivots (R1–R3 / S1–S3) — long-standing public trading-floor practice. Expected move from implied volatility — standard option-pricing arithmetic (Black-Scholes-Merton lineage). Wilson score interval — Edwin B. Wilson. ATR — J. Welles Wilder.

The day-type calibration harness, the expected-move comparison and the verdict engine are the author's own. No third-party Pine code is reused.

Honest limits

The CPR day-type claim is folklore until measured — which is exactly why this script measures it. Calibration figures are in-sample, with no costs, and a proven in-sample edge is not a guarantee out-of-sample. The expected move is a one-standard-deviation estimate under a lognormal assumption; real index returns have fat tails and gaps. The verdict describes conditions — it is not a recommendation — and it says nothing about strike selection, position sizing or risk.

Options carry the risk of TOTAL loss of premium. Nothing here predicts price.

Disclaimer

Research and educational tool only. Not financial advice, not a recommendation, no guarantee of results. Options trading carries a risk of total loss. Test out-of-sample and make your own decisions. The author accepts no liability.
Informacje o Wersji
Minor changes on Legends on Chart and bugs
Informacje o Wersji
Options Decision Dashboard v1.1 — expected-move alert fix

The expected-move breach alerts called crossover and crossunder behind a guard that varies with session state. Pine short-circuits, so the crossing test was skipped on those bars and the previous-bar comparison it depends on was corrupted — meaning these alerts could misfire or fail to fire at all.

Both crossings are now evaluated on every bar and masked afterwards. CPR, expected-move calculation and day-type classification are unchanged.
Informacje o Wersji
v1.1 — Correctness + option-buyer cost model

- Cost model (for an option buyer, the cost IS the premium — which is essentially the priced expected
move): the panel now shows "Move vs priced EM" — on the narrow-CPR sessions it flags as buy
candidates, did the realised move actually beat the priced expected move? Positive (green) = days
moved more than IV charged (buyer-favourable); negative (red) = IV was rich (selling favoured).
Exported as EXP_PremEdge. It is a conservative, direction-agnostic, in-sample read — not a
per-strike P&L.
- Correctness (already applied, now documented): the expected-move breach alerts called
ta.crossover / ta.crossunder from behind a session-state guard that could skip them and corrupt the
previous-bar comparison. They now run every bar and are masked afterwards.
- No change to the CPR engine, expected-move layer, day-type calibration, verdict or levels — everyday
behaviour is identical.

Decision-support tool, in-sample statistics, not investment advice.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.