// © dadoesploso
//@version=4
study(title=”Volatility Expansion Levels”, shorttitle = “VEL”,overlay=true)
atrc = input(defval=0.9, title=”ATR Multiplier (of Trapped Trend Bar minimum absolute close-to-open distance). Default is 0.9. Higher values make the indicator picky.”)
atrct = input(defval=2.0, title=”Trapping Trend Bar Close-Open Minimum value (relative to Trapped Trend Bar absolute close-to-open distance). Default is 2. Higher values make the indicator picky.”)
lenght = input(title=”Rectangle Lenght”, type=input.integer, defval=350)
//Bullish VEL
if (open[1] – close[1]) > atrc*atr(10) and close – open > atrct*(open[1] – close[1])
box.new(left=bar_index[1],top=open[1],right=bar_index+lenght,bottom=lowest(low,1),
border_color=color.blue,border_width=3,bgcolor=na)
alert(“Bullish OB”,alert.freq_once_per_bar_close)
//Bearish VEL
if (close[1] – open[1]) > atrc*atr(10) and open – close > atrct*(close[1] – open[1])
box.new(left=bar_index[1],top=highest(high,1),right=bar_index+lenght,bottom=open[1],
border_color=color.red,border_width=3,bgcolor=na)
alert(“Bearish OB”,alert.freq_once_per_bar_close)