Value chart
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Neimad-openware

//@version=5
indicator("Value chart")


Period = input.int(5, minval=2)

plot1 = plot(8, color=color.new(color.white,100),linewidth=1, style=plot.style_line)
plot2 = plot(10, color=color.new(color.white,100), linewidth=1, style=plot.style_line)
plot3 = plot(-8, color=color.new(color.white,100),linewidth=1, style=plot.style_line)
plot4 = plot(-10, color=color.new(color.white,100), linewidth=1, style=plot.style_line)

fill(plot1, plot2, color=color.new(color.red, 50))
fill(plot3, plot4, color=color.new(color.green, 50))

_valueA = 0.2 * ta.sma(high-low, Period)
_valueB = ta.sma((high+low)/2, Period)

_open = (open-_valueB)/_valueA
_high = (high-_valueB)/_valueA
_low = (low-_valueB)/_valueA
_close = (close-_valueB)/_valueA

plotbar(_open, _high, _low, _close, color = _close > _open ? color.green : color.red)

