Strategy · Pine Script v6 · On the chart

Chained Linear Regression Reversal Strategy

by shubhamtaywade82

A strategy that fits a linear regression channel over a user-chosen start and end time and draws it on the price chart.

View on GitHub

Archived by its author

GitHub stars1on the repository
Pine versionv6current
Lines of code1,009
Settings22inputs
LicenceNone stated
Last update5 months ago31 May 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 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

A static channel is kept alongside a live one that starts after price closes outside the channel and locks when its correlation falls below a threshold. When enabled, trades use a fixed stop loss and take profit measured in points with one contract per trade. Deviation width, breakout bars and regression mode are adjustable.

Details

Published by

shubhamtaywade82 on GitHub

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Mean reversion, Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Start Timetimetimestamp("2024-01-01 00:00")startTime
End Timetimetimestamp("2024-12-31 23:59")endTime
Ignore WicksboolfalseignoreWicks
Price SourcesourceclosepriceSource
Regression ModestringBothregressionMode
Upper DeviationbooltrueshowUpperChannel
upperDeviationfloat3.0upperDeviation
Lower DeviationbooltrueshowLowerChannel
lowerDeviationfloat3.0lowerDeviation
Breakout Confirmation Barsint1breakoutConfirmation
Lock R Thresholdfloat0.85lockRThreshold
Min Bars Before Lockint5minBarsBeforeLock
Show all 22 settings
SettingTypeDefaultVariable
Max Bars Timeoutint50maxBarsTimeout
Enable StrategybooltrueenableStrategy
Stop Loss (Points)float10.0stopLossPoints
Take Profit (Points)float20.0takeProfitPoints
Uptrend Colorcolor#26a69auptrendColor
Downtrend Colorcolor#ef5350downtrendColor
Fill Transparencyint93fillTransparency
Line Widthint2lineWidth
Show Statistics TableboolfalseshowStatsTable
Table PositionstringTop RighttablePosition
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.

Similar Pine Scripts

330 stars

This strategy divides a fixed price range between an upper and a lower limit into equally spaced grid levels and plots them on the price chart. It marks a buy when price crosses down through a grid and a sell when price crosses up through a grid, using either

Strategy v5 Support & resistanceMean reversion Repaints
Updated 2 months ago · None stated GitHub repository of Grid Bot Simulator [Alorse]

3C QFL Mean Reversal

by hasnocool
106 stars

3C QFL Mean Reversal is a strategy based on the Quickfinger Luc (QFL) trading methodology. It identifies breakdown buying opportunities below established price base levels and enters mean-reversion trades. The strategy includes multi-safety order DCA scaling,

Strategy v5 Mean reversionSupport & resistance Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of 3C QFL Mean Reversal

This strategy builds a spot grid between user-set high and low prices and draws it on the price chart. It splits that range into ten levels and places up to five long limit orders at the lower levels, sizing each from current equity. Orders already below price

Strategy v6 Support & resistanceMean reversion Repaints
Updated 6 weeks ago · None stated GitHub repository of Grid Spot Trading Algorithm [The Quant Science]

FairValueGap E003

by ruckard
13 stars

Calculates the distance between the current price and the opposite end of the latest fair value gap, entering trades on the expectation that price will partially fill the gap. It incorporates risk management with customizable stop loss, take profit based on ri

Strategy v5 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · None stated GitHub repository of FairValueGap E003

Wyckoff Phase

by muammeryldrm42
7 stars

This strategy identifies Wyckoff consolidation ranges directly on the price chart to trade potential spring and upthrust events. It calculates highest highs and lowest lows over a customizable lookback period, filtering setups by average volume spikes and ATR

Strategy v5 SMC / ICT / price actionSupport & resistance
Updated 3 months ago · MIT GitHub repository of Wyckoff Phase

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers