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

//@version=5
indicator("Volume [Entoryx]")
n=input(100,"Bars lenth")
highest=ta.highest(high,n)
lowest=ta.lowest(low,n)
delta=highest-lowest

current_value=-(open-close)/delta*100
color1=color.new(color.white,0)
color2=color.white
if close>ta.ema(close,n)
    color1:=color.new(color.green,0)
    color2:=color.green
else
    color1:=color.new(color.red,0)
    color2:=color.red

zero=plot(0,color=color.new(color.white,100))
plot(10,color = color.new(color.yellow,0))
plot(-10,color = color.new(color.yellow,0))
current=plot(current_value, color = color1)
fill(plot1 = current, plot2 = zero, color=color.new(color2,90))

change=input(false,"Order block bar detection")


if current_value[1]>10 and current_value<-10 and current_value>-20 and change==true
    label.new(bar_index, current_value-10, style=label.style_triangleup, color=color.yellow, textcolor=color.white, size = size.tiny)

if current_value[1]<-10 and current_value>10 and current_value<20 and change==true
    label.new(bar_index, current_value+10, style=label.style_triangledown, color=color.yellow, textcolor=color.white, size = size.tiny)