The One Euro Filter

Whenever John Ehlers writes about a new indicator, I crack it open and wire it straight into C for the Zorro platform. Or rather, I let ChatGPT do most of the work. The One Euro Filter is a minimalistic, yet surprisingly effective low-latency smoother that reacts instantly to volatility with less lag of the usual adaptive averages. This is achieved by dynamically adapting its time period.

This is the OneEurFilter function in C, converted straight from Ehlers’ EasyLanguage code, the comments left in place:

var OneEurFilter(vars Data, int PeriodMin, var Factor)
{
  vars SmoothedDX = series(Data[0],2), 
    Smoothed = series(Data[0],2);
  var Alpha = 2*PI/(4*PI + 10);
//EMA the Delta Price
  SmoothedDX[0] = Alpha*(Data[0]-Data[1]) + (1.-Alpha)*SmoothedDX[1];
//Adjust cutoff period based on a fraction of the rate of change
  var Cutoff = PeriodMin + Factor*abs(SmoothedDX[0]);
//Compute adaptive alpha
  Alpha = 2*PI/(4*PI + Cutoff);
//Adaptive smoothing
  return Smoothed[0] = Alpha*Data[0] + (1.-Alpha)*Smoothed[1];
}

This is how the OneEurFilter (blue line) looks when applied on a ES chart:

The price curve is well reproduced with almost no lag. Cheap, efficient, low-latency — 1 Euro well spent. The code can be downloaded from the 2026 script repository.

7 thoughts on “The One Euro Filter”

  1. fraction of the rate of change doesn’t have an effect on cutoff period

    “`
    #include // copy pasta from article

    DLLFUNC void run()
    {
    StartDate = 20260101;
    LookBack = 500;
    vars p = series(price(0));
    var x = OneEurFilter(p,100, .2); // <— notice Factor argument
    var y = OneEurFilter(p,100, .4);
    var z = OneEurFilter(p,100, .6);
    plot("x",x,LINE,BLACK);
    plot("y",y,LINE,GREEN);
    plot("z",z,LINE,BLUE);
    }
    “`

    all 3 graphed lines look identical

  2. issue was – rate of change was deep down in decimals for selected instrument

    with Factor values [200000, 400000, 600000] difference becomes visible
    (guess the instrument)

    which leads me thinking – it’s a really bad parameter design

    responsiveness is tightly coupled with how many digits signal value has

  3. I guess the indicator was intended for futures with daily bars, as almost all indicators by Ehlers. For Forex or other assets with very small differences, or for shorter bar periods, you must use an accordingly higher Factor.

    You could experiment with a modification, for using really the rate of change instead of just a difference.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.