how to use this code:
- SMA 30 High & Low: கடந்த 30 மெழுகுவர்த்திகளின் (Candles) அதிகபட்ச விலையைக் கொண்டு SMA 30 High கோடும், குறைந்தபட்ச விலையைக் கொண்டு SMA 30 Low கோடும் கணக்கிடப்படுகின்றன.
- VWAP (Volume Weighted Average Price): சந்தையின் வர்த்தக அளவைக் (Volume) கொண்டு கணக்கிடப்படும் சராசரி விலை கோடு.
- STRONG BUY சிக்னல்:
VWAPகோடானது,SMA 30 Highகோட்டை கீழிருந்து மேல் நோக்கி ஊடுருவிச் செல்லும் போது (Cross Over) உருவாகிறது.- இது சந்தையில் காளைகளின் (Bulls) ஆதிக்கம் அதிகரித்து, விலை மேலும் உயரப் போகிறது என்பதைக் குறிக்கிறது.
- இந்த நேரத்தில் அட்டவணையின் (Table) தலைப்பு பச்சை நிறத்தில் STRONG BUY எனக் காட்டும்.
- STRONG SELL சிக்னல்:
VWAPகோடானது,SMA 30 Lowகோட்டை மேலிருந்து கீழ் நோக்கி ஊடுருவிச் செல்லும் போது (Cross Under) உருவாகிறது.- இது சந்தையில் கரடிகளின் (Bears) ஆதிக்கம் அதிகரித்து, விலை குறையப் போகிறது என்பதைக் குறிக்கிறது.
- இந்த நேரத்தில் அட்டவணையின் தலைப்பு சிவப்பு நிறத்தில் STRONG SELL எனக் காட்டும்.
- சிக்னல் நினைவகம்: ஒரு முறை சிக்னல் உருவாகிவிட்டால் (Strong Buy அல்லது Strong Sell), அடுத்த சிக்னல் வரும் வரை அட்டவணை அதே நிலையில் சிக்னலைத் தக்கவைத்துக்கொண்டே இருக்கும்.
- ஆப்ஷன் தகவல்கள்: சிக்னல் நிலைக்கு ஏற்ப, அதனுடன் தொடர்புடைய ITM Call / Put Strike Price, அவற்றின் LTP, Intrinsic Value மற்றும் Time Value ஆகியவை அட்டவணையில் நேரலையாக (Live) மாறிக்கொண்டே இருக்கும்.
just copy to paste
//@version=6
indicator("Dynamic Options Tracker & Signal Table - v6", overlay=true)
// ==========================================
// 1. INPUT PARAMETERS
// ==========================================
string i_exchange = input.string("NSE", title="Exchange", group="Option Symbol Settings")
string i_underlying = input.string("NIFTY", title="Underlying Symbol", options=["NIFTY", "BANKNIFTY", "FINNIFTY"], group="Option Symbol Settings")
string i_expiry = input.string("260825", title="Expiry Date (YYMMDD)", tooltip="Example: 260825 for 25-Aug-2026", group="Option Symbol Settings")
int i_step = input.int(100, title="Strike Interval/Step (e.g., 50 or 100)", group="Option Symbol Settings")
// ==========================================
// 2. INDICATORS & STRIKE CALCULATIONS
// ==========================================
float sma30_high = ta.sma(high, 30)
float sma30_low = ta.sma(low, 30)
float vwap_val = ta.vwap(close)
float ema50_val = ta.ema(close, 50)
float ema200_val = ta.ema(close, 200)
// Spot Open & Current Spot Price
float spot_open = request.security(syminfo.tickerid, "D", open)
float spot_curr = close
// Dynamic Strike Calculations
int atm_strike = math.round(spot_curr / i_step) * i_step
int call_strike = atm_strike - i_step // ITM Call Strike
int put_strike = atm_strike + i_step // ITM Put Strike
// Dynamic Option Symbol Formatting
string call_symbol = i_exchange + ":" + i_underlying + i_expiry + "C" + str.tostring(call_strike)
string put_symbol = i_exchange + ":" + i_underlying + i_expiry + "P" + str.tostring(put_strike)
// Request Live Premium Prices for Call and Put Options
float call_ltp = request.security(call_symbol, timeframe.period, close, ignore_invalid_symbol=true)
float put_ltp = request.security(put_symbol, timeframe.period, close, ignore_invalid_symbol=true)
float call_open = request.security(call_symbol, "D", open, ignore_invalid_symbol=true)
float put_open = request.security(put_symbol, "D", open, ignore_invalid_symbol=true)
// Intrinsic & Time Value Calculations
float call_intrinsic = math.max(0.0, spot_curr - call_strike)
float call_time_val = math.max(0.0, (na(call_ltp) ? 0.0 : call_ltp) - call_intrinsic)
float put_intrinsic = math.max(0.0, put_strike - spot_curr)
float put_time_val = math.max(0.0, (na(put_ltp) ? 0.0 : put_ltp) - put_intrinsic)
// ==========================================
// 3. CROSSOVER SIGNALS & CONDITIONAL TABLES
// ==========================================
bool is_strong_buy = ta.crossover(vwap_val, sma30_high)
bool is_strong_sell = ta.crossunder(vwap_val, sma30_low)
var string active_signal = "NEUTRAL"
if is_strong_buy
active_signal := "STRONG BUY"
else if is_strong_sell
active_signal := "STRONG SELL"
// ==========================================
// 4. DYNAMIC TABLE RENDERING (13 ROWS)
// ==========================================
var table optionTable = table.new(position = position.top_right, columns = 2, rows = 13, border_color = color.black, border_width = 1)
f_addRow(tbl, row, labelText, valText, bgColor, isHighlight) =>
color textColor = isHighlight ? color.black : color.white
color cellBg = bgColor
table.cell(tbl, 0, row, labelText, bgcolor=cellBg, text_color=textColor, text_size=size.small, text_halign=text.align_left)
table.cell(tbl, 1, row, valText, bgcolor=cellBg, text_color=textColor, text_size=size.small, text_halign=text.align_right)
if barstate.islast
// Header Signal Color Setup
color sigColor = color.gray
if active_signal == "STRONG BUY"
sigColor := color.green
else if active_signal == "STRONG SELL"
sigColor := color.red
// Render Table Rows
f_addRow(optionTable, 0, "SIGNAL STATUS", active_signal, sigColor, true)
f_addRow(optionTable, 1, "Spot Open", str.tostring(spot_open, "#.##"), color.navy, false)
f_addRow(optionTable, 2, "ATM Strike", str.tostring(atm_strike), color.navy, false)
f_addRow(optionTable, 3, "CALL Strike", str.tostring(call_strike), color.navy, false)
f_addRow(optionTable, 4, "PUT Strike", str.tostring(put_strike), color.navy, false)
f_addRow(optionTable, 5, "CALL Open/LTP", str.tostring(call_ltp, "#.##"), color.navy, false)
f_addRow(optionTable, 6, "CALL Intrinsic", str.tostring(call_intrinsic, "#.##"), color.navy, false)
f_addRow(optionTable, 7, "CALL Time Value", str.tostring(call_time_val, "#.##"), color.yellow, true)
f_addRow(optionTable, 8, "PUT Open/LTP", str.tostring(put_ltp, "#.##"), color.navy, false)
f_addRow(optionTable, 9, "PUT Intrinsic", str.tostring(put_intrinsic, "#.##"), color.navy, false)
f_addRow(optionTable, 10, "PUT Time Value", str.tostring(put_time_val, "#.##"), color.yellow, true)
f_addRow(optionTable, 11, "CALL Symbol", call_symbol, color.gray, false)
f_addRow(optionTable, 12, "PUT Symbol", put_symbol, color.gray, false)
// ==========================================
// 5. CHART PLOTS
// ==========================================
plot(sma30_high, color=color.green, title="SMA 30 High")
plot(sma30_low, color=color.red, title="SMA 30 Low")
plot(vwap_val, color=color.orange, title="VWAP", linewidth=2)
plot(ema50_val, color=color.blue, title="EMA 50")
plot(ema200_val, color=color.purple, title="EMA 200")
0 Comments