here you are bro
study("Pivots HL",overlay = true)
x = input(title = "left", type = input.integer, defval = 100)
y = input(title = "right", type = input.integer, defval = 100)
source = input(title = "Source", type = input.string, defval="High/Low", options = ["High/Low","Close"])
src_high = source == "Close" ? close : high
src_low = source == "Close" ? close : low
pivot_high = pivothigh(src_high,x,y)
pivot_low = pivotlow(src_low,x,y)
hbars = highestbars(src_high,x)
lbars = lowestbars(src_low,x)
if na(pivot_high)
pivot_high := pivot_high[1]
if na(pivot_low)
pivot_low :=pivot_low[1]
if pivot_high != pivot_high[1]
line.new(bar_index + hbars, pivot_high, bar_index, pivot_high, xloc = xloc.bar_index, color = color.lime)
if pivot_low != pivot_low[1]
line.new(bar_index + lbars, pivot_low, bar_index, pivot_low, xloc = xloc.bar_index, color = color.red)