OPEN-SOURCE SCRIPT

Bollinger Bands + VWAP + 4-State MACD Background

67
Bollinger Bands + VWAP + 4-State MACD Background
An all-in-one technical analysis indicator combining three proven tools with an intelligent momentum-based background visualization system.

📊 FEATURES
Bollinger Bands
Standard Bollinger Bands implementation with full customization options:

Adjustable period length (default: 20)
Multiple moving average types: SMA, EMA, SMMA (RMA), WMA, VWMA
Configurable standard deviation multiplier (default: 2.0)
Visual fill between bands to highlight volatility zones
Offset capability for forward/backward display

Session VWAP (Volume Weighted Average Price)
Automatically resets at the start of each trading session:

Calculates true volume-weighted average price
Resets daily to provide fresh reference levels
Customizable source input (default: HLC3)
Adjustable line appearance (color and width)
Can be toggled on/off as needed

4-State MACD Background System
This is the unique feature of this indicator. The chart background dynamically changes based on MACD momentum analysis, providing instant visual feedback on trend strength and direction:
🟢 Strong Bullish (Bright Green)

MACD line is above signal line
Histogram is growing (momentum accelerating upward)
Indicates strong upward momentum

🟢 Weak Bullish (Pale Green)

MACD line is above signal line
Histogram is shrinking (momentum decelerating)
Early warning signal that uptrend may be weakening

🔴 Strong Bearish (Bright Red)

MACD line is below signal line
Histogram is falling (momentum accelerating downward)
Indicates strong downward momentum

🔴 Weak Bearish (Pale Red)

MACD line is below signal line
Histogram is rising (momentum decelerating)
Early warning signal that downtrend may be weakening


🎯 HOW TO USE
For Trend Trading:

Strong colored backgrounds indicate confirmed momentum in that direction - consider staying with the trend
Weak colored backgrounds signal potential momentum exhaustion - watch for possible reversals
Use VWAP as a dynamic support/resistance level
Bollinger Band breakouts combined with strong MACD backgrounds can confirm trend strength
Price above VWAP + strong bullish background = bullish bias
Price below VWAP + strong bearish background = bearish bias

For Mean Reversion:

Price touching upper/lower Bollinger Bands with weak MACD background may suggest potential reversal
VWAP acts as a mean reversion anchor during range-bound sessions
Background color shifts from strong to weak often precede price direction changes
Look for price return to VWAP when extended beyond bands with weakening momentum

Signal Confirmation:
Strongest signals occur when multiple indicators align:

BB breakout + MACD strong color + price above/below VWAP
Price rejection at BB bands + MACD color weakening
VWAP support/resistance hold + MACD color change


⚙️ SETTINGS
All components are fully customizable through organized input groups:
Bollinger Bands Group:

Period length
Moving average type (SMA/EMA/SMMA/WMA/VWMA)
Source (close/open/high/low/etc.)
Standard deviation multiplier
Offset

VWAP Group:

Toggle show/hide
Source calculation method
Line color
Line width

MACD Group:

Toggle background on/off
Fast length (default: 12)
Slow length (default: 26)
Signal length (default: 9)
Source
Four separate color settings for each momentum state
All colors include transparency controls


💡 EDUCATIONAL VALUE
This indicator teaches important concepts:

How volatility (Bollinger Bands) relates to price movement
The importance of volume-weighted pricing (VWAP)
Momentum analysis through MACD
How combining multiple timeframes and indicators can provide confluence
The difference between trend strength and trend direction


⚠️ IMPORTANT NOTES

This indicator is for educational and informational purposes only
No indicator is perfect - always use proper risk management
Past performance does not guarantee future results
Combine with your own analysis and risk tolerance
Test thoroughly on historical data before live trading
This is not financial advice - use at your own risk


🔧 TECHNICAL DETAILS

Pine Script Version 6
Overlay indicator (displays on price chart)
All calculations use standard, well-documented formulas
Minimal lag due to efficient coding
Compatible with all timeframes and instruments
No repainting - all signals are confirmed on bar close


📝 CHANGELOG
Version 1.0

Initial release
Bollinger Bands with multiple MA types
Session VWAP with daily reset
4-state MACD background system
Full customization options


Developed for traders who want multiple confirmation signals in a clean, organized format without cluttering their charts with separate indicator panels.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.