Laguerre True Range For ThinkOrSwim

whoDAT

Member
Plus
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.

LaguerreATR.jpg
 
Last edited:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
441 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top