1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
228 lines of Pine Script v5 from Tradingview/linreg-mtf.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
For every enabled timeframe it draws an upper band, lower band, and midline from a chosen price source, regression length, and deviation. Users can show or hide each channel, set line width and color, fill transparency, and extend lines left, right, both ways, or not at all. Separate alert toggles exist for each timeframe. Timeframe choices are 1, 5, 15, 30, 60, and 240 minutes. It does not place trades.
Three optional multi-timeframe regression channels
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Alerts TF1
bool
true
ALERTS_TF1
Alerts TF2
bool
true
ALERTS_TF2
Alerts TF3
bool
true
ALERTS_TF3
Show TF1
bool
true
use_tf1
Timeframe
int
5
tf1_timeframe
source
close
tf1_price
Length
int
100
tf1_linreg_length
Deviation
float
2
tf1_linreg_deviation
upper Color
color
color.new(#ffee58, 0)
tf1_color
Extension
string
None
tf1_extend
Width
int
1
tf1_width
Background Transparency
int
90
tf1_bg
Show all 30 settings
Setting
Type
Default
Variable
Show TF2
bool
true
use_tf2
Timeframe
int
15
tf2_timeframe
source
close
tf2_price
Length
int
100
tf2_linreg_length
Deviation
float
2
tf2_linreg_deviation
upper Color
color
color.new(#ff9800, 0)
tf2_color
Extension
string
None
tf2_extend
Width
int
3
tf2_width
Background Transparency
int
82
tf2_bg
Show TF3
bool
true
use_tf3
Timeframe
int
60
tf3_timeframe
source
close
tf3_price
Length
int
100
tf3_linreg_length
Deviation
float
2
tf3_linreg_deviation
upper Color
color
color.new(#0086ff, 0)
tf3_color
Extension
string
None
tf3_extend
Width
int
5
tf3_width
Background Transparency
int
75
tf3_bg
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
The Adaptive Laguerre Filter calculates a smoothed, dynamically adjusted trendline plotted directly on the main price chart. It dynamically adjusts its damping factor (alpha) based on recent price range variations and median percentile calculations over a spec
This indicator detects equal highs and lows by comparing prices within user-defined left and right bars using a tolerance percentage. It plots horizontal lines on the price chart for equal highs in one color and lows in another. A screener allows input of mult
This indicator classifies each bar as bull, bear, or sideways from a rolling log return compared with adjustable percentage thresholds. It paints a regime ribbon on the price chart, shows a current-regime banner, and labels state changes after a minimum hold.
This script plots three moving averages on the price chart: a fast EMA or SMA with 10 periods, a slow EMA or SMA with 20 periods, and a trend EMA or SMA with 100 periods. It signals trend changes by drawing a white cross when the fast moving average crosses ab
This indicator calculates an ATR trailing stop line derived from the highest high minus an average true range multiple over a specified lookback period. It plots the trailing stop line directly on the price chart and colors price bars based on whether the clos
All Candlestick Patterns detects and highlights a wide range of bullish, bearish, and neutral candlestick patterns directly on the price chart. It features optional trend filtering using either a 50-period simple moving average or a combination of 50-period an