All indicators

LSMA Crossover

Jun 6, 2021

Static chart image
SignalsMoving Averages

The LSMA Crossover indicator provides a multi-layered trend-filtering framework that utilizes various Least Squares Moving Average lengths to identify market direction and potential entry points during pullbacks. It helps traders distinguish between bullish and bearish market phases while highlighting periods of consolidation through the use of linear regression-based calculations.

Usage

Traders use the LSMA Crossover to establish a clear directional bias based on the relationship between price and the various moving average lengths. The indicator is designed to follow these primary rules:

  • Trend Identification: When price action crosses over the LSMA lines, it signals a potential bullish trend. Conversely, when price crosses under the lines, it indicates a bearish trend.
  • Pullback Detection: The indicator is effective for identifying pullbacks within a broader trend. For example, if price is in a macro uptrend but retraces below the shorter-term LSMA lines, it may signal a high-probability entry point as price reverts to the mean.
  • Trend Direction: The slope of the lines indicates the strength and direction of the current trend. A steep upward slope suggests strong bullish momentum, while a downward slope suggests bearish momentum.
  • Sideways Markets: When price action stays close to or oscillates frequently around the lines, sideways or range-bound action is to be expected.

Details

The script is constructed using the Least Squares Moving Average (LSMA), also known as a Linear Regression Moving Average. Unlike standard moving averages, the LSMA calculates a line of best fit for the price data over a specific period using the least squares method. This approach reduces lag compared to traditional moving averages while remaining highly responsive to price shifts.

The implementation features four distinct components:

  1. Primary LSMA: A standard 21-period linear regression line.
  2. Trigger Line: A 4-period Simple Moving Average (SMA) of the primary LSMA used to generate crossover signals.
  3. Long LSMA: A 200-period line used to identify medium-to-long-term trend bias.
  4. Extra Long LSMA: A 1000-period line used to define the macro trend and major institutional support or resistance levels.

Settings

  • Length: Defines the lookback period for the primary Least Squares Moving Average calculation (Default: 21).
  • Offset: Adjusts the horizontal displacement of the LSMA on the chart, allowing it to be shifted forward or backward.
  • Trigger Length: Sets the period for the SMA applied to the LSMA, creating the trigger line for crossover signals (Default: 4).
  • Source: Determines the price input used for all calculations (Default: Close).

FAQ

How do I interpret the different colors on the chart? The different colors represent varying lengths of the LSMA (21, 200, and 1000) and the trigger line. Crosses between the price and these lines, or between the LSMA and the trigger line, indicate shifts in momentum and trend direction.

Can this indicator be used on lower timeframes? Yes, the LSMA Crossover is functional across various timeframes; however, the 200 and 1000-length lines will represent much more significant macro levels on lower timeframes compared to higher ones.

How can I access the LSMA Crossover? 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.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.