The Chained Linear Regression Reversal Strategy plots linear regression channels with upper and lower standard deviation bands directly on the price chart across a user-defined time window.
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 strategy, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.
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
When price breaks out of the static channel for a confirmed number of bars, a dynamic regression tracking channel starts and locks into a new static channel once its Pearson correlation drops below a set threshold. Trades execute based on channel signals using fixed point-based stop loss and take profit orders.
Linear regression channels with deviation bands
Dynamic regression locking via Pearson correlation threshold
Breakout confirmation filter for channel resets
Fixed point-based stop loss and take profit targets
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
Regression Mode
string
Both
regressionMode
Upper Deviation
bool
true
showUpperChannel
upperDeviation
float
3.0
upperDeviation
Lower Deviation
bool
true
showLowerChannel
lowerDeviation
float
3.0
lowerDeviation
Breakout Confirmation Bars
int
1
breakoutConfirmation
Lock R Threshold
float
0.85
lockRThreshold
Min Bars Before Lock
int
5
minBarsBeforeLock
Show all 24 settings
Setting
Type
Default
Variable
Max Bars Timeout
int
50
maxBarsTimeout
Enable Strategy
bool
true
enableStrategy
Stop Loss (Points)
float
10.0
stopLossPoints
Take Profit (Points)
float
20.0
takeProfitPoints
Uptrend Color
color
#26a69a
uptrendColor
Downtrend Color
color
#ef5350
downtrendColor
Show Entry Regressions
bool
true
showEntryRegressions
Entry Regression Color
color
#ff9800
entryRegressionColor
Fill Transparency
int
93
fillTransparency
Line Width
int
2
lineWidth
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.
RG Structure v2.0 [Visual Edition] is a strategy that identifies pivot points over a lookback window to construct trendlines. It evaluates breaks and retests of these trendlines using scoring weights, violation penalties, and regime detection to generate entry
This strategy identifies pivot-based Darvas Box levels on the price chart and trades re-entries following box sweeps. A long position arms when the price dips below the lower boundary and triggers when it closes back inside, provided the price is above a highe
This trend-following strategy executes a classic Donchian channel breakout system designed to cross-validate backtest results against external framework benchmarks. It triggers a long entry when the closing price breaks above the highest high of the prior entr
This strategy plots running pivot highs as red R circles and pivot lows as blue S circles directly on the price chart. It computes an EMA 3 and a Cto trend line from close prices, then generates long signals on upward EMA-Cto crossovers combined with price pos
Calculates multi-period logarithmic regression trend channels and deviation bands across up to twenty selectable lookback lengths directly on the price chart. It evaluates channel slopes and Pearson's correlation coefficient to detect market trends and generat
This trend breakout strategy plots Donchian Channels consisting of upper, lower, and middle bands directly on the main price chart. Long positions enter when price touches the upper channel and pulls back to or below the middle band, placing a stop loss at the