|
Category
Multi-Bar Functions
Description
Two-pole highpass filter as described by John Ehlers.
Syntax
EhlersHP(expr, count)
Parameters
expr - data series formula
count - lookback period
Notes
Removes low-frequency components (trends) from the input, passing only cycle activity shorter than the specified period.
Useful for detrending a price series while preserving its cyclical behavior.
The count argument may be a formula rather than a constant. A non-constant period is re-evaluated on every bar: the filter coefficients are recomputed from that bar’s value and the recursion continues from the stored prior outputs, the same adaptive model used by AEMA. The period formula may even reference the enclosing Data item’s own prior values at offsets of 1 or more, allowing self-tuning filters.
On bars where the period evaluates to n/a, the output is n/a, and the recursion re-seeds when the period next becomes valid. The effective period is internally clamped to a minimum of 2 bars.
This function supports one-pass calculation when used in the Data Section.
Example
Removes trend components longer than 40 bars from the closing price, leaving only shorter-term cyclical movement.
Useful as a detrending step before cycle analysis.
|