Bollinger Bands 2-Candle Rejection Indicator
TraderOracle Method(creator) – Converted by CANDO13579
Overview:
The Bollinger Bands 2-Candle Rejection indicator is designed to highlight potential trend reversals by identifying two-bar rejection patterns at the Bollinger Bands extremes. It combines standard Bollinger Bands with a candlestick pattern methodology to generate early signals for bullish and bearish reversals.
Logic & Functionality:
Uses a standard Bollinger Bands calculation with customizable length (bbLength) and standard deviation (bbStdDev).
Detects bearish rejection when a prior bullish candle is followed by a candle that closes below the Bollinger Bands upper boundary, indicating potential downward momentum.
Detects bullish rejection when a prior bearish candle is followed by a candle that closes above the Bollinger Bands lower boundary, signaling possible upward momentum.
Visual cues include arrows on the chart for buy/sell signals, colored clouds highlighting the reversal area, and optional text labels for quick reference.
Supports real-time alerts for both bullish and bearish rejection patterns, enabling traders to act promptly.
Visual Features:
Upper, middle, and lower Bollinger Bands plotted for reference.
Arrows indicating rejection signals: green for bullish and red for bearish.
Background cloud coloring for immediate visual confirmation of signals.
Optional chart labels for signal clarity.
Inputs:
bbLength – Period for Bollinger Bands calculation (default: 20).
bbStdDev – Standard deviation multiplier for band width (default: 2.0).
showLabels – Toggle display of textual labels on the chart (default: yes).
Credits:
Indicator conversion by: CANDO13579
This indicator is ideal for intraday traders and swing traders seeking early reversal signals at key volatility levels. It works best when combined with trend confirmation tools and volume analysis for improved accuracy.
TraderOracle Method(creator) – Converted by CANDO13579
Overview:
The Bollinger Bands 2-Candle Rejection indicator is designed to highlight potential trend reversals by identifying two-bar rejection patterns at the Bollinger Bands extremes. It combines standard Bollinger Bands with a candlestick pattern methodology to generate early signals for bullish and bearish reversals.
Logic & Functionality:
Uses a standard Bollinger Bands calculation with customizable length (bbLength) and standard deviation (bbStdDev).
Detects bearish rejection when a prior bullish candle is followed by a candle that closes below the Bollinger Bands upper boundary, indicating potential downward momentum.
Detects bullish rejection when a prior bearish candle is followed by a candle that closes above the Bollinger Bands lower boundary, signaling possible upward momentum.
Visual cues include arrows on the chart for buy/sell signals, colored clouds highlighting the reversal area, and optional text labels for quick reference.
Supports real-time alerts for both bullish and bearish rejection patterns, enabling traders to act promptly.
Visual Features:
Upper, middle, and lower Bollinger Bands plotted for reference.
Arrows indicating rejection signals: green for bullish and red for bearish.
Background cloud coloring for immediate visual confirmation of signals.
Optional chart labels for signal clarity.
Inputs:
bbLength – Period for Bollinger Bands calculation (default: 20).
bbStdDev – Standard deviation multiplier for band width (default: 2.0).
showLabels – Toggle display of textual labels on the chart (default: yes).
Credits:
Indicator conversion by: CANDO13579
- Bollinger Bands methodology: John Bollinger
- Candle rejection logic: TraderOracle Method(creator)
This indicator is ideal for intraday traders and swing traders seeking early reversal signals at key volatility levels. It works best when combined with trend confirmation tools and volume analysis for improved accuracy.
Code:
# Bollinger Bands 2-Candle Rejection
# TraderOracle Method-----BY;CANDO!#%&(
declare upper;
# Inputs
input bbLength = 20;
input bbStdDev = 2.0;
input showLabels = yes;
# Bands Calculation
def basis = Average(close, bbLength);
def dev = bbStdDev * StDev(close, bbLength);
def upperBB = basis + dev;
def lowerBB = basis - dev;
# Previous bar
def prevUpperBB = upperBB[1];
def prevLowerBB = lowerBB[1];
def prevHigh = high[1];
def prevLow = low[1];
def prevClose = close[1];
def prevOpen = open[1];
# Candle color
def currCandleRed = close < open;
def currCandleGreen = close > open;
def prevCandleGreen = prevClose > prevOpen;
def prevCandleRed = prevClose < prevOpen;
# DEF;
def bearCond = prevHigh >= prevUpperBB and
high >= upperBB and
currCandleRed and
prevCandleGreen;
def bullCond = prevLow <= prevLowerBB and
low <= lowerBB and
currCandleGreen and
prevCandleRed;
# Plot Bands
plot UpperBand = upperBB;
plot LowerBand = lowerBB;
plot MiddleBand = basis;
UpperBand.SetDefaultColor(GetColor(1));
LowerBand.SetDefaultColor(GetColor(1));
MiddleBand.SetDefaultColor(GetColor(2));
MiddleBand.SetStyle(Curve.SHORT_DASH);
# Plot signals
plot bearishSignal = if bearCond then high else Double.NaN;
plot bullishSignal = if bullCond then low else Double.NaN;
bearishSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
bearishSignal.SetDefaultColor(Color.RED);
bearishSignal.SetLineWeight(2);
bullishSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
bullishSignal.SetDefaultColor(Color.GREEN);
bullishSignal.SetLineWeight(2);
# labels
AddLabel(showLabels, "BB 2-Candle Rejection", Color.WHITE);
AddLabel(showLabels and bearCond, "BEARISH REJECTION", Color.RED);
AddLabel(showLabels and bullCond, "BULLISH REJECTION", Color.GREEN);
# Alerts
alert(bearCond, "Bearish BB 2-Candle Rejection", Alert.BAR, Sound.Chimes);
alert(bullCond, "Bullish BB 2-Candle Rejection", Alert.BAR, Sound.Bell);
alert(bearCond or bullCond, "BB 2-Candle Rejection Signal", Alert.BAR, Sound.Ding);
# background color
AddCloud(if bearCond then Double.POSITIVE_INFINITY else Double.NaN, Double.NEGATIVE_INFINITY, Color.RED, Color.RED);
AddCloud(if bullCond then Double.POSITIVE_INFINITY else Double.NaN, Double.NEGATIVE_INFINITY, Color.GREEN, Color.GREEN);
Last edited by a moderator: