PROTECTED SOURCE SCRIPT
India VIX Range Lines + Accurate Table

//version=5
indicator("India VIX Range Lines + Accurate Table", overlay=true, max_lines_count=500)
// === STYLE INPUTS ===
lineWidth = input.int(2, "Line Width", minval=1)
upperColor = input.color(color.green, "Upper Line Color")
lowerColor = input.color(color.red, "Lower Line Color")
midColor = input.color(color.yellow, "Today Open Line Color")
// === TABLE THEME INPUTS ===
tableBgColor = input.color(color.new(color.black, 80), "Table Background Color")
tableBorder = input.color(color.white, "Table Border Color")
headerBgColor = input.color(color.new(color.blue, 60), "Header Background Color")
headerTextColor = input.color(color.white, "Header Text Color")
cellBgColor = input.color(color.new(color.gray, 60), "Cell Background Color")
cellTextColor = input.color(color.white, "Cell Text Color")
// === PARAMETERS ===
vixDivisor = 19.1 // fixed divisor
// === DATA FETCH ===
// India VIX daily open
indiaVixOpen = request.security("INDIAVIX", "D", open)
// Today's index first bar open (intraday-friendly)
var float todayOpen = na
if ta.change(time("D"))
todayOpen := open
// === CALCULATIONS ===
var float x = na
var float y = na
var float upperLine = na
var float lowerLine = na
if not na(todayOpen)
x := indiaVixOpen / vixDivisor // exact x = IndiaVIX Open / 19.1
y := todayOpen * x / 100 // range offset
upperLine := todayOpen + y
lowerLine := todayOpen - y
// === PLOT LINES (Fixed for the Day) ===
plot(upperLine, color=upperColor, style=plot.style_line, linewidth=lineWidth, title="Upper Line")
plot(lowerLine, color=lowerColor, style=plot.style_line, linewidth=lineWidth, title="Lower Line")
plot(todayOpen, color=midColor, style=plot.style_line, linewidth=lineWidth, title="Today Open Line")
// === TABLE DISPLAY ===
var table infoTable = table.new(position=position.top_right, columns=2, rows=7, border_width=1, frame_color=tableBorder, frame_width=1, bgcolor=tableBgColor)
if barstate.islast
table.cell(infoTable, 0, 0, "India VIX Open", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 0, str.tostring(indiaVixOpen, "#.##"), text_color=cellTextColor, bgcolor=cellBgColor)
table.cell(infoTable, 0, 1, "VIX Divisor", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 1, str.tostring(vixDivisor, "#.##"), text_color=cellTextColor, bgcolor=cellBgColor)
table.cell(infoTable, 0, 2, "X Value (VIX / 19.1)", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 2, str.tostring(x, "#.#####"), text_color=cellTextColor, bgcolor=cellBgColor)
table.cell(infoTable, 0, 3, "Today Open", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 3, str.tostring(todayOpen, "#.##"), text_color=cellTextColor, bgcolor=cellBgColor)
table.cell(infoTable, 0, 4, "Y Value (Range Offset)", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 4, str.tostring(y, "#.#####"), text_color=cellTextColor, bgcolor=cellBgColor)
table.cell(infoTable, 0, 5, "Upper Line", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 5, str.tostring(upperLine, "#.##"), text_color=cellTextColor, bgcolor=cellBgColor)
table.cell(infoTable, 0, 6, "Lower Line", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 6, str.tostring(lowerLine, "#.##"), text_color=cellTextColor, bgcolor=cellBgColor)
indicator("India VIX Range Lines + Accurate Table", overlay=true, max_lines_count=500)
// === STYLE INPUTS ===
lineWidth = input.int(2, "Line Width", minval=1)
upperColor = input.color(color.green, "Upper Line Color")
lowerColor = input.color(color.red, "Lower Line Color")
midColor = input.color(color.yellow, "Today Open Line Color")
// === TABLE THEME INPUTS ===
tableBgColor = input.color(color.new(color.black, 80), "Table Background Color")
tableBorder = input.color(color.white, "Table Border Color")
headerBgColor = input.color(color.new(color.blue, 60), "Header Background Color")
headerTextColor = input.color(color.white, "Header Text Color")
cellBgColor = input.color(color.new(color.gray, 60), "Cell Background Color")
cellTextColor = input.color(color.white, "Cell Text Color")
// === PARAMETERS ===
vixDivisor = 19.1 // fixed divisor
// === DATA FETCH ===
// India VIX daily open
indiaVixOpen = request.security("INDIAVIX", "D", open)
// Today's index first bar open (intraday-friendly)
var float todayOpen = na
if ta.change(time("D"))
todayOpen := open
// === CALCULATIONS ===
var float x = na
var float y = na
var float upperLine = na
var float lowerLine = na
if not na(todayOpen)
x := indiaVixOpen / vixDivisor // exact x = IndiaVIX Open / 19.1
y := todayOpen * x / 100 // range offset
upperLine := todayOpen + y
lowerLine := todayOpen - y
// === PLOT LINES (Fixed for the Day) ===
plot(upperLine, color=upperColor, style=plot.style_line, linewidth=lineWidth, title="Upper Line")
plot(lowerLine, color=lowerColor, style=plot.style_line, linewidth=lineWidth, title="Lower Line")
plot(todayOpen, color=midColor, style=plot.style_line, linewidth=lineWidth, title="Today Open Line")
// === TABLE DISPLAY ===
var table infoTable = table.new(position=position.top_right, columns=2, rows=7, border_width=1, frame_color=tableBorder, frame_width=1, bgcolor=tableBgColor)
if barstate.islast
table.cell(infoTable, 0, 0, "India VIX Open", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 0, str.tostring(indiaVixOpen, "#.##"), text_color=cellTextColor, bgcolor=cellBgColor)
table.cell(infoTable, 0, 1, "VIX Divisor", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 1, str.tostring(vixDivisor, "#.##"), text_color=cellTextColor, bgcolor=cellBgColor)
table.cell(infoTable, 0, 2, "X Value (VIX / 19.1)", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 2, str.tostring(x, "#.#####"), text_color=cellTextColor, bgcolor=cellBgColor)
table.cell(infoTable, 0, 3, "Today Open", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 3, str.tostring(todayOpen, "#.##"), text_color=cellTextColor, bgcolor=cellBgColor)
table.cell(infoTable, 0, 4, "Y Value (Range Offset)", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 4, str.tostring(y, "#.#####"), text_color=cellTextColor, bgcolor=cellBgColor)
table.cell(infoTable, 0, 5, "Upper Line", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 5, str.tostring(upperLine, "#.##"), text_color=cellTextColor, bgcolor=cellBgColor)
table.cell(infoTable, 0, 6, "Lower Line", text_color=headerTextColor, bgcolor=headerBgColor)
table.cell(infoTable, 1, 6, str.tostring(lowerLine, "#.##"), text_color=cellTextColor, bgcolor=cellBgColor)
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.