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
246 lines of Pine Script v5 from Tradingview/linear-regression-mtf-bands.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
Linear Regression MTF + Bands calculates regression lines with standard deviation bands for up to three timeframes, each configurable with length, deviation, color, width, and background transparency. Bands can be shown as history fills or extended in different directions. Users can enable alerts on breakouts for selected timeframes. The tool draws upper and lower bands plus the midline on the main chart, allowing comparison across short, medium, and long timeframes for trend and volatility analysis.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Alerts TF1
bool
false
ALERTS_TF1
Alerts TF2
bool
false
ALERTS_TF2
Alerts TF3
bool
true
ALERTS_TF3
Show TF1
bool
false
use_tf1
History Band
bool
true
tf1_band
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
Show all 33 settings
Setting
Type
Default
Variable
Background Transparency
int
90
tf1_bg
Show TF2
bool
false
use_tf2
History Band
bool
true
tf2_band
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
History Band
bool
true
tf3_band
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.
This indicator plots Donchian Channel boundary lines along with dynamic fan projections directly on the price chart. It calculates the highest high, lowest low, and median price over a customizable lookback period. Whenever price establishes a new channel high
Dynamic Linear Regression calculates and plots linear regression trendlines and standard deviation channels directly on the price chart over a user-selected time period. Traders can configure static channels locked at the end time, dynamic channels that contin
This indicator overlays trend-following Supertrend bands on the price chart using Average True Range calculations. It plots trailing stop lines, highlights active trend directions, and prints buy or sell shape labels when price closes across band thresholds. I
Calculates an ATR-based trailing stop overlaid on the price chart to assist with trend identification and stop placement. Using a specified ATR period and multiplier, it projects upper and lower bounds around the closing price. The stop line ratchets up during
Moon Dev Lunar Sniper is a multi-indicator overlay that scores confluence across fast and slow EMAs, RSI, MACD, DMI, and BB width to fire signals only when score meets the minimum threshold. It plots buy and sell signals on the price chart, highlights cosmic b
This overlay indicator plots a SuperTrend line on the price chart using a fixed ATR length of 10 and a factor of 3. When the trend direction is up it draws a green line and a light green fill toward the candle midpoint; when down it draws a red line and a ligh