Read the public two-stage recurrence
Let P be the input, H the high-pass output and R the final Roofing output. Brackets mean earlier bars. The table expresses trigonometric arguments in radians; the original EasyLanguage listing uses degrees. The example preserves its rounded constants 0.707, 1.414 and 3.14159 so that replacing them with square roots and a more precise pi does not silently change the reference.
- At HP = 48 and LP = 10: α = 0.088513480, k = 0.913445179, c1 = 0.253135177, c2 = 1.158161019 and c3 = −0.411296196. These are rounded displays, not rounded calculation inputs.
- The smoother consumes H, not the original price. Applying it to price would leave the slow drift that the high-pass stage was intended to suppress.
- A moving average preserves a constant price level. This high-pass stage has zero response to a constant input and zero second difference for a linear ramp. A Kalman filter requires a state model and noise assumptions; it is not this fixed recurrence.
| Stage | Formula |
|---|---|
| High-pass coefficients | θ = 0.707 × 2π / HP; α = (cos θ + sin θ − 1) / cos θ; q = 1 − α; k = (1 − α/2)² |
| High-pass recurrence | H = k(P − 2P[1] + P[2]) + 2qH[1] − q²H[2] |
| Smoother coefficients | a = exp(−1.414 × 3.14159 / LP); c2 = 2a cos(1.414π / LP); c3 = −a²; c1 = 1 − c2 − c3 |
| Roofing recurrence | R = c1(H + H[1])/2 + c2R[1] + c3R[2] |