Baekdoo baseline
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © traderbaekdoosan

//@version=5
indicator(title="Baekdoo baseline", overlay=true)
HT1=ta.highest(volume, 5)
NewH1=ta.valuewhen(volume>HT1[1], (open+close+low+high+close)/5, 0)
result1=ta.ema(NewH1, 2)
result_shift=input(20, "shifting value")

HT2=ta.highest(volume, 20)
NewH2=ta.valuewhen(volume>HT2[1], (open+close+low+high+close)/5, 0)
result2=ta.ema(NewH2, 10)

HT3=ta.highest(volume, 125)
NewH3=ta.valuewhen(volume>HT3[1], (open+close+low+high+close)/5, 0)
result3=ta.ema(NewH3, 20)

HT4=ta.highest(volume, 250)
NewH4=ta.valuewhen(volume>HT4[1], (open+close+low+high+close)/5, 0)
result4=ta.ema(NewH4, 20)

HT5=ta.highest(volume, 500)
NewH5=ta.valuewhen(volume>HT5[1], (open+close+low+high+close)/5, 0)
result5=ta.ema(NewH5, 20)

plot(result1, color=color.lime, linewidth=1, offset=2)
plot(result2, color=color.orange, linewidth=2, offset=10)
plot(result3, color=color.red, linewidth=3, offset=result_shift)
plot(result4, color=color.white, linewidth=4, offset=result_shift)
plot(result5, color=color.purple, linewidth=5, offset=result_shift)