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>
8.1 KiB
UBANDS: Ultimate Bands
Overview and Purpose
Ultimate Bands, developed by John F. Ehlers, are a volatility-based channel indicator designed to provide a responsive and smooth representation of price boundaries with significantly reduced lag compared to traditional Bollinger Bands. Bollinger Bands typically use a Simple Moving Average for the centerline and standard deviations from it to establish the bands, both of which can increase lag. Ultimate Bands address this by employing Ehlers' Ultrasmooth Filter for the central moving average. The bands are then plotted based on the volatility of price around this ultrasmooth centerline.
The primary purpose of Ultimate Bands is to offer traders a clearer view of potential support and resistance levels that react quickly to price changes while filtering out excessive noise, aiming for nearly zero lag in the indicator band.
Core Concepts
- Ultrasmooth Centerline: Employs the Ehlers Ultrasmooth Filter as the basis (centerline) for the bands, aiming for minimal lag and enhanced smoothing.
- Volatility-Adaptive Width: The distance between the upper and lower bands is determined by a measure of price deviation from the ultrasmooth centerline. This causes the bands to widen during volatile periods and contract during calm periods.
- Dynamic Support/Resistance: The bands serve as dynamic levels of potential support (lower band) and resistance (upper band).
Common Settings and Parameters
| Parameter | Default | Function | When to Adjust |
|---|---|---|---|
| Source | close | The price series used for calculations. | Can be adjusted to hlc3, ohlc4, etc., for different interpretations of price. |
| Length | 20 | Lookback period for the Ehlers Ultrasmooth Filter and the deviation measure. | Shorter lengths make the bands more responsive but potentially noisier; longer lengths provide smoother bands but may moderately increase lag. |
| StdDev Multiplier | 1.0 | Multiplier for the calculated deviation to plot the bands from the centerline. | Smaller values create tighter bands; larger values create wider bands. |
Calculation and Mathematical Foundation
Ehlers' Original Concept for Deviation: John Ehlers describes the deviation calculation as: "The deviation at each data sample is the difference between Smooth and the Close at that data point. The Standard Deviation (SD) is computed as the square root of the average of the squares of the individual deviations." This describes calculating the Root Mean Square (RMS) of the residuals:
Smooth = UltrasmoothFilter(Source, Length)Residuals[i] = Source[i] - Smooth[i]SumOfSquaredResiduals = Sum(Residuals[i]^2)forioverLengthMeanOfSquaredResiduals = SumOfSquaredResiduals / LengthSD_Ehlers = SquareRoot(MeanOfSquaredResiduals)(This is the RMS of residuals)
Pine Script Implementation's Deviation: The provided Pine Script implementation calculates the statistical standard deviation of the residuals:
Smooth = UltrasmoothFilter(Source, Length)(referred to as_ehusfin the script)Residuals[i] = Source[i] - Smooth[i]Mean_Residuals = Average(Residuals, Length)Variance_Residuals = Average((Residuals[i] - Mean_Residuals)^2, Length)SD_Pine = SquareRoot(Variance_Residuals)(This is the statistical standard deviation of residuals)
Band Calculation (Common to both approaches, using their respective SD):
UpperBand = Smooth + (NumSDs × SD)LowerBand = Smooth - (NumSDs × SD)
🔍 Technical Note: The Pine Script implementation uses a statistical standard deviation of the residuals (differences between price and the smooth average). Ehlers' original text implies an RMS of these residuals. While both measure dispersion, they will yield slightly different values. The Ultrasmooth Filter itself is a key component, designed for responsiveness.
Interpretation Details
- Reduced Lag: The primary advantage is the significant reduction in lag compared to standard Bollinger Bands, allowing for quicker reaction to price changes.
- Volatility Indication: Widening bands indicate increasing market volatility, while narrowing bands suggest decreasing volatility.
- Overbought/Oversold Conditions (Use with caution):
- Price touching or exceeding the Upper Band may suggest overbought conditions.
- Price touching or falling below the Lower Band may suggest oversold conditions.
- Trend Identification:
- Price consistently "walking the band" (moving along the upper or lower band) can indicate a strong trend.
- The Middle Band (Ultrasmooth Filter) acts as a dynamic support/resistance level and indicates the short-term trend direction.
- Comparison to Ultimate Channel: Ehlers notes that the Ultimate Band indicator does not differ from the Ultimate Channel indicator in any major fashion.
Use and Application
Ultimate Bands can be used similarly to how Keltner Channels or Bollinger Bands are used for interpreting price action, with the main difference being the reduced lag.
Example Trading Strategy (from John F. Ehlers):
- Hold a position in the direction of the Ultimate Smoother (the centerline).
- Exit that position when the price "pops" outside the channel or band in the opposite direction of the trade.
- This is described as a trend-following strategy with an automatic following stop.
Performance Profile
Operation Count (Streaming Mode, per Bar)
Ultimate Bands uses Ehlers Ultrasmooth Filter (4-pole IIR) plus RMS deviation:
| Operation | Count | Cost (cycles) | Subtotal |
|---|---|---|---|
| ADD/SUB | 10 | 1 | 10 |
| MUL | 12 | 3 | 36 |
| DIV | 2 | 15 | 30 |
| SQRT | 1 | 15 | 15 |
| Total | 25 | — | ~91 cycles |
Breakdown:
- Ultrasmooth Filter (4-pole IIR): 4 ADD + 8 MUL = 28 cycles
- Residual calculation: 1 SUB = 1 cycle
- RMS (squared residuals sum): 2 ADD + 2 MUL + 1 DIV = 23 cycles
- Std dev + bands: 1 SQRT + 2 MUL + 2 ADD = 23 cycles
Complexity Analysis
| Mode | Complexity | Notes |
|---|---|---|
| Streaming | O(1) | IIR filter with constant state |
| Batch | O(n) | Linear scan, IIR sequential |
Memory: ~64 bytes (4-pole filter state, residual buffer for RMS)
SIMD Analysis
| Optimization | Applicable | Notes |
|---|---|---|
| AVX2 vectorization | ❌ | 4-pole IIR recursive dependency |
| FMA | ✅ | IIR coefficients: a*x + b*y patterns |
| Batch parallelism | ❌ | IIR filter inherently sequential |
Note: The Ultrasmooth Filter's 4-pole IIR structure creates strong recursive dependencies that prevent SIMD parallelization. FMA benefits in coefficient multiplication.
Quality Metrics
| Metric | Score | Notes |
|---|---|---|
| Accuracy | 9/10 | Ehlers filter provides excellent smoothing |
| Timeliness | 9/10 | Designed for near-zero lag |
| Overshoot | 8/10 | Ultrasmooth minimizes overshoot |
| Smoothness | 9/10 | 4-pole filter extremely smooth |
Limitations and Considerations
- Lag (Minimized but Present): While significantly reduced, some minimal lag inherent to averaging processes will still exist. Increasing the
Lengthparameter for smoother bands will moderately increase this lag. - Parameter Sensitivity: The
LengthandStdDev Multipliersettings are key to tuning the indicator for different assets and timeframes. - False Signals: As with any band indicator, false signals can occur, particularly in choppy or non-trending markets.
- Not a Standalone System: Best used in conjunction with other forms of analysis for confirmation.
- Deviation Calculation Nuance: Be aware of the difference in deviation calculation (statistical standard deviation vs. RMS of residuals) if comparing directly to Ehlers' original concept as described.
References
- Ehlers, J. F. (2024). Article/Publication where "Code Listing 2" for Ultimate Bands is featured. (Specific source to be identified if known, e.g., "Stocks & Commodities Magazine, Vol. XX, No. YY").
- Ehlers, J. F. (General). Various publications on advanced filtering and cycle analysis. (e.g., "Rocket Science for Traders", "Cycle Analytics for Traders").