OPEN-SOURCE SCRIPT
Supertrend with Bands

SUPERTREND WITH UPPER AND LOWER BANDS - INDICATOR DESCRIPTION
OVERVIEW:
This Pine Script indicator implements the SuperTrend technical analysis tool with visible upper and lower bands. SuperTrend is a trend-following indicator that helps traders identify the current market direction and potential entry/exit points.
HOW IT WORKS:
The indicator uses the Average True Range (ATR) to calculate dynamic support and resistance bands around the price:
1. BASIC BANDS CALCULATION:
- Upper Band = HL2 + (ATR × Multiplier)
- Lower Band = HL2 - (ATR × Multiplier)
- HL2 = (High + Low) / 2
2. FINAL BANDS ADJUSTMENT:
- Bands are adjusted based on price movement to create a trailing stop mechanism
- Upper band only moves down or stays flat when price is above it
- Lower band only moves up or stays flat when price is below it
3. SUPERTREND LINE:
- Switches between upper and lower bands based on price crossovers
- When price is above the SuperTrend line = UPTREND (green)
- When price is below the SuperTrend line = DOWNTREND (red)
KEY FEATURES:
✓ Visual upper and lower bands showing the ATR-based zones
✓ Color-coded SuperTrend line (green for uptrend, red for downtrend)
✓ Buy/Sell signals when trend changes
✓ Customizable ATR period and multiplier
✓ Background color indication of current trend
✓ Built-in alerts for trend changes
✓ Toggle options for bands and signals
DEFAULT PARAMETERS:
- ATR Period: 10
- ATR Multiplier: 3.0
USAGE:
- Lower multiplier (1.5-2.5) = More sensitive, more signals, more noise
- Higher multiplier (3.5-5.0) = Less sensitive, fewer signals, filters noise
- Use in conjunction with other indicators for confirmation
- Best suited for trending markets
TRADING SIGNALS:
- BUY: When price closes above the upper band (trend changes from down to up)
- SELL: When price closes below the lower band (trend changes from up to down)
Note: This indicator is based on the classic SuperTrend algorithm and should be used as part of a comprehensive trading strategy, not as a standalone signal.
OVERVIEW:
This Pine Script indicator implements the SuperTrend technical analysis tool with visible upper and lower bands. SuperTrend is a trend-following indicator that helps traders identify the current market direction and potential entry/exit points.
HOW IT WORKS:
The indicator uses the Average True Range (ATR) to calculate dynamic support and resistance bands around the price:
1. BASIC BANDS CALCULATION:
- Upper Band = HL2 + (ATR × Multiplier)
- Lower Band = HL2 - (ATR × Multiplier)
- HL2 = (High + Low) / 2
2. FINAL BANDS ADJUSTMENT:
- Bands are adjusted based on price movement to create a trailing stop mechanism
- Upper band only moves down or stays flat when price is above it
- Lower band only moves up or stays flat when price is below it
3. SUPERTREND LINE:
- Switches between upper and lower bands based on price crossovers
- When price is above the SuperTrend line = UPTREND (green)
- When price is below the SuperTrend line = DOWNTREND (red)
KEY FEATURES:
✓ Visual upper and lower bands showing the ATR-based zones
✓ Color-coded SuperTrend line (green for uptrend, red for downtrend)
✓ Buy/Sell signals when trend changes
✓ Customizable ATR period and multiplier
✓ Background color indication of current trend
✓ Built-in alerts for trend changes
✓ Toggle options for bands and signals
DEFAULT PARAMETERS:
- ATR Period: 10
- ATR Multiplier: 3.0
USAGE:
- Lower multiplier (1.5-2.5) = More sensitive, more signals, more noise
- Higher multiplier (3.5-5.0) = Less sensitive, fewer signals, filters noise
- Use in conjunction with other indicators for confirmation
- Best suited for trending markets
TRADING SIGNALS:
- BUY: When price closes above the upper band (trend changes from down to up)
- SELL: When price closes below the lower band (trend changes from up to down)
Note: This indicator is based on the classic SuperTrend algorithm and should be used as part of a comprehensive trading strategy, not as a standalone signal.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.