OPEN-SOURCE SCRIPT

LSMAs

52
This indicator calculates and plots two Least Squares Moving Averages (LSMA) based on different lengths and a Smoothed Moving Average (SMMA) of the longer LSMA.

Inputs

lengthA : Period length for the first, longer LSMA.
lengthB : Period length for the second, shorter LSMA.
signAl : Signal period used in SMMA smoothing.

Calculations

LSMA-A and LSMA-B : Calculates the linear regression (least squares) of source over lengthA and lengthB respectively, with no offset. These represent two LSMAs, one slow and one fast.

SMMA : This is a smoothed moving average of the longer LSMA (LSMA-A).

Purpose

This indicator helps traders identify trend directions and momentum by using two least squares regression lines of different lengths to capture short- and long-term trends in price. The SMMA smoothing of the longer LSMA may be used as a signal or confirmation line to reduce noise and produce smoother signals.

It generates buy and sell signals based on the intersection of the LSMA-A and SMMA. If the LSMA-A crosses the SMMA upwards, a BUY signal is generated; if it crosses the SMMA downwards, a SELL signal is generated.

The LSMA-B, which is short-term, can be used for wave analysis. When a peak forms, a high is observed on the chart, and when a valley forms, a low is observed. This allows us to determine whether the wave is rising or falling.

Summary

Two LSMAs are calculated: one slow (lengthA), one fast (lengthB).
A smoothed moving average (SMMA) of the slow LSMA is computed using the signal length (signAl).

All three curves are overlaid on the price chart for visual trend and momentum analysis.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.