The Holt Double Exponential Smoothing (DES), or Holt's Linear Trend Method, is a powerful statistical technique for smoothing and forecasting time series data. Unlike traditional moving averages, Holt's method explicitly models and smooths two distinct components: the **Level** (average value) and the **Trend** (rate of change).
By separating these components, the Holt method produces an exceptionally smooth moving average that is also a **one-bar-ahead forecast** of the price level.
The core of our implementation is a single, powerful calculation engine. This include file contains the complete logic for calculating all Holt components (Level, Trend, Forecast, and Channel bands). It supports both standard and Heikin Ashi data sources through class inheritance (`CHoltEngine` and `CHoltEngine_HA`), eliminating code duplication.
Unlike basic implementations that recalculate the entire history on every tick, this indicator employs an intelligent incremental algorithm.
* **State Tracking:** It utilizes `prev_calculated` to process only new bars.
* **Persistent Buffers:** The internal buffers (Level, Trend) persist their state between ticks. This allows the recursive Holt equations to continue seamlessly from the last known values without re-processing the entire history.
* This results in **O(1) complexity** per tick, ensuring instant updates and zero lag, even on charts with extensive history.
* **Alpha (`InpAlpha`):** The smoothing factor for the Level. Lower values create a smoother level. Default is `0.1`.
* **Beta (`InpBeta`):** The smoothing factor for the Trend. Lower values create a more stable trend component. Default is `0.05`.
* **Source Price (`InpSourcePrice`):** The price data used for the calculation. This unified dropdown menu allows you to select from all standard and Heikin Ashi price types.
* **Display Mode (`InpDisplayMode`):** (Only for `Holt_Pro`) Toggles between displaying only the MA line or the full MA + Channel.
* **Forecast Period (`InpForecastPeriod`):** (Only for `Holt_Pro` in Channel mode) The number of bars (`m`) to project into the future for the channel bands. Default is `5`.
* **Trend Filter:** The slope of the Holt MA line indicates the smoothed, forecasted trend direction. A flattening line is an early warning that the trend is losing momentum.
* **Dynamic Support/Resistance:** The line acts as an intelligent S/R level that projects where the "fair value" should be in the next bar.
* **Channel as Forecast Path:** The channel visualizes the path the price is expected to follow if the current trend persists. When price touches or exceeds the outer channel bands, it signals that the move is potentially over-extended.
* **Trend Direction:** Values above the zero line indicate a bullish trend; values below indicate a bearish trend. A crossover of the zero line is a strong trend-change signal.
* **Trend Velocity:** The magnitude of the oscillator's bars indicates the speed of the trend. Rising bars show acceleration; falling bars (while still on the same side of zero) show deceleration.
* **Divergence:** Divergence between the oscillator and price can signal trend exhaustion and an impending reversal.