instrument {
name = 'Grid Line V2',
icon = 'https://www.vdk.be/sites/default/files/styles/teaser_image_xs/public/
2019-09/icon-profit.png?itok=0RrQq3c7',
overlay = true
}
setFix = input(5, "Set Point", input.double, 0.000001)
sec = security (current_ticker_id, "1H")
--print(current_ticker_id) -- 84 79 85 6 3 4 101 106 949 1024 // XAUUSD 74
local getID = {84, 79, 85, 6, 3, 4, 101, 106, 949, 1024}
local len_getID = #getID
--print(len_getID)
if current_ticker_id == 74 then
roundSet = 1
calSetfix = 0.01
else --JPY
for i = 1, len_getID, 1 do
if current_ticker_id == getID[i] then
roundSet = 10
calSetfix = 0.001
break
else
roundSet = 1000
calSetfix = 0.00001
end
end
end
if sec then
getPrice = sec.open[0]
intPrice = round(roundSet * getPrice )
pricePivot = intPrice /roundSet
for i = -15, 15, 1 do
priceLevel = pricePivot + (i * setFix * calSetfix)
if i == 0 then
color = "white"
wd = 3
elseif i < 0 then
color = "red"
wd = 1
elseif i > 0 then
color = "#00FF2A"
wd = 1
end
plot(priceLevel, i, color,wd, 0, style.levels)
end
end