TR Unleaded Gasoline & Diesel Price by zdmre
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © zdmre

//@version=5
indicator("TR Unleaded Gasoline & Diesel Price by zdmre")
kdv_jul_10 = timestamp("Jul 10 2023 00:00 +000")
otv_jul_16 = timestamp("Jul 16 2023 00:00 +000")
float p = 0
float k = 1
if time >= kdv_jul_10
    k := 1.01694
if time >= otv_jul_16
    p := 5
trgas = ta.sma(request.security("TVC:UKOIL*FX:USDTRY/159*2.1", "D", close),5)*1.03*k+p
trdsl = ta.sma(request.security("(NYMEX:GKS1!*FX:USDTRY+TVC:UKOIL*FX:USDTRY)*1.59*1.2/1.18/159", "D", close),5)*1.03*k+p

var tbis = table.new(position.middle_right, 2, 5, frame_color=color.black, frame_width=0, border_width=1, border_color=color.black)
table.cell(tbis, 0, 1, 'Unleaded Gasoline', bgcolor = color.blue, text_size=size.small, text_color=color.white)
table.cell(tbis, 0, 2, 'Diesel', bgcolor = color.yellow, text_size=size.small, text_color=color.black)
table.cell(tbis, 1, 1, str.tostring(trgas[0],'#.00 TL'), text_color=color.white, bgcolor= color.blue)
table.cell(tbis, 1, 2, str.tostring(trdsl[0],'#.00 TL'), text_color=color.black, bgcolor= color.yellow)

plot(trgas, title='Unleaded Gasoline', color=color.new(color.blue, 0), linewidth=2)
plot(trdsl, title='Diesel', color=color.new(color.yellow, 0), linewidth=2)