I am getting this error after using indicator for 2,3 mints and after refreshing to other time frame again it happens i tried on all time frames but no use same thing is happening
I am getting this error after using indicator for 2,3 mints and after refreshing to other time frame again it happens i tried on all time frames but no use same thing is happening
//@version=5
indicator("Volume Bull/Bear", explicit_plot_zorder = true, overlay = true)
// Inputs
string SettingsG = "Settings"
string TIME = input.timeframe("1D", title = "TimeFrame", group = SettingsG, inline = "!C")
color C1 = input.color(#00e676, title = "Bars", group = SettingsG, inline = "!C2")
color C2 = input.color(#d42525, title = "", group = SettingsG, inline = "!C2")
color TC1 = input.color(#00e676, title = "Text", group = SettingsG, inline = "!C2")
color TC2 = input.color(#d42525, title = "", group = SettingsG, inline = "!C2")
// Symbols
string s01 = input.symbol('HDFCBANK', group = 'Symbols', title = "HDFC")
string s02 = input.symbol('ICICIBANK', group = 'Symbols', title = "ICICI")
string s03 = input.symbol('AXISBANK', group = 'Symbols', title = "Axis")
string s04 = input.symbol('SBIN', group = 'Symbols', title = "SBI")
string s05 = input.symbol('PNB', group = 'Symbols', title = "PNB")
string s06 = input.symbol('INDUSINDBK', group = 'Symbols', title = "Indus")
string s07 = input.symbol('BANKBARODA', group = 'Symbols', title = "Baroda")
string s08 = input.symbol('KOTAKBANK', group = 'Symbols', title = "Kotak")
string s09 = input.symbol('AUBANK', group = 'Symbols', title = "AU")
string s10 = input.symbol('IDFCFIRSTB', group = 'Symbols', title = "IDFC")
string s11 = input.symbol('FEDERALBNK', group = 'Symbols', title = "Federal")
string s12 = input.symbol('BANDHANBNK', group = 'Symbols', title = "Bandhan")
string s13 = input.symbol('BANKNIFTY', group = 'Symbols', title = "BANKNIFTY")
// Define fixed range for the indicator based on daily bars
int FIXED_BARS_BEFORE =50
int FIXED_BARS_AFTER = 50
int dailyBarsBefore = FIXED_BARS_BEFORE
int dailyBarsAfter = FIXED_BARS_AFTER
int dailyBars = dailyBarsBefore + dailyBarsAfter + 1
Start = bar_index - dailyBarsBefore
END = bar_index + dailyBarsAfter
// Method to get volume data for a symbol
VolumeData(string pair, int x1) =>
_BuyV = math.round(volume * (close - low) / (high - low))
_SellV = math.round(volume * (high - close) / (high - low))
[BuyV, SellV] = request.security(pair, TIME, [_BuyV, _SellV])
Delta = BuyV + SellV
BuyMat = BuyV / Delta * 10
SellMat = SellV / Delta * 10
Spacing = (0.8 - 0.5) / 10
GreenSpace = (Spacing * BuyMat) + 0.5
RedSpace = (Spacing * SellMat) + 0.5
// Draw boxes and labels for the given symbol
box.new(Start + x1, 0.5, Start + x1 + 2, GreenSpace, bgcolor = na, border_color = color.new(C1, 14), text_color = TC1, text = str.tostring(BuyV, format.volume))
box.new(Start + x1 + 2, 0.5, Start + x1 + 4, RedSpace, bgcolor = na, border_color = color.new(C2, 14), text_color = TC2, text = str.tostring(SellV, format.volume))
label.new(Start + x1 + 2, 0.45, syminfo.ticker(pair), color = color.new(color.black, 100), textcolor = color.white, size = size.small)
[BuyV, SellV] // Return volumes to be used in total calculation
// Drawing Box and Labels
BoxDrawing() =>
var box Big = na
var box left = na
var box TOP = na
var box right = na
// Inputs for table position and size
string position_option = input.string("Top Right", title="Table Position", options=["Top Right", "Top Center", "Top Left", "Bottom Right", "Bottom Center", "Bottom Left"])
var label_position = position.top_right
if position_option == "Top Left"
label_position := position.top_left
if position_option == "Top Center"
label_position := position.top_center
if position_option == "Bottom Right"
label_position := position.bottom_right
if position_option == "Bottom Left"
label_position := position.bottom_left
if position_option == "Bottom Center"
label_position := position.bottom_center
string size_option = input.string("Normal", title="Table Size", options=["Auto", "Tiny", "Small", "Normal", "Large"])
int table_rows = 14
int table_cols = 6
if size_option == "Small"
table_rows := 10
table_cols := 4
if size_option == "Large"
table_rows := 18
table_cols := 8
// Initialize table with dynamic size and position
var table myTable = table.new(label_position, table_cols, table_rows, frame_color=color.rgb(89, 89, 91), border_width=1)
// Method to clear and update the table
UpdateTable() =>
// Clear table
for r = 0 to table_rows - 1
for c = 0 to table_cols - 1
table.cell(myTable, c, r, "")
// Set table headers
table.cell(myTable, 0, 0, "Symbol", text_color=color.white, bgcolor=#2f4ebe)
table.cell(myTable, 1, 0, "Buy Volume", text_color=color.white, bgcolor=#2dc24f)
table.cell(myTable, 2, 0, "Sell Volume", text_color=color.white, bgcolor=#ce2727)
table.cell(myTable, 3, 0, "Buy %", text_color=color.white, bgcolor=#2dc24f)
table.cell(myTable, 4, 0, "Sell %", text_color=color.white, bgcolor=#ce2727)
// Add rows to the table
AddRows() =>
var int row = 1
// Add rows to the table
[TotalBuy1, TotalSell1] = VolumeData(s01, 5)
[TotalBuy2, TotalSell2] = VolumeData(s02, 15)
[TotalBuy3, TotalSell3] = VolumeData(s03, 25)
[TotalBuy4, TotalSell4] = VolumeData(s04, 35)
[TotalBuy5, TotalSell5] = VolumeData(s05, 45)
[TotalBuy6, TotalSell6] = VolumeData(s06, 55)
[TotalBuy7, TotalSell7] = VolumeData(s07, 65)
[TotalBuy8, TotalSell8] = VolumeData(s08, 75)
[TotalBuy9, TotalSell9] = VolumeData(s09, 85)
[TotalBuy10, TotalSell10] = VolumeData(s10, 95)
[TotalBuy11, TotalSell11] = VolumeData(s11, 105)
[TotalBuy12, TotalSell12] = VolumeData(s12, 115)
[TotalBuy13, TotalSell13] = VolumeData(s13, 125)
// Add rows to the table
table.cell(myTable, 0, row, "HDFC")
table.cell(myTable, 1, row, str.tostring(TotalBuy1, format.volume))
table.cell(myTable, 2, row, str.tostring(TotalSell1, format.volume))
table.cell(myTable, 3, row, str.tostring((TotalBuy1 / (TotalBuy1 + TotalSell1)) * 100, format.percent))
table.cell(myTable, 4, row, str.tostring((TotalSell1 / (TotalBuy1 + TotalSell1)) * 100, format.percent))
row := row + 1
table.cell(myTable, 0, row, "ICICI")
table.cell(myTable, 1, row, str.tostring(TotalBuy2, format.volume))
table.cell(myTable, 2, row, str.tostring(TotalSell2, format.volume))
table.cell(myTable, 3, row, str.tostring((TotalBuy2 / (TotalBuy2 + TotalSell2)) * 100, format.percent))
table.cell(myTable, 4, row, str.tostring((TotalSell2 / (TotalBuy2 + TotalSell2)) * 100, format.percent))
row := row + 1
table.cell(myTable, 0, row, "AXIS")
table.cell(myTable, 1, row, str.tostring(TotalBuy3, format.volume))
table.cell(myTable, 2, row, str.tostring(TotalSell3, format.volume))
table.cell(myTable, 3, row, str.tostring((TotalBuy3 / (TotalBuy3 + TotalSell3)) * 100, format.percent))
table.cell(myTable, 4, row, str.tostring((TotalSell3 / (TotalBuy3 + TotalSell3)) * 100, format.percent))
row := row + 1
table.cell(myTable, 0, row, "SBI")
table.cell(myTable, 1, row, str.tostring(TotalBuy4, format.volume))
table.cell(myTable, 2, row, str.tostring(TotalSell4, format.volume))
table.cell(myTable, 3, row, str.tostring((TotalBuy4 / (TotalBuy4 + TotalSell4)) * 100, format.percent))
table.cell(myTable, 4, row, str.tostring((TotalSell4 / (TotalBuy4 + TotalSell4)) * 100, format.percent))
row := row + 1
table.cell(myTable, 0, row, "PNB")
table.cell(myTable, 1, row, str.tostring(TotalBuy5, format.volume))
table.cell(myTable, 2, row, str.tostring(TotalSell5, format.volume))
table.cell(myTable, 3, row, str.tostring((TotalBuy5 / (TotalBuy5 + TotalSell5)) * 100, format.percent))
table.cell(myTable, 4, row, str.tostring((TotalSell5 / (TotalBuy5 + TotalSell5)) * 100, format.percent))
row := row + 1
table.cell(myTable, 0, row, "INDUS")
table.cell(myTable, 1, row, str.tostring(TotalBuy6, format.volume))
table.cell(myTable, 2, row, str.tostring(TotalSell6, format.volume))
table.cell(myTable, 3, row, str.tostring((TotalBuy6 / (TotalBuy4 + TotalSell6)) * 100, format.percent))
table.cell(myTable, 4, row, str.tostring((TotalSell6 / (TotalBuy4 + TotalSell6)) * 100, format.percent))
row := row + 1
table.cell(myTable, 0, row, "BARODA")
table.cell(myTable, 1, row, str.tostring(TotalBuy7, format.volume))
table.cell(myTable, 2, row, str.tostring(TotalSell7, format.volume))
table.cell(myTable, 3, row, str.tostring((TotalBuy7 / (TotalBuy7 + TotalSell7)) * 100, format.percent))
table.cell(myTable, 4, row, str.tostring((TotalSell7 / (TotalBuy7 + TotalSell7)) * 100, format.percent))
row := row + 1
table.cell(myTable, 0, row, "KOTAK")
table.cell(myTable, 1, row, str.tostring(TotalBuy8, format.volume))
table.cell(myTable, 2, row, str.tostring(TotalSell8, format.volume))
table.cell(myTable, 3, row, str.tostring((TotalBuy8 / (TotalBuy8 + TotalSell8)) * 100, format.percent))
table.cell(myTable, 4, row, str.tostring((TotalSell8 / (TotalBuy8 + TotalSell8)) * 100, format.percent))
row := row + 1
table.cell(myTable, 0, row, "AU")
table.cell(myTable, 1, row, str.tostring(TotalBuy9, format.volume))
table.cell(myTable, 2, row, str.tostring(TotalSell9, format.volume))
table.cell(myTable, 3, row, str.tostring((TotalBuy9 / (TotalBuy9 + TotalSell9)) * 100, format.percent))
table.cell(myTable, 4, row, str.tostring((TotalSell9 / (TotalBuy9 + TotalSell9)) * 100, format.percent))
row := row + 1
table.cell(myTable, 0, row, "IDFC")
table.cell(myTable, 1, row, str.tostring(TotalBuy10, format.volume))
table.cell(myTable, 2, row, str.tostring(TotalSell10, format.volume))
table.cell(myTable, 3, row, str.tostring((TotalBuy10 / (TotalBuy10 + TotalSell10)) * 100, format.percent))
table.cell(myTable, 4, row, str.tostring((TotalSell10 / (TotalBuy10 + TotalSell10)) * 100, format.percent))
row := row + 1
table.cell(myTable, 0, row, "FEDERAL")
table.cell(myTable, 1, row, str.tostring(TotalBuy11, format.volume))
table.cell(myTable, 2, row, str.tostring(TotalSell11, format.volume))
table.cell(myTable, 3, row, str.tostring((TotalBuy11 / (TotalBuy11 + TotalSell11)) * 100, format.percent))
table.cell(myTable, 4, row, str.tostring((TotalSell11 / (TotalBuy11 + TotalSell11)) * 100, format.percent))
row := row + 1
table.cell(myTable, 0, row, "BANDHAN")
table.cell(myTable, 1, row, str.tostring(TotalBuy12, format.volume))
table.cell(myTable, 2, row, str.tostring(TotalSell12, format.volume))
table.cell(myTable, 3, row, str.tostring((TotalBuy12 / (TotalBuy12 + TotalSell12)) * 100, format.percent))
table.cell(myTable, 4, row, str.tostring((TotalSell12 / (TotalBuy12 + TotalSell12)) * 100, format.percent))
row := row + 1
// Continue adding rows for other symbols similarly...
// Display totals
TotalBuy = TotalBuy1 + TotalBuy2 + TotalBuy3 + TotalBuy4 + TotalBuy5 + TotalBuy6 + TotalBuy7 + TotalBuy8 + TotalBuy9 + TotalBuy10 + TotalBuy11 + TotalBuy12 + TotalBuy13
TotalSell = TotalSell1 + TotalSell2 + TotalSell3 + TotalSell4 + TotalSell5 + TotalSell6 + TotalSell7 + TotalSell8 + TotalSell9 + TotalSell10 + TotalSell11 + TotalSell12 + TotalSell13
TotalVolume = TotalBuy + TotalSell
PercentBuy = TotalVolume > 0 ? (TotalBuy / TotalVolume) * 100 : 0
PercentSell = TotalVolume > 0 ? (TotalSell / TotalVolume) * 100 : 0
// Display totals in the last row
table.cell(myTable, 0, row, "Total", bgcolor = #0f0e0e90, text_color = color.white)
table.cell(myTable, 1, row, str.tostring(TotalBuy, format.volume), bgcolor = #2dc24f50, text_color = color.white)
table.cell(myTable, 2, row, str.tostring(TotalSell, format.volume), bgcolor = #ce272750, text_color = color.white)
table.cell(myTable, 3, row, str.tostring(PercentBuy, format.percent), bgcolor = #2dc24f50, text_color = color.white)
table.cell(myTable, 4, row, str.tostring(PercentSell, format.percent), bgcolor = #ce272750, text_color = color.white)
table.cell(myTable, 5, row, "")
if barstate.islast
BoxDrawing()
UpdateTable()
AddRows()
I am getting this error after using indicator for 2,3 mints and after refreshing to other time frame again it happens i tried on all time frames but no use same thing is happening.