Tom's Moving Average & Lagging Span
Jul 25, 2018

The Tom's Moving Average & Lagging Span indicator provides a comprehensive multi-period trend analysis toolkit by combining five Simple Moving Averages (SMA) with a displaced Ichimoku Lagging Span to identify momentum and historical price comparisons.
Usage
The Usage of this indicator focuses on identifying trend direction, potential reversals, and dynamic support and resistance levels across various timeframes.
- Trend Identification: By plotting five distinct SMAs—ranging from very short-term (5 periods) to very long-term (200 periods)—traders can visualize the strength of a trend. When the shorter SMAs are positioned above the longer SMAs, it typically indicates a bullish trend, while the reverse indicates a bearish trend.
- Lagging Span Analysis: The Lagging Span (Chikou Span) plots the current closing price shifted back by a specific number of periods (default is 26). This allows traders to compare current price action to historical price levels to determine if the market is in a breakout or range-bound state.
- Price Crossovers: The indicator is configured to monitor price interactions with the "Short SMA" (defaulting to 20 periods). Crossovers above or below this specific moving average are often used as signals for short-term momentum shifts.
Details
The indicator is constructed using standard Simple Moving Average calculations and price displacement logic. It was originally designed by @matsu_bitmex and refactored for modern script standards.
- Moving Averages: The script calculates five separate SMAs using a user-defined source (typically the closing price). These lengths are optimized for common technical analysis benchmarks: 5, 20, 40, 100, and 200.
- Displacement: The Lagging Span component utilizes a negative offset. This visualizes the current price 26 bars in the past, a core component of the Ichimoku Kinko Hyo system, helping to identify where current price sits relative to past volatility.
- Alert System: The script includes optimized alert conditions for price crossing the 20-period SMA, facilitating automated monitoring of key trend pivots.
Settings
- SMA very short length: Sets the lookback period for the fastest moving average (Default: 5).
- SMA short length: Sets the lookback period for the short-term moving average and alert trigger (Default: 20).
- SMA middle length: Sets the lookback period for the medium-term moving average (Default: 40).
- SMA long length: Sets the lookback period for the long-term moving average (Default: 100).
- SMA very long length: Sets the lookback period for the macro trend moving average (Default: 200).
- SMA source: Determines the price input used for all SMA calculations (Default: Close).
- Lagging Span Length: Determines the number of bars the price is shifted backward on the chart (Default: 26).
FAQ
What is the benefit of using five different moving averages? Using multiple SMAs allows traders to see the "tide" of the market across different horizons simultaneously, helping to distinguish between a minor pullback and a major trend change.
Can the Lagging Span be used for trade signals? Yes, in Ichimoku theory, when the Lagging Span is above the price candles from 26 periods ago, it is considered bullish; when below, it is considered bearish.
How do I access Tom's Moving Average & Lagging Span? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.