OPEN-SOURCE SCRIPT

(BUY-SELL)RSI with Bollinger Bands

Updated
This script for TradingView combines two popular technical analysis indicators - the Relative Strength Index (RSI) and Bollinger Bands - to identify when an asset's price may be overbought or oversold.
Here's how it works:
Input parameters:
rsiLength: the RSI calculation period (default is 14).
rsiOverbought: the overbought level of the RSI (default is 70).
rsiOversold: RSI oversold level (default is 30).
bbLength: Bollinger Bands calculation period (default is 20).
bbMult: standard deviation multiplier for Bollinger Bands (default is 2.0).
reducePyramiding: option to reduce pyramiding (off by default).
Indicator Calculation:
The script calculates RSI and Bollinger Bands using the built-in functions ta.rsi() and ta.bb().
Signal conditions:
Buy signal: generated when the RSI falls below the rsiOversold level and the closing price is below the lower Bollinger Band.
Sell signal: generated when the RSI rises above the rsiOverbought level and the closing price is above the upper Bollinger Band.
Pyramiding:
The script uses the buyCount and sellCount counters to track the number of consecutive buy and sell signals.
The maxTrades parameter defines the maximum number of trades in one direction (1 if reducePyramiding is enabled, and 3 otherwise).
Release Notes
v.6
This script for TradingView combines two popular technical analysis indicators - the Relative Strength Index (RSI) and Bollinger Bands - to identify when an asset's price may be overbought or oversold.
Here's how it works:
Input parameters:
rsiLength: the RSI calculation period (default is 14).
rsiOverbought: the overbought level of the RSI (default is 70).
rsiOversold: RSI oversold level (default is 30).
bbLength: Bollinger Bands calculation period (default is 20).
bbMult: standard deviation multiplier for Bollinger Bands (default is 2.0).
reducePyramiding: option to reduce pyramiding (off by default).
Indicator Calculation:
The script calculates RSI and Bollinger Bands using the built-in functions ta.rsi() and ta.bb().
Signal conditions:
Buy signal: generated when the RSI falls below the rsiOversold level and the closing price is below the lower Bollinger Band.
Sell signal: generated when the RSI rises above the rsiOverbought level and the closing price is above the upper Bollinger Band.
Pyramiding:
The script uses the buyCount and sellCount counters to track the number of consecutive buy and sell signals.
The maxTrades parameter defines the maximum number of trades in one direction (1 if reducePyramiding is enabled, and 3 otherwise).
Bollinger Bands (BB)Chart patternsforecasting

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer