Laguerre True Range - A Tunable Measure of Volatility |
J. Welles Wilder's Average True Range is a fantastic measure of volatility. Its an smoothed average - typically a 14 period moving average using Wilder's smoothing method.
Laguerre filters are also fast-acting methods to smooth inputs. John Eulers described a fast Laguerre method to smooth financial market data in his article entitled "Time Warp - Without Space Travel". Speed is good; speed with market data is fast money.
https://www.mesasoftware.com/papers/TimeWarp.pdf
The method below, uses Wilder's true range calculation, but uses Eulers' High-Low Laguerre Filter (EHLLF) to average the result, producing a tunable plot of volatility. It can be as responsive as Wilders' ATR, with noisy output (try gamma of -0.5) or a nice smooth response (with gamma of +0.5). Gamma's can be over -1.0 and below +1.0.
Enjoy!
Code:
# Laguerre True Range - A tunable measure of volatility
# Authored by whoDAT - May 4, 2025
declare lower;
# True Range Calculation
def trueR = max(high-low, max(high-close[1], close[1]-low));
# The Gamma is the dampening function.
# - Increasing Gamma values (approaching 1.0) will dampen the input more, reducing volatility the true range output.
# - Lower Gamma values (approaching -1.0) will make a noisy output.
input Gamma = 0.000;
Assert(absValue(Gamma) < 1.0, "Gamma must not be greater than 1.0 or less than -1.0");
# Laguerre filter
def L0 = (1 - Gamma) * trueR + (Gamma * L0[1]);
def L1 = (-1 * Gamma * L0) + L0[1] + (Gamma * L1[1]);
def L2 = (-1 * Gamma * L1) + L1[1] + (Gamma * L2[1]);
def L3 = (-1 * Gamma * L2) + L2[1] + (Gamma * L3[1]);
def LTR = (L0 + (2 * L1) + (2 * L2) + L3) / 6;
plot LaguerreTrueRange = LTR;
# END OF CODE
Comparison LTR with gamma of 0; to 14 period ATR.
Last edited: