Shadow Compact Volume BETA
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © PaulVM

//@version=5
indicator("Shadow Compact Volume BETA", shorttitle = "SCV - BETA", overlay = false)
lenght = input.int(minval = 5,defval = 24, title="Lenght")
upHidden = 0.0
dnHidden = 0.0
mainVol = 0.0

mainVol := (close - open) * 1000 / 3
candleDirection = open < close ? 1 : 0 // 1 up 0 down
upHidden := (candleDirection ? (open - low) : (close - low)) * 1000
dnHidden := (candleDirection ? (high - close) : (high - open)) * 1000

realPowerUp = upHidden/3 + (mainVol > 0 ? mainVol : 0)
realPowerDn = -1*dnHidden/3 + (mainVol < 0 ? mainVol : 0)

plot(mainVol,  style=plot.style_columns, color=color.yellow)
plot(realPowerUp, style=plot.style_columns, color=color.green)
plot(realPowerDn, style=plot.style_columns, color=color.red)
