the only reliable indicator in bear market ...

do you want it? first understand that it works with levels, if they are broken and it is bear market (sma333), it puts you a sell (short or sale). this is to know the levels over 1/2 hour, do they break them or not

nh = ta.highest(close,range)

nb = ta.lowest(close,range)

afterwards you need to know the value of the price range with

ranges = nh-nb

afterwards we will set how much you want it to break, this value of 1 is ultimately good

sup = input.int(1, "break value")

rs = input.int(1,"break range")

and finally the break, to put a sale, if we are below the lowest price added to 1/4 of the price range, and if the trend goes down (p33 is a boolean, 1 or 0, true or false, so positive if we go up over 33 minutes)

(close < nh[sup]-(ranges[rs]/4) and p33==false))

with that you were crazy when it break if you are in a bear market (use a sma 333 on 1 minute to know bear = sma333-sma333[1]>0? false:true

bear will be true if we are in a bear market

//@version=6

indicator("level 3",overlay=true)

range = input.int(33,"range")

nh = ta.highest(close,range)

nb = ta.lowest(close,range)

sup = input.int(1, "breakout value")

rs = input.int(1,"breakout range")

tend = input.int(13,"trend study")

// to filter we only count the small variations, not the big ones (sma)

ranges = nh-nb

//filter a little

float tp =0

if (bar_index > 0)

for i=0 to tend

mp = close[i]-close[i+1]>=0?true:false

dp = math.abs(close[i]-close[i+1])

tp := mp ? tp+dp: tp-dp

p33 = tp<span false:true

tp:=0

// introduce psychological prices like 99k

if ( p33 and close > nb and close < nb+( ranges/4) or (close > nh[sup]+( ranges[rs]/4) and p33))

label.new(bar_index, low, "B", style=label.style_label_up, color=color.green, textcolor=color.white)

alert("purchase possibility!", alert.freq_once_per_bar)

if ( p33==false and close < nh and close > nh-( ranges/4) or (close < nb[sup]-( ranges[rs]/4) and p33==false))

the rest in my articles