bullish_engulfing = close[1] < open[1] and close > open and close > open[1] rsi_below = rsi < rsi_index_param decrease_over = close < close[candle_delta_length_param]
var last_signal = '' var tp = 0. var sl = 0.
bull_state = bullish_engulfing and stable_candle and rsi_below and decrease_over and barstate.isconfirmed bull = bull_state and (disable_repeating_signals_param ? (last_signal != 'buy' ? true : na) : true)
bearish_engulfing = close[1] > open[1] and close < open and close < open[1] rsi_above = rsi > 100 - rsi_index_param increase_over = close > close[candle_delta_length_param]
bear_state = bearish_engulfing and stable_candle and rsi_above and increase_over and barstate.isconfirmed bear = bear_state and (disable_repeating_signals_param ? (last_signal != 'sell' ? true : na) : true)