OPEN-SOURCE SCRIPT

Bollinger Bands with EMA, RSI & MACD

131
Summary of the Script:
This Pine Script strategy combines Bollinger Bands, EMA, RSI, MACD, and ATR to generate high-accuracy buy/sell signals with slightly early entries.

Key Indicators Used:
Bollinger Bands (BB) – Identifies price volatility and trends.
Exponential Moving Averages (EMA) – Includes a 9-period EMA and a faster 5-period EMA to detect short-term trends.
Relative Strength Index (RSI, 9) – Measures momentum; buy signals trigger when RSI > 55, sell when RSI < 45.
MACD (12, 26, 9) – Confirms trend direction and momentum; checks for MACD-line crossover and slope.
ATR (14) – Filters out weak signals; only allows trades when volatility is above 1.1x ATR SMA.
Trend Confirmation (Higher Highs & Lower Lows) – Ensures signals align with market structure.
How Signals are Generated:
Buy Condition:

Fast EMA crosses above BB middle (3-4 candles earlier)
RSI above 55
MACD Line above Signal Line, and MACD slope positive
ATR filter confirms strong volatility
Market in an uptrend (higher highs)
Sell Condition:

Fast EMA crosses below BB middle (3-4 candles earlier)
RSI below 45
MACD Line below Signal Line, and MACD slope negative
ATR filter confirms strong volatility
Market in a downtrend (lower lows)
Output on the Chart:
Green "BUY" label below bars when a buy signal is triggered.
Red "SELL" label above bars when a sell signal is triggered.
Goal:
This script optimizes early entries (3-4 candles prior) while maintaining high accuracy and filtering out false signals using multiple confirmations. 🚀

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.