Linear Regression Slope in Crypto: Why the Value Changes Before Candle Close
The linear regression slope fits a straight line through the last N closes. The live bar is the end point of that line, which gives it outsized leverage on the slope.
Short answer
The slope of a least-squares line through N closes weights points by their distance from the centre of the window, so the newest and oldest bars have the most influence. For N = 20, the live bar's weight on the slope is (x − x̄) ÷ Σ(x − x̄)² = 9.5 ÷ 665 ≈ 0.0143 per $1, so a $500 intrabar swing changes the slope by about $7.1 per bar. Sign changes in the slope can appear and vanish mid-bar. Use closed values.
Which part of Linear Regression Slope uses the live bar
| Component | Uses current bar? | Effect intrabar |
|---|---|---|
| Oldest and newest bars | Live bar is newest | Largest leverage |
| Middle bars | No | Little leverage |
| Slope sign | Yes | Can flip intrabar |
Worked for N = 20: x̄ = 9.5, Σ(x − x̄)² = 665, and the newest bar's coefficient is 9.5/665 ≈ 0.0143.
Review Linear Regression Slope in Crypto with bar replay before using it live.
Open ChartsPod replayHow much it moves inside one bar
Rules
Related: Linear Regression Channel in Crypto: Why the Value Changes Before Candle Close (regression channel).
Put Linear Regression Slope in Crypto next to price, flow and positioning in one workspace.
Open a ChartsPod workspaceQuestions readers ask
Why does the regression slope change so much intrabar?
The newest point has the most leverage on the line.
Can the slope sign flip mid-bar?
Yes.
Closed bars?
Yes.
Sources and methodology
Indicator formulas are standard definitions; live-versus-closed behaviour follows TradingView's repainting documentation. Values in examples are illustrative.
- TradingView Pine Script: Repainting — live vs historical calculation.
- ChartsPod indicator reference — indicator calculations.
This article explains research tools and workflows. It is not financial advice, does not recommend buying or selling any asset and does not predict prices. Crypto derivatives carry a risk of rapid and total loss of margin.
CHARTSPOD EDITORIAL EDITION · RESEARCH AND EDUCATION ONLY · NOT FINANCIAL ADVICE.