mirror of
https://github.com/softwaredevelop/mql5.git
synced 2026-08-21 08:18:07 +00:00
refactor: Simplified Price Source Selection
This commit is contained in:
+14
-19
@@ -6,9 +6,6 @@ The Ehlers Smoother Momentum Pro is a versatile oscillator that applies one of J
|
||||
|
||||
While the standard `Ehlers_Smoother_Pro` provides a smoothed representation of the trend, this indicator isolates and smooths the bar-by-bar momentum. The user can choose which smoothing engine to use, allowing for a trade-off between responsiveness and smoothness in the final oscillator.
|
||||
|
||||
* **SuperSmoother Mode (Default):** Creates an exceptionally smooth momentum oscillator that is excellent for identifying the main momentum swings while filtering out minor noise. Its zero-crosses are reliable, albeit slightly lagging, timing signals.
|
||||
* **UltimateSmoother Mode:** Creates a faster, more responsive momentum oscillator with near-zero lag, which reacts very quickly to changes in momentum.
|
||||
|
||||
## 2. Mathematical Foundations and Calculation Logic
|
||||
|
||||
The indicator is a smoothed average of the `Close - Open` value of each bar, using one of two advanced recursive filters.
|
||||
@@ -21,17 +18,18 @@ The indicator is a smoothed average of the `Close - Open` value of each bar, usi
|
||||
## 3. MQL5 Implementation Details
|
||||
|
||||
* **Unified Calculator (`Ehlers_Smoother_Calculator.mqh`):** This indicator uses the exact same, powerful calculator engine as the `Ehlers_Smoother_Pro`. The only difference is that it is initialized in `SOURCE_MOMENTUM` mode.
|
||||
* **Optimized Incremental Calculation:**
|
||||
|
||||
* **Optimized Incremental Calculation (O(1)):**
|
||||
Unlike basic implementations that recalculate the entire history on every tick, this indicator employs an intelligent incremental algorithm.
|
||||
* It utilizes the `prev_calculated` state to determine the exact starting point for updates.
|
||||
* **Persistent State:** The internal momentum buffer (`m_price`) and the output buffer (`filter_buffer`) persist their state between ticks. This allows the recursive IIR filter 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.
|
||||
* **Heikin Ashi Integration:** The indicator fully supports calculation on smoothed Heikin Ashi data (`HA Close - HA Open`), leveraging the same optimized engine.
|
||||
* **State Tracking:** It utilizes `prev_calculated` to process only new bars.
|
||||
* **Persistent Buffers:** The indicator buffer itself acts as the persistent memory for the recursive calculation, ensuring seamless updates without drift or full recalculation.
|
||||
|
||||
* **Heikin Ashi Integration:** The indicator fully supports calculation on smoothed Heikin Ashi data (`HA Close - HA Open`).
|
||||
|
||||
## 4. Parameters
|
||||
|
||||
* **Smoother Type (`InpSmootherType`):** Allows the user to select the filter for the momentum calculation: `SUPERSMOOTHER` or `ULTIMATESMOOTHER`.
|
||||
* **Period (`InpPeriod`):** The critical period of the selected filter, which controls its smoothing and responsiveness.
|
||||
* **Smoother Type (`InpSmootherType`):** Selects the filter (`SUPERSMOOTHER` or `ULTIMATESMOOTHER`).
|
||||
* **Period (`InpPeriod`):** The critical period of the selected filter. (Default: `20`).
|
||||
* **Candle Source (`InpCandleSource`):** Selects between `Standard` and `Heikin Ashi` candles for the `Close - Open` calculation.
|
||||
|
||||
## 5. Usage and Interpretation
|
||||
@@ -40,18 +38,15 @@ The Ehlers Smoother Momentum is a zero-mean oscillator used for identifying mome
|
||||
|
||||
### Standalone Usage
|
||||
|
||||
* **Zero-Line Crossover:** This is the primary signal.
|
||||
* A cross **above the zero line** indicates that bullish momentum is taking control.
|
||||
* A cross **below the zero line** indicates that bearish momentum is dominant.
|
||||
* The **SuperSmoother** mode provides smoother, more confirmed crossover signals, while the **UltimateSmoother** mode provides faster, earlier signals.
|
||||
* **Divergence:** Divergences between the price and the oscillator are powerful reversal signals, particularly clear in the smoother SuperSmoother mode.
|
||||
* **Zero-Line Crossover:**
|
||||
* **Bullish:** Cross above zero.
|
||||
* **Bearish:** Cross below zero.
|
||||
* **Divergence:** Powerful reversal signal.
|
||||
|
||||
### Combined Strategy with Ehlers Smoother (Primary Use)
|
||||
|
||||
This oscillator is designed to be used in conjunction with its companion indicator, the `Ehlers_Smoother_Pro`.
|
||||
|
||||
* **The Zero-Cross Predicts the Smoother's Turning Point:**
|
||||
* **Buy Signal:** When the **Smoother Momentum** line crosses **above the zero line**, it signals that the `Ehlers Smoother` on the main chart is forming a **trough (a bottom)**.
|
||||
* **Sell Signal:** When the **Smoother Momentum** line crosses **below the zero line**, it signals that the `Ehlers Smoother` is forming a **peak (a top)**.
|
||||
|
||||
This strategy allows a trader to use the momentum oscillator as a **leading indicator** to anticipate the turning points of the smoother, lagging filter on the price chart.
|
||||
* **Buy Signal:** Momentum crosses above zero -> Smoother forms a trough.
|
||||
* **Sell Signal:** Momentum crosses below zero -> Smoother forms a peak.
|
||||
|
||||
Reference in New Issue
Block a user