Trace phase changes into the smoothing coefficient
In the public Ehlers listing, a weighted price smoother and Hilbert-transform calculations produce in-phase I and quadrature Q components. Phase is arctan(Q/I) in degrees. The following equations describe the final adaptive stage; brackets denote the preceding bar. The suggested limits are fast = 0.5 and slow = 0.05.
- Require 0 < slow ≤ fast ≤ 1. Because d ≥ 1, α cannot exceed fast under these constraints. These are coefficient limits, not lengths such as 5 or 50 bars.
- Preserve the phase convention. The original half-cycle arctangent wrap can produce a negative difference, which the floor converts to 1. Using an absolute difference or replacing arctan with atan2 changes the algorithm.
- A port must convert radians to degrees before applying the 1-degree floor. The period estimator also has its own bounds and smoothing; those intermediate rules are in the linked original listing.
- Flat or irregular input need not contain a stable cycle. A computed phase is an estimator output, not evidence that a recurring market period exists. Near-zero I or Q makes the division and fallback policy worth inspecting.
| Quantity | Calculation |
|---|---|
| Phase difference | d = max(1, phase[1] − phase) |
| Adaptive coefficient | α = max(slow, fast / d) |
| MAMA | M = α × price + (1 − α) × M[1] |
| FAMA | F = (α / 2) × M + (1 − α / 2) × F[1] |