Wick Pressure by SiddWolf
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © SiddWolf

//@version=5
indicator(title="Wick Pressure by SiddWolf", shorttitle="WP [SiddWolf]", overlay=true)

mee_rsi = ta.rsi(close, 14)
atr_mult = input.float(title="ATR Multiplier",defval=0.7, step=0.1, minval=0.4, maxval=2.0, tooltip="The Wick area is filtered on the basis of atr and this is multiplier to that ATR. The more the multiplier value, the less the signals and vice versa")
box_length = input.int(title="Box Length",defval=16, step=2, minval=4, maxval=100, tooltip="Length of Wick Pressure Box")
rsi_ob = input.int(title="RSI OverBought",defval=60, step=5, minval=50, maxval=90, inline="rsi_settings", tooltip="RSI based on which signnals are filtered")
rsi_os = input.int(title="RSI OverSold",defval=40, step=5, minval=10, maxval=50, inline="rsi_settings")
bull_color = input(defval=#00FF0021, title="Bullish Pressure", inline="box_color")
bear_color = input(defval=#FF000021, title="Bearish Pressure", inline="box_color")


//bullish wick pressure
rsi_bullish_cond = mee_rsi < rsi_os or mee_rsi[1] < rsi_os or mee_rsi[2] < rsi_os
ll3 = ta.lowest(low, 3)
lc3 = math.min(ta.lowest(close, 3), ta.lowest(open, 3))
sidd_bull_cond = low<=lc3 and low[1]<=lc3 and low[2]<=lc3 and open>=lc3 and open[1]>=lc3 and open[2]>=lc3 and lc3-ll3>(atr_mult*ta.atr(14)) and rsi_bullish_cond and close>open
if sidd_bull_cond
    box.new(bar_index, lc3, bar_index+box_length, ll3, bgcolor=bull_color, border_color=color.green)

plotshape(sidd_bull_cond,  style = shape.triangleup, color = color.green, location =  location.belowbar, size = size.small)




//bearish wick pressure
rsi_bearish_cond = mee_rsi > rsi_ob or mee_rsi[1] > rsi_ob or mee_rsi[2] > rsi_ob
hh3 = ta.highest(high, 3)
hc3 = math.max(ta.highest(close, 3), ta.highest(open, 3))
sidd_bear_cond = high>=hc3 and high[1]>=hc3 and high[2]>=hc3 and open<=hc3 and open[1]<=hc3 and open[2]<=hc3 and hh3-hc3>(atr_mult*ta.atr(14)) and rsi_bearish_cond and close<open
if sidd_bear_cond
    box.new(bar_index, hh3, bar_index+box_length, hc3, bgcolor=bear_color, border_color=color.red)

plotshape(sidd_bear_cond,  style = shape.triangledown, color = color.red, location =  location.abovebar, size = size.small)

