RSI bullish divergence

RSI bullish divergence is an alert that checks every 15 minutes, fires at most once per bar and shows where it fires on the chart.

core language

rsi-bullish-divergence.abx
1alert "RSI bullish divergence"
2check: every 15m
3repeat: once per bar
4show_on_chart: true
5
6input rsi_length = 14
7input lookback = 30
8
9momentum_now = rsi(close, rsi_length)
10lower_low = low < lowest(low, lookback)[1]
11higher_rsi = momentum_now > lowest(momentum_now, lookback)[1]
12
13when lower_low and higher_rsi and was(momentum_now < 30, within: 5 bars):
14notify "Bullish RSI divergence on {market.symbol}: RSI {momentum_now:0.0}"
What this script says

RSI bullish divergence is an alert that checks every 15 minutes, fires at most once per bar and shows where it fires on the chart.

You can change 2 inputs: rsi_length (default 14) and lookback (default 30).

It calculates momentum_now as the RSI over rsi_length bars, lower_low as whether the low is below the previous bar's lowest low of the last lookback bars and higher_rsi as whether momentum_now is above the previous bar's lowest momentum_now of the last lookback bars.

When lower_low and higher_rsi and momentum_now is below 30 at some point within the last 5 bars, it sends the notification "Bullish RSI divergence on {market.symbol}: RSI {momentum_now:0.0}".

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account