fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Hilbert and Ehlers Cycle Analytics

8 algorithms in Statistical Time Series · 8 with asserted arithmetic.

In this family#

  1. Hilbert Transform Dominant Cycle Period verified

    Estimates the dominant cycle length in bars from the bar-to-bar change in the Hilbert phase angle, clamping each raw estimate into the 6-to-50 bar range and smoothing it with a 0.2 / 0.8 exponential update. Any contract failure is rethrown as an Error whose message begins topic calculation failed: .

    hilbertTransformDominantCyclePeriod(input)
  2. Hilbert Transform Dominant Cycle Phase verified

    Returns the instantaneous Hilbert phase angle in radians as atan2(quadrature, in_phase), where both components come from a four-tap filter over the residual of close against its 4-bar EMA. Any contract failure is rethrown as an Error whose message begins topic calculation failed: .

    hilbertTransformDominantCyclePhase(input)
  3. Hilbert Transform Phasor Components verified

    Exposes the raw phasor behind the Hilbert cycle family: the in-phase component, its quadrature partner from the four-tap filter, and the amplitude and angle they form. Any contract failure is rethrown as an Error whose message begins topic calculation failed: .

    hilbertTransformPhasorComponents(input)
  4. Hilbert Transform SineWave verified

    Turns the Hilbert phase angle into the classic sinewave pair, the sine of the phase and a lead sine shifted a quarter turn ahead, whose crossings are the usual cycle-turn signal. Any contract failure is rethrown as an Error whose message begins topic calculation failed: .

    hilbertTransformSinewave(input)
  5. Hilbert Transform Trend/Cycle Mode verified

    Labels each bar trend or cycle by asking whether the distance from close to its exponential trend exceeds 1.5 times the current Hilbert phasor amplitude. Any contract failure is rethrown as an Error whose message begins topic calculation failed: .

    hilbertTransformTrendCycleMode(input)
  6. Ehlers Cyber Cycle verified

    Runs close through a two-pole high-pass filter tuned to period, then smooths the residual with an EMA of the same span, leaving an oscillator centred on zero that tracks the shorter-than-period swings. Any contract failure is rethrown as an Error whose message begins topic calculation failed: .

    ehlersCyberCycle(input)
  7. Ehlers Roofing Filter verified

    Stacks the two halves of a roof: a two-pole high-pass filter tuned to period removes the slow drift, and an Ehlers Super Smoother run at half that span removes the fast noise, leaving the band in between. Any contract failure is rethrown as an Error whose message begins topic calculation failed: .

    ehlersRoofingFilter(input)
  8. Ehlers Decycler verified

    Subtracts a two-pole high-pass residual from close, leaving a trend line with the sub-period wiggle removed and far less lag than a moving average of the same span. Any contract failure is rethrown as an Error whose message begins topic calculation failed: .

    ehlersDecycler(input)

What they share#

Every topic here is a record-transform, so once you have called one the rest follow the same shape. Import paths differ only in the final segment:

ts
import { hilbertTransformDominantCyclePeriod } from "fintech-algorithms/statistical-time-series/hilbert-and-ehlers-cycle-analytics/hilbert-transform-dominant-cycle-period";
import { hilbertTransformDominantCyclePhase } from "fintech-algorithms/statistical-time-series/hilbert-and-ehlers-cycle-analytics/hilbert-transform-dominant-cycle-phase";

Read them in the order above — the sequence is pedagogical, not alphabetical.

Where this sits#

Statistical Time Series collects 37 algorithms across 6 families. For the concept behind this family rather than the call signatures, see the concept guides.