TradingView
SebMatte
3 Nov 2021 pukul 17.29

Triple Colored Least Squares Moving Average + Crossover Alerts 

Bitcoin Perpetual FuturesFTX

Deskripsi

This script is forked from the ‘ Double Colored Least Squares Moving Average + Crossover Alerts ‘ from @IronKnightmare.

First release & notes : 2021-11-03.

Overview:

The Least Squares Moving Average is used mainly as a crossover signal to identify bullish or bearish trends. When a shorter duration line cross a longer one a trend can be identified. When multiple lines or the price action cross a longterm trend the confirmation can be further validated. Tradingview contains already some indicators with 1 or two LSMA trendlines that can be configured and toggled.

The original script that I forked had two LSMA lines that could be plotted with other valuable functions, I added a third for further confirmation as some trading systems will use three lines or some combination of those for validation.

Usage:

In inputs

- You will see LSMA 1, LSMA 2 & LSMA 3. The default values are 40, 100 & 400 representing the number of periods plotted by that line : fast, medium and slow changing trendlines will be plotted. The offset value and source are standard for most scripts.

In Style
- You can toggle LSMA 1, 2 or 3 and any combination of those. There are much more possibilities this way.
- For each LSMA, Color 0 & Color 1 are for coloring the slope of the trendline,

- Color 0 for rising slope,
- Color 1 for descending slope.
- The script will automatically color the rise or fall of the trendline accordingly. You can also set one identical color in both slopes for one unique color.


- The ‘Long Crossover 1 on 2’ is a signal for when the LSMA 1 cross over the LSMA 2, usually a shorter periods trendline, more volatile, climbing over the medium term one. A Signal will be traced on the chart at that crossing, you can configure this. The ‘Short Crossover 1 on 2’ is when the LSMA 1 cross under the LSMA 2, a signal will be traced on the chart accordingly.

- The Long Crossover 1 on 3 & Short Crossover 1 on 3 act on the same principle, although the crossing of the fast LSMA on the long / slow LSMA are used. Both can be toggled.

- The ‘Background Coloring Line 1 : 0-Neutral, 1-Up, 2-Down’ is an optional background coloring for the LSMA1 line. This can provide additional information at a quick glance, especially if you combine the two other lines backgrounds, the partial transparency will compound.




Catatan Rilis

Update 2021-11-07

- Added Symbol Description in Status line,

- Started working on customizable alerts -- commented out in the script, work in progress.

Catatan Rilis

Added 'timeframe="", timeframe_gape=true' so that the indicator can use different timeframes than the ticker's active timeframe. Thanks @ebanat420 for the suggestion!
Komentar
viki9894320049
Plz add pivot with same indicator
ebanat420
Hello, this is a very useful script, I wonder, if you could add a feature to select custom timeframes. Would be really nice to be able to see 5 or 15 min LSMA but on 1 minute chart. I know I can just adjust parameters by multiplying, but it's not that convinient.

As far as I understand, for that to work you'll just need to change line 7 of source code to

indicator(title="Triple Colored Least Squares Moving Average + Crossover Alerts", shorttitle="Triple LSMA", overlay=true, timeframe="", timeframe_gaps=true)
SebMatte
@ebanat420, hello, I'm not sure what you are asking for because when I look on 1 min candles say on BTC, I see the script loading correctly?

Otherwise you can specify custom values in the input tab?
ebanat420
@SebMatte, yeah, custom values work fine, but being able to change timeframes of indicator would be faster than changing values.

Default MACD script has a feature to choose indicator timeframe, for example. So you can open 1 minute chart and set indicator's TF to 3 minutes, and you'll see 3 minute indicator values on 1 minute chart. It'd be very convinient for scalping and swing trading.
SebMatte
@ebanat420, Hello, yes I understand now, I've added the functions :-)
ebanat420
@SebMatte, thank you very much!
Nimishshah
Greetings ,
Triple LSMA :
Would truly appreciate if following queries can be enlightened

# offset values and source for LSMA 1 ,2,3 (9,18,50 ) incorporated by us for intraday ,swing and positional equity trades

# Your settings for LSMA which is generating the most optimal risk reward

CC: Since we use Heikin Ashi candles ,is our selection of OHLC4 as source in settings correct .kindly suggest

Regards
photo_romeo
very good....thanks...
Lebih lanjut