PROTECTED SOURCE SCRIPT
تم تحديثه

Option Premium + VWAP Dashboard

126
1. What this indicator does

This tool creates a live option chain style dashboard on your chart for index options on NSE.

For a selected expiry and a band of strikes around a reference strike, it shows:

Strike price

CE LTP (Last Traded Price)

PE LTP

CE + PE total premium

Combined VWAP of CE + PE

Individual VWAP of CE

Individual VWAP of PE

Inference column describing who is stronger
(buyers or sellers, CE side or PE side, or mixed)

Rows are color coded based on which side is dominating around VWAP, so you get a quick visual sense of:

At which strikes buyers are aggressive

At which strikes sellers are aggressive

Where premiums are trading near VWAP and stay neutral

You can place this dashboard anywhere on the chart and adjust font size and colors as per your preference.

2. Supported indices

You can use this indicator on the following indices:

NIFTY

BANKNIFTY

FINNIFTY

MIDCAP

SENSEX

Input:
Spot Symbol = choose from BANKNIFTY, NIFTY, FINNIFTY, MIDCAP, SENSEX

Internally, the script maps this choice to the corresponding TradingView symbol:

NIFTY → NSE:NIFTY

BANKNIFTY → NSE:BANKNIFTY

FINNIFTY → NSE:CNXFINANCE

MIDCAP → NSE:CNXMIDCAP

SENSEX → BSE:SENSEX

For options, it uses an option prefix derived from this selection:

For all NSE index options → BANKNIFTY, NIFTY, FINNIFTY, MIDCAP

For SENSEX options → BSX (as per your earlier convention)

Options are then constructed in this format:

PREFIX + YYMMDD + C/P + Strike
Example: NIFTY251120C20000

So the expiry date must be set correctly, otherwise TradingView will not find the options.

3. How the logic works internally

For each strike in the selected range, the script:

Builds the CE and PE symbols using:

Underlying prefix (opt_prefix)

Expiry date in YYMMDD format

C or P

Strike price

Fetches from request.security() on your current chart timeframe:

ce_close, pe_close

ce_vwap, pe_vwap

Calculates:

combined_prem = CE LTP + PE LTP

combined_vwap = CE VWAP + PE VWAP

Compares premiums and VWAPs and creates a detailed inference string, for example:

"Optn buyers stronger | Both buyers strong"

"Optn sellers stronger | CE sellers, PE buyers"

"Near VWAP | Mixed"

Chooses row background color based on which side is stronger:

CE buyers strong → BG CE Buyers Strong

PE buyers strong → BG PE Buyers Strong

CE sellers strong → BG CE Sellers Strong

PE sellers strong → BG PE Sellers Strong

If none of the above is clearly dominant, the row is kept neutral.

This gives you an immediate view of:

Where option buyers are aggressively lifting offers

Where option sellers are dominating

Where the market is balanced near VWAP

4. Expiry settings
How to change expiry to get the correct option chain

The indicator uses a manual expiry input:

Group: Expiry Settings

Input: Expiry (manual)

Internally, it extracts:

year(expiry_manual)

month(expiry_manual)

dayofmonth(expiry_manual)

Then it converts this to YYMMDD and builds option symbols.

How to set this correctly:

Open the indicator settings.

Go to “Expiry Settings”.

In Expiry (manual) select the correct date and time of the option expiry.

For NSE weekly or monthly index options, you can simply select the calendar date of the expiry.

Time is not critical for symbol naming, it is used only to obtain year, month, day, but keeping it at market open time (for example, 09:15) is a good habit.

After changing the expiry:

The title row will update to show the new expiry as DD-MM-YY.

The script will start requesting data for symbols with that YYMMDD in their names.

If you see na in most rows, it usually means:

The expiry date does not match the actual symbol format on TradingView.

The strike prices are too far away from existing contracts.

You are using an expiry where this index does not have options.

In that case, double check the expiry date and strike range.

5. Strike settings

The script gives you a flexible way to control which strikes are shown.

Group: Strike Settings

5.1 Automatic strike interval

By default, the indicator uses index specific strike steps:

BANKNIFTY or SENSEX → 100 point interval

NIFTY or FINNIFTY → 50 point interval

MIDCAP also defaults to 50 points

This is controlled internally by:

use_manual_interval = false


and auto_interval is chosen based on the index.

Use case:
If you want a quick standard layout for a typical option chain view, simply leave “Use Manual Strike Interval” unchecked and let the script choose the appropriate interval automatically.

5.2 Manual strike interval

You can override the default step using:

Use Manual Strike Interval (bool)

Manual Strike Interval (int, default 50)

When Use Manual Strike Interval is true, the script will:

Ignore the automatic index based step.

Use your chosen step size for all strikes.

When to use manual interval:

