Measures the true price range including gaps between consecutive trading periods.
Export Optimization Code
Optimization Code
True Range - Quick Reference
True Range is a fundamental volatility measure that quantifies price movement for a single period. This comprehensive approach captures gaps and limit moves that a simple high-low range would miss.
It calculates the largest of three price differences: the current high minus the current low, the absolute value of the current high minus the previous close, or the absolute value of the current low minus the previous close.
Developed by J. Welles Wilder Jr. in 1978 as part of his Average True Range indicator, True Range has become a building block for many volatility-based indicators and trading systems. It provides a standardized way to measure volatility across different assets and timeframes.
What It Measures
True Range measures the actual volatility of an asset for a single period by finding the greatest price movement among three calculations: current high-low range, absolute distance from current high to previous close, and absolute distance from current low to previous close.
When to Use
Volatility Assessment: Understanding current market volatility levels for risk management
Position Sizing: Adjusting position sizes based on recent volatility
Stop Loss Placement: Setting stops at multiples of True Range to avoid premature exits
Building Block: Foundation for Average True Range (ATR) and other volatility indicators
Gap Analysis: Identifying when gaps create larger price movements than intraday ranges
Interpretation
Higher Values: Indicate increased volatility and larger price movements
Lower Values: Suggest decreased volatility and smaller price movements
Sudden Spikes: Often occur during gaps, breakouts, or significant news events
Relative Comparison: Most useful when compared to recent values or averaged over time
Asset-Specific: Raw True Range values vary by asset price level; higher-priced assets typically show larger True Range values
No Period Parameter: Unlike most indicators, True Range is calculated independently for each bar without looking at historical periods
Default Usage
use centaur_technical_indicators::other_indicators::bulk::true_range;
pub fn main() {
// fetch the data in your preferred way
// let close = vec![...]; // previous close prices
// let high = vec![...]; // high prices
// let low = vec![...]; // low prices
let tr = true_range(&close, &high, &low);
println!("True Range: {:?}", tr);
}
import centaur_technical_indicators as cti
# True Range calculation
tr = cti.other_indicators.bulk.true_range(close, high, low)
print("True Range:", tr)
import init, {
other_bulk_trueRange
} from 'https://cdn.jsdelivr.net/npm/centaur-technical-indicators@latest/dist/web/centaur-technical-indicators.js';
await init();
// fetch the data in your preferred way
// const close = [...]; // previous close prices
// const high = [...]; // high prices
// const low = [...]; // low prices
const tr = other_bulk_trueRange(close, high, low);
console.log("True Range:", tr);