1988issue C041-8
Constructing unsigned true range for directional models
True range is assembled first as an unsigned volatility primitive that a later directional-index forecast and an ATR-bounded exposure filter can both reuse. A short wheat control series is used only to confirm that the three-way maximum matches the definition.
- A directional-movement construction begins with two measurements: true range, and the portion of that movement that was directional.
- True range is the largest of the current high-low span and the two unsigned close-to-extreme distances, stored as a positive quantity on the second data row.
- A 14-session wheat control series returns a first true-range value of 3 when named ranges and the three-way maximum are assembled correctly.
- Convert each evaluated cell to a stored value, stop when the next close is blank, and branch only after a drop routine returns so a longer series does not fail a short test.
Two measurements come first
A directional-movement construction begins with two measurements: the true range of price movement and the portion of that movement that was directional. True range is assembled first. The directional share is a later measurement and is left aside here.
The largest of three distances
True range is defined as the largest of three distances: today's high minus today's low, today's high minus yesterday's close, and today's low minus yesterday's close. That is the current high-low span together with the two unsigned distances from the prior close to today's high and today's low, keeping only the largest.
The first true-range cell belongs on the second data row because the comparison needs yesterday's close as well as today's high and low.
Keep the quantity unsigned
True range must be stored as a positive quantity. A gap can make a close-to-extreme difference large in magnitude but signed, and a signed value would distort the maximum if it were left unsigned.
Absolute-value conversion is applied to each close-to-extreme gap, not to the outer maximum. It is omitted from the high-low span because that span cannot be negative.
Check the first cell on a control series
A 14-session wheat sample is used as a control series. When named ranges and the three-way maximum are assembled correctly, the first computed true-range value is 3. The sample is used only to check that the programmed comparison matches the definition.
Editorial. Do not attach an average directional index forecast or an ATR position sizing filter until that first control value is in place.
Store the result before the named range moves
After a true-range formula is evaluated, converting that cell to a stored value prevents later movement of the named inputs from rewriting every earlier result to the newest calculation.
A range walk then moves the named input cells down one row after each true-range write so the same comparison can be reused on the next session.
End the loop without stacking calls
A processing loop can stop when the next close cell is blank. That blank-cell stop lets an actively updated price series run without a pre-counted number of rows.
A branch placed inside a called drop routine is treated as a new nested call on each loop. An environment that tracks 32 nested levels can fail near 30 rows even when a 14-row test succeeds.
The nesting failure is avoided by branching only after the drop routine returns, or by clearing the call stack with a restart before branching back to the true-range evaluation.
All readings on this track · 36 readings
- 1988Constructing unsigned true range for directional models
- 1989Evaluate an always-in ATR breakout as one procedure
- 1992Variable lookback and average true range as a trend-filter construction
- 1993A random-walk index that uses true range as its scale
- 1993A shared harness for trend-filter construction
- 1998Finish a trend with a volatility trail, wave permission, and a slower-frame veto
- 1999A trend filter that switches tactics and scales ATR targets
- 2001Filter higher lows with linear regression, then judge the exit
- 2003A Mechanical trading system is a maintained procedure, not only an entry trigger
- 2005Construction of a volatility-bounded long entry
- 2005Six-zone encoding of open, high, low, and close
- 2006Normalized average true range as a pre-entry volatility bound
- 2006Chandelier exits, ATR position sizing, and trailing stops
- 2007Constructing a rule-based entry with Relative Strength Index and ATR position sizing
- 2008Constructing a zero-lag TMA and heikin-ashi crossover as a complete rule set
- 2010Use the session-range percent stop as a pre-trade filter
- 2011OCA exit groups, trailing limits, and ATR stops
- 2011ATR bands around support and resistance for stops and targets
- 2013Algorithmic head-and-shoulders construction with bounded exits
- 2013Constructing ATR-scaled swing pivots and linear-regression divergence
- 2013Constructing volatility bands from typical price
- 2014Constructing true-range contraction filters before expansion
- 2015Constructing touch plans from modified true range
- 2015One checklist for breakout entry and ATR risk
- 2015Percentage true-range construction for cross-market volatility filters
- 2015Construct a percentage true range for cross-market volatility
- 2015Percentage true range as a pre-entry exposure filter
- 2016Constructing ATR-filtered breakout entries
- 2017A dividend date as a pairs-trading classroom
- 2018Range-based volatility as a true-range construction
- 2018Moving average support and volatility-band construction
- 2018Construct a lifecycle breakout from compression
- 2018Pair the book first and let volatility or range set the size
- 2019Trend systems need a no-trade rule
- 2020Average true range as a shared unit for size, pairs, and stops
- 2020Volatility sizing and target-risk leverage as a pre-trade gate