Hi-Lo Trend Bars
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © MGULHANN

//@version=5
indicator("Hi-Lo Trend Bars", overlay=true)

mlthhv = input.float(2.0, title="HHV Çarpanı", step=0.01)
mltllv = input.float(2.0, title="LLV Çarpanı", step=0.01)
hhvDeger = input.int(15, title="HHV Periyot")
llvDeger = input.int(5, title="LLV Periyot")
src = input(close, title="Kaynak")

hhv = ta.highest(src,hhvDeger) - mlthhv
llv = ta.lowest(src,llvDeger) - mltllv

plot(hhv, color = color.purple, title="HHV")
plot(llv, color= color.aqua, title="LLV")
barcolor(low < llv ? color.red : high > hhv ? color.green : color.red)