What the strategy is trying to do
This is an open-source script published by chanu_lev10k, titled “Linear Regression Channel Breakout Strategy.” The header credits both LonesomeTheBlue and chanu_lev10k, so the channel drawing follows LonesomeTheBlue's linear-regression channel, with entries and percentage exits added by the publisher. It fits a regression line over a recent window, builds upper and lower bands from a deviation multiple, and trades a close through those bands. The author's chart is BYBIT:BTCUSD.P on the 8-hour timeframe, so this entry is filed under BTC. The script does not hard-code a symbol and will load on other charts, but the guide and the image follow that publication chart.
The strategy declaration only sets overlay=true. It does not set position size or commission, so Pine's defaults apply: a fixed quantity of 1. On a bitcoin perpetual, one unit can be a large notional, so set size and fees in the strategy properties before you read the tester.

How the indicators are calculated
- Channel length defaults to 20, and Source defaults to the close.
- The mid-line uses the mean of Source over the window. Slope is ta.linreg(src, len, 0) minus ta.linreg(src, len, 1). The intercept and the far end of the line are derived from that slope and the window length. dev is the root-mean-square of each point's distance to that line.
- The bands are the far-end price y2_ plus or minus dev × Deviation. Deviation defaults to 2.3.
- The script also draws the three channel lines, colors them by the sign of the slope, and can add Fibonacci levels or keep a broken channel as a dotted leftover. Those are display only and do not drive orders.
- longCondition is written as “slope down and close above the upper band, or slope up and close above the upper band.” The close test is the same in both branches, so a long fires whenever the close is above the upper band; slope does not filter direction. Shorts are the same: a close below the lower band is enough.
Entry rules
- Long (order name Long): the close is above the upper band y2_ + dev × Deviation.
- Short (order name Short): the close is below the lower band y2_ − dev × Deviation.
- The source does not require a flat book, and it does not set pyramiding, so Pine's default is no add-on in the same direction. An opposite entry usually flattens the current trade and reverses. What actually fills still depends on your order settings.
- The source does not wait for barstate.isconfirmed. On an 8-hour chart, whether the close has cleared a band can still change before the bar ends.
Exits and position size
- Take-profit is on by default; the stop is off. The take-profit is Take Profit % (default 11%) away from the average entry, and the stop is Stop Loss % (default 10%) the other way, but only if that switch is enabled.
- Long and short exits are separate strategy.exit orders, named Long/Short Take Profit and Long/Short Stop Loss. They are placed only when the matching switch is on.
- There is no separate close when price breaks back through the channel. An opposite signal is handled by an opposite entry, not by a standalone close.
- Size defaults to one unit, not a fraction of equity. Set the quantity and commission in the properties before you run it on a bitcoin perpetual.
Inputs (source defaults)
| Input | Default | Role |
|---|---|---|
| Source | close | Price used to fit the regression channel. |
| Length | 20 | Lookback for the regression, minimum 10. |
| Deviation | 2.3 | Width of the upper and lower bands around the mid-line. |
| Extend Lines | true | Extends the channel to the right; display only. |
| Show Fibonacci Levels | false | Draws Fibonacci levels inside the channel; display only. |
| Show Broken Channel | true | Keeps the old lines after the channel is broken the other way. |
| Enable Stop Loss | false | Places a percentage stop from the average entry. |
| Enable Take Profit | true | Places a percentage take-profit from the average entry. |
| Stop Loss % | 10.0 | Stop distance, used only if the stop is enabled. |
| Take Profit % | 11.0 | Take-profit distance, on by default. |
Things to know before using it
- Entries do not depend on the slope. The source writes both slope cases into the condition, but they collapse to whether the close has cleared the upper or lower band.
- There is no stop by default, only an 11% take-profit. A breakout that reverses without reaching that target can stay open until an opposite entry flips the position.
- The default size is one unit, and no commission is set. On a chart such as BYBIT:BTCUSD.P, change both before you trade or test.
- The channel, Fibonacci lines, and direction labels are display only. Some comments are in Korean; that does not change the logic as written.
- The header keeps copyright notices for both LonesomeTheBlue and chanu_lev10k; keep both if you redistribute the file.
Installing it on TradingView
- Download the .pine file from Coinpred (active membership required, see below), or check the original page for a newer version.
- Open the Pine Editor, create a blank script, paste the full source, and save.
- Click Add to chart. To match the author image, start with BYBIT:BTCUSD.P on the 8-hour timeframe.
- Set the quantity and commission in the strategy properties, review the stop and take-profit switches, then inspect fills in the Strategy Tester.
- Past tester results do not guarantee future returns.
About backtest figures
Source, license and version
- Source: https://www.tradingview.com/script/7USLDe0j/
- Author: chanu_lev10k (the source header also names LonesomeTheBlue). Source version 3.0 (Pine v5), scriptAccess=open_no_auth.
- License: Mozilla Public License 2.0. Redistribution must keep the copyright and license notices; modified files must remain under MPL 2.0. Coinpred ships the unmodified full source.
- Members can download the .pine file on this page to study the rules. Judge the risk yourself, and follow your venue's rules.



