Highs/Lows difference [OrganicPunch]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © OrganicPunch

//@version=5
indicator("Highs/Lows difference [OrganicPunch]", "Highs/Lows [OP]")

// To visually evaluate the difference between highs and lows

difference_ema_lenght = input.int(7, title="Highs/Lows Difference EMA", minval=1)

highs = high > high[1] ? high - high[1] : high[1] - high
lows = low > low[1] ? low - low[1] : low[1] - low
difference = highs-lows
change_ema = ta.ema(difference, difference_ema_lenght)

plot(highs, "Highs", color.green, 1, plot.style_histogram)
plot(-lows, "Lows", color.red, 1, plot.style_histogram)
plot(difference, "Difference", difference>=0?color.green:color.red, 2, plot.style_circles)
plot(change_ema, "Difference EMA", color.yellow)

hline(0, "Middle line", color.gray, hline.style_solid)

