Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat> Co-authored-by: Warp <agent@warp.dev>
11 KiB
STBANDS: Super Trend Bands
Overview and Purpose
Super Trend Bands (STBANDS) is an advanced channel indicator that extends the popular SuperTrend concept by displaying both upper and lower bands along with the primary SuperTrend line. This indicator creates a dynamic channel system based on Average True Range (ATR) calculations, providing traders with clear visual support and resistance levels that adapt to market volatility in real-time.
Unlike static channels, STBANDS adjusts its width and position based on current market volatility, making it particularly effective in trending markets. The bands serve multiple purposes: identifying trend direction, providing dynamic support/resistance levels, and generating entry/exit signals based on price interaction with the channel boundaries.
Core Concepts
- Dynamic adaptation: Band width automatically adjusts based on market volatility using ATR calculations
- Trend identification: Color-coded bands (green for uptrend, red for downtrend) provide immediate trend recognition
- Support/resistance levels: Upper and lower bands act as dynamic support and resistance zones
- Trend persistence: Bands maintain their direction until a definitive trend reversal occurs
- Volatility filtering: ATR-based calculations filter out market noise while preserving significant price movements
- Visual clarity: Combined band display with SuperTrend line provides comprehensive trend analysis
The indicator's strength lies in its ability to provide both directional bias (through the SuperTrend line) and specific entry/exit levels (through the band boundaries), making it suitable for various trading strategies from trend following to mean reversion.
Common Settings and Parameters
| Parameter | Default | Function | When to Adjust |
|---|---|---|---|
| ATR Period | 10 | Lookback period for Average True Range calculation | Decrease for faster response to volatility changes, increase for smoother bands |
| Source | Close | Price data used for calculations | Consider using HLC3 for more comprehensive price representation |
| ATR Multiplier | 3.0 | Distance of bands from center line in ATR units | Increase for wider bands in volatile markets, decrease for tighter channels |
Pro Tip: In trending markets, use lower multiplier values (2.0-2.5) for tighter bands that provide more frequent signals. In ranging markets, use higher multiplier values (3.5-4.0) to avoid false breakouts.
Calculation and Mathematical Foundation
Simplified explanation: STBANDS calculates the Average True Range over a specified period, then creates upper and lower bands by adding and subtracting a multiple of ATR from the midpoint of each bar's high-low range. The bands dynamically adjust based on price action and trend direction.
Technical formula:
- Calculate True Range: TR = max(High - Low, |High - Previous Close|, |Low - Previous Close|)
- Calculate ATR = Simple Moving Average of TR over Period
- Basic Upper Band = (High + Low) / 2 + (Multiplier × ATR)
- Basic Lower Band = (High + Low) / 2 - (Multiplier × ATR)
- Apply trend persistence logic to final bands
- Determine trend direction based on price position relative to bands
Detailed calculation steps:
- Compute True Range for current bar using high, low, and previous close
- Maintain rolling average of True Range values over the specified period
- Calculate basic upper and lower bands using HL2 midpoint and ATR distance
- Apply trend persistence rules:
- Upper band = min(current basic upper, previous upper) if previous close > previous upper
- Lower band = max(current basic lower, previous lower) if previous close < previous lower
- Determine trend: Uptrend if close > previous lower band, Downtrend if close < previous upper band
- SuperTrend line = Lower band in uptrend, Upper band in downtrend
🔍 Technical Note: The implementation uses a circular buffer for efficient ATR calculation and applies trend persistence logic to prevent band oscillation during minor price fluctuations. The color coding changes dynamically based on trend direction, providing immediate visual feedback.
Interpretation Details
STBANDS provides multiple layers of market analysis:
-
Band Position Analysis:
- Price above both bands: Strong uptrend, potential pullback opportunity
- Price between bands: Neutral/consolidation phase, await directional breakout
- Price below both bands: Strong downtrend, potential bounce opportunity
- Price touching bands: Test of support/resistance, potential reversal zone
-
Trend Direction Signals:
- Green bands: Uptrend in progress, favor long positions
- Red bands: Downtrend in progress, favor short positions
- Band color changes: Potential trend reversal, reassess positions
-
SuperTrend Line Interaction:
- Price above SuperTrend line: Bullish bias, look for buying opportunities
- Price below SuperTrend line: Bearish bias, look for selling opportunities
- SuperTrend line breaks: Potential trend change signals
-
Band Width Analysis:
- Expanding bands: Increasing volatility, stronger trend momentum
- Contracting bands: Decreasing volatility, potential consolidation
- Stable band width: Consistent volatility environment
Trading Applications
Trend Following Strategy:
- Enter long positions when price breaks above red bands (turning green)
- Enter short positions when price breaks below green bands (turning red)
- Use SuperTrend line as trailing stop-loss level
- Exit positions when band color changes
Support/Resistance Trading:
- Buy near lower band in uptrends (green bands)
- Sell near upper band in downtrends (red bands)
- Use opposite band as profit target
- Place stops beyond the bands to account for false breakouts
Breakout Strategy:
- Monitor price consolidation between bands
- Enter long on breakout above upper band with volume confirmation
- Enter short on breakdown below lower band with volume confirmation
- Use initial band width to set profit targets
Mean Reversion Strategy:
- Fade extreme moves beyond the bands
- Enter counter-trend positions when price extends significantly beyond bands
- Target return to SuperTrend line or opposite band
- Use tight stops beyond recent extremes
Signal Combinations
High-Probability Long Signals:
- Price breaks above red upper band with increasing volume
- Bands change from red to green
- Price pulls back to green lower band and bounces
- SuperTrend line slopes upward with expanding green bands
High-Probability Short Signals:
- Price breaks below green lower band with increasing volume
- Bands change from green to red
- Price rallies to red upper band and fails
- SuperTrend line slopes downward with expanding red bands
Consolidation Warnings:
- Price oscillates between bands without clear breakouts
- Band width contracts significantly
- SuperTrend line flattens
- Multiple false band breaks in short timeframe
Advanced Techniques
Multi-Timeframe Analysis:
- Use higher timeframe STBANDS for trend direction
- Use lower timeframe for precise entry/exit timing
- Align positions with higher timeframe band color
- Avoid counter-trend trades against higher timeframe bands
Volatility-Adjusted Position Sizing:
- Increase position size when bands are narrow (low volatility)
- Decrease position size when bands are wide (high volatility)
- Use band width as volatility proxy for risk management
- Adjust stop distances based on current band width
Confluence Trading:
- Combine STBANDS with other support/resistance levels
- Look for band alignment with Fibonacci retracements
- Use band breaks confirmed by momentum indicators
- Validate signals with volume analysis
Performance Profile
Operation Count (Streaming Mode, per Bar)
Super Trend Bands uses ATR calculation plus trend persistence logic:
| Operation | Count | Cost (cycles) | Subtotal |
|---|---|---|---|
| ADD/SUB | 8 | 1 | 8 |
| MUL | 4 | 3 | 12 |
| DIV | 2 | 15 | 30 |
| CMP/ABS/MAX | 6 | 1 | 6 |
| Total | 20 | — | ~56 cycles |
Breakdown:
- True Range (3-way max): 2 SUB + 3 CMP = 5 cycles
- ATR (SMA or Wilder): 2 ADD + 1 DIV = 17 cycles
- Basic bands (HL2 ± ATR×mult): 2 ADD + 2 MUL + 1 DIV = 23 cycles
- Trend persistence (min/max comparisons): 2 CMP = 2 cycles
- Trend direction check: 1 CMP = 1 cycle
- SuperTrend selection: 1 CMP = 1 cycle
Complexity Analysis
| Mode | Complexity | Notes |
|---|---|---|
| Streaming | O(1) | Running ATR with trend state |
| Batch | O(n) | Linear scan |
Memory: ~48 bytes (ATR state, previous bands, trend direction, previous close)
SIMD Analysis
| Optimization | Applicable | Notes |
|---|---|---|
| AVX2 vectorization | Partial | True Range vectorizable |
| FMA | ✅ | hl2 + multiplier * atr pattern |
| Batch parallelism | ❌ | Trend persistence creates dependencies |
Note: Trend persistence logic (comparing current vs previous bands based on close) creates sequential dependencies that prevent full SIMD parallelization.
Quality Metrics
| Metric | Score | Notes |
|---|---|---|
| Accuracy | 8/10 | ATR-based adaptive width |
| Timeliness | 7/10 | Trend persistence reduces whipsaws |
| Overshoot | 6/10 | Bands may lag during rapid volatility changes |
| Smoothness | 8/10 | Persistence logic smooths band transitions |
Limitations and Considerations
- Lag component: Band adjustments occur after price movements, creating some delay in signal generation
- False signals: Volatile markets may produce frequent band color changes without sustained trends
- Parameter sensitivity: Different ATR periods and multipliers can significantly affect signal quality
- Trending bias: Most effective in trending markets, less reliable during extended consolidations
- Whipsaw risk: Rapid trend changes can result in multiple false signals in short timeframes
- Market dependency: Performance varies across different asset classes and volatility regimes
Comparison with Related Indicators
STBANDS vs. Bollinger Bands:
- STBANDS: ATR-based, trend-aware with directional color coding
- Bollinger Bands: Standard deviation-based, symmetrical around moving average
STBANDS vs. Keltner Channels:
- STBANDS: Includes trend persistence logic and SuperTrend line
- Keltner Channels: Static ATR channels without trend direction component
STBANDS vs. Donchian Channels:
- STBANDS: Volatility-adaptive with trend direction
- Donchian Channels: Price-based breakout system using highs/lows
Optimization Guidelines
Parameter Tuning:
- Test ATR periods between 7-20 for different market conditions
- Adjust multiplier based on asset volatility (higher for volatile assets)
- Optimize parameters separately for trending vs. ranging markets
- Consider market-specific adjustments (forex vs. stocks vs. crypto)
Performance Enhancement:
- Combine with volume indicators for signal confirmation
- Use with momentum oscillators to avoid overextended entries
- Apply during specific market sessions for improved accuracy
- Filter signals based on fundamental market conditions
References
- Achelis, S. B. (2000). Technical Analysis from A to Z. McGraw-Hill.
- Bollinger, J. (2002). Bollinger on Bollinger Bands. McGraw-Hill Education.