When the exchange has changed strike spacing for a particular series.

When you want a denser view (for example, 25 point steps in NIFTY) around ATM.

When you want a wider spacing for a broad overview, for example, 200 or 500 point steps.

5.3 Reference strike and range

Two important inputs:

Reference Strike (manual)
Default: 26000
This is the center of the table. The script builds strikes above and below this level.

Strikes Above / Below Reference
Default: 5

The script calculates:

start_strike = ref_strike - half_range * strike_interval

Total number of strikes = 2 * half_range + 1

So with:

Reference Strike = 26000

Strike Interval = 100

Strikes Above / Below = 5

You will get strikes from 25500 to 26500 in steps of 100.

How to choose the reference strike in practice:

Set it close to the current spot price or the ATM strike.

For intraday trading, most of your focus is usually on:

ATM

2 or 3 strikes ITM and OTM on each side

If NIFTY is around 22,250, set Reference Strike to 22200 or 22250 based on available strikes.

If BANKNIFTY is around 49,800, set it to 49800 or 50000.

This keeps the dashboard concentrated around active and liquid strikes that you actually trade.

6. Dashboard layout and appearance

Group: Dashboard Layout

Dashboard Location
Choose where the table appears on your chart.
Options: top left, top center, top right, middle left, middle center, middle right, bottom left, bottom center, bottom right.

Font Size
Choose from Tiny, Small, Normal, Large, Huge depending on your screen size and personal preference.

Group: Colors

You can customize:

Header Background

Title Background

Header Text color

Row backgrounds based on strength:

BG CE Buyers Strong

BG PE Sellers Strong

BG CE Sellers Strong

BG PE Buyers Strong

Row BG neutral for mixed or unclear situations

Suggestion:

Keep buyers related backgrounds in green shades.

Keep sellers related backgrounds in red shades.

Keep neutral in grey.

This matches the logic in the Inference column and makes interpretation much easier.

7. How to read the “Inference” column

The inference logic checks:

Is total premium above or below total VWAP?

Is CE above its VWAP?

Is PE above its VWAP?

Then it combines this into messages like:

“Optn buyers stronger | Both buyers strong”
Both CE and PE trade above their respective VWAPs, and combined premium is above combined VWAP.
Buyers are clearly dominant at that strike.

“Optn sellers stronger | Both sellers strong”
Both CE and PE trade below VWAPs, and combined premium is below combined VWAP.
Sellers are in control at that strike.

“Optn buyers stronger | CE buyers stronger”
Combined premium is above combined VWAP, CE trades above its VWAP, PE is not as strong.
CE side buyers are leading.

“Optn buyers stronger | PE buyers stronger”
Similar, but PE side buyers are leading.

“Optn sellers stronger | CE sellers, PE buyers” or “PE sellers, CE buyers”
Mixed conditions, one side is selling aggressively while the other side has some buyer support.

“Near VWAP | Mixed”
Both premiums are hovering near their VWAP, market is balanced at that strike.

Use this to quickly decide:

Where to avoid trading due to mixed and choppy behaviour.

Where buyers or sellers are clearly dominating and trend can be extended or exhausted.

8. Practical usage tips

Use on intraday timeframes
The script uses timeframe.period for VWAP and LTP calculation. Use it on 1 minute, 3 minute, 5 minute, 15 minute charts for intraday decision making.

Align with index trend
Combine this dashboard with your main price action and trend tools.
For example, if the index trend is strongly up and the ATM and slightly OTM calls show “buyers stronger” with green backgrounds, it can support continuation trades.

Watch shifts in dominance
If you see a cluster of strikes shifting from “buyers stronger” to “sellers stronger”, that can signal distribution or trend exhaustion.

Change expiry when series rolls
For weekly options, you must change Expiry (manual) every week to get the correct option chain.
For monthly and quarterly contracts, update it whenever you roll over to a new series.

Adjust manual interval and reference strike
Before the session starts, quickly adjust:

Reference Strike near current spot

Strikes Above / Below based on how wide a range you want to watch

Optional Manual Strike Interval if you prefer finer or wider spacing

This ensures the dashboard shows the most relevant and liquid strikes instead of cluttering your screen with far OTM data.

9. Limitations and notes

This script depends on correct symbol naming on TradingView for NSE index options.
If the broker or data feed uses a different format, some rows may show na.

Expiry detection is manual by design.
Pine Script cannot reliably auto detect NSE weekly expiry series for every situation, so you are given full manual control to avoid wrong symbol requests.

If you change expiry or strike settings and see an error or many na values, try:

Checking the expiry date.

Bringing reference strike closer to spot.

Refreshing the chart if TradingView needs to load new option symbols.
ملاحظات الأخبار
Gave checkboxes to display or hide specific columns in the table

Back ground color choice

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.