Linear Regression Reversal Strategy is a Pine Script chart overlay indicator that plots a linear regression trendline with upper and lower standard deviation channel bounds for a specified date range.
1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
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
The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.
Overview
Users can select exact start and end timestamps directly on the chart, switch price sources, or ignore wicks to analyze candle body midpoints. It displays Pearson correlation coefficient statistics through customizable labels and an optional statistics table. The indicator renders regression and channel lines on the main price chart for visual structural analysis.
Linear regression trendline with standard deviation channels
Interactive chart selection for start and end calculation times
Option to exclude wicks and calculate using candle body midpoints
Pearson correlation coefficient display and optional statistics table
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Start Time
time
timestamp("2024-01-01 00:00")
startTime
End Time
time
timestamp("2024-12-31 23:59")
endTime
Ignore Wicks
bool
false
ignoreWicks
Price Source
source
close
priceSource
Upper Deviation
bool
true
showUpperChannel
upperDeviation
float
2.0
upperDeviation
Lower Deviation
bool
true
showLowerChannel
lowerDeviation
float
2.0
lowerDeviation
Regression Line Color
color
#2962FF
regressionColor
Regression Background Color
color
color.new(#2962FF, 90)
regressionFillColor
Upper Channel Color
color
color.new(#26a69a, 50)
upperChannelColor
Lower Channel Color
color
color.new(#ef5350, 50)
lowerChannelColor
Show all 18 settings
Setting
Type
Default
Variable
Line Width
int
2
lineWidth
Show Pearson R Label
bool
true
showLabel
Label Style
string
Minimal
labelStyle
Label Position
string
Right
labelPosition
Show Statistics Table
bool
false
showStatsTable
Table Position
string
Top Right
tablePosition
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
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
The Ultimate Channel calculates an ultra-smoothed centerline alongside upper and lower volatility bands directly on the main price chart. It processes true range values through an advanced infinite impulse response smoothing filter to establish dynamic channel