tradingview spot gamma script
tradingview spot gamma script
line_style(lsty) =>
lsty == "Dashed" ? line.style_dashed
: lsty == "Dotted" ? line.style_dotted
: lsty == "Solid" ? line.style_solid
: na
out_array_s = array.size(out_array) - 1
getPrice(i) =>
out_array_s >= i ? tonumber(array.get(str.split(array.get(out_array, i), c_s),
ColNum)) : na
L1A = getPrice(3)
L2A = getPrice(4)
L3A = getPrice(5)
L4A = getPrice(6)
L5A = getPrice(7)
L6A = getPrice(8)
L7A = getPrice(9)
L8A = getPrice(10)
L9A = getPrice(11)
L10A = getPrice(12)
L11A = getPrice(13)
L12A = getPrice(14)
L13A = getPrice(15)
float LSGI_H = na
float LSGI_L = na
if out_array_s >= 16
iLSGI = array.get(str.split(array.get(out_array, 16), c_s), 2)
LSGI_0 = tonumber(array.get(str.split(iLSGI, "/"), 0))
LSGI_1 = tonumber(array.get(str.split(iLSGI, "/"), 1))
LSGI_H := max(LSGI_0, LSGI_1)
LSGI_L := min(LSGI_0, LSGI_1)
else
LSGI_H := na
LSGI_L := na
getLabel(i) =>
out_array_s >= i ? array.get(str.split(array.get(out_array, i), c_s), 2) : na
L1C = getLabel(3)
L2C = getLabel(4)
L3C = getLabel(5)
L4C = getLabel(6)
L5C = getLabel(7)
L6C = getLabel(8)
L7C = getLabel(9)
L8C = getLabel(10)
L9C = getLabel(11)
L10C = getLabel(12)
L11C = getLabel(13)
L12C = getLabel(14)
L13C = getLabel(15)
string SGI_H_Lbl = na
string SGI_L_Lbl = na
if out_array_s >= 16
SGI_H_Lbl := array.get(str.split(array.get(out_array, 16), c_s), 0) + "High"
SGI_L_Lbl := array.get(str.split(array.get(out_array, 16), c_s), 0) + "Low"
if EnableLabels
draw_Text(L1C, tx, L1A, label_font_size, LabelTextColor)
draw_Text(L2C, tx, L2A, label_font_size, LabelTextColor)
draw_Text(L3C, tx, L3A, label_font_size, LabelTextColor)
draw_Text(L4C, tx, L4A, label_font_size, LabelTextColor)
draw_Text(L5C, tx, L5A, label_font_size, LabelTextColor)
draw_Text(L6C, tx, L6A, label_font_size, LabelTextColor)
draw_Text(L7C, tx, L7A, label_font_size, LabelTextColor)
draw_Text(L8C, tx, L8A, label_font_size, LabelTextColor)
draw_Text(L9C, tx, L9A, label_font_size, LabelTextColor)
draw_Text(L10C, tx, L10A, label_font_size, LabelTextColor)
draw_Text(L11C, tx, L11A, label_font_size, LabelTextColor)
draw_Text(L12C, tx, L12A, label_font_size, LabelTextColor)
draw_Text(L13C, tx, L13A, label_font_size, LabelTextColor)
if out_array_s >= 16
draw_Text(SGI_H_Lbl, tx, LSGI_H, label_font_size, SGI_H_LineColor)
draw_Text(SGI_L_Lbl, tx, LSGI_L, label_font_size, SGI_L_LineColor)
// // FOR DEBUGGING
// getArrayText(array0) =>
// a_index = max(array.size(array0) - 1, 0)
// string otext = na
// for c = 0 to a_index
// array0_out = array.get(array0, c)
// otext := otext
// + array0_out
// + "\n"
// otext
// out = getArrayText(out_array)