---
title: "Linear Regression Slope: Formula"
description: "The linear regression slope is the per-bar change of the least-squares line fitted to the latest N values. It estimates the average rate of rise or fall in..."
canonical: https://www.getswoopr.com/indicators/statistical-and-quantitative/linear-regression-slope/
source: "Swoopr Investment: https://www.getswoopr.com"
---

## Direct Answer



> Linear Regression Slope is a statistical & quantitative measure used to quantify statistical properties, relationships, normalization, or model residuals. The production page must define the exact calculation convention before interpreting higher or lower readings, because platform and provider implementations can differ.





      


# Linear Regression Slope: Formula, Meaning, Signals, Examples and How to Use It



## How Is Linear Regression Slope Calculated?

The linear regression slope is the per-bar change of the least-squares line fitted to the latest N values. It estimates the average rate of rise or fall in the window in the units of the series per bar.

**Formula:** `slope = (N * sum(x*y) - sum(x) * sum(y)) / (N * sum(x^2) - sum(x)^2), with x = 1..N`

**Inputs:**

- Close prices
- Regression length N

**Worked example.** For prices 10, 11, 13, 12 and 14 on bars 1 to 5, the fitted slope is 0.90 per bar. The inputs are illustrative numbers, not market data.

**Reading it.** Positive values indicate a rising fitted trend and negative values a falling one, with larger magnitude meaning a steeper path. Slope divided by price makes it comparable between instruments.

**Limits.** The raw slope is in price units per bar, so it depends on the price level. It is sensitive to the start and end points of the window and to outliers.


      

## Indicator overview





| Attribute | Value |
| --- | --- |
| Category | Statistical & Quantitative |
| Asset classes | Cross-asset, Portfolios, Pairs, Time series |
| Output type | Line/scalar |
| Parameters | Varies by implementation; document exact settings on use |






## What is Linear Regression Slope?



Linear Regression Slope is a statistical & quantitative measure used to quantify statistical properties, relationships, normalization, or model residuals. The production page must define the exact calculation convention before interpreting higher or lower readings, because platform and provider implementations can differ.



For Swoopr, the canonical profile separates definition, calculation, interpretation and decision use. That keeps readers from collapsing a descriptive metric into a trading strategy. An indicator can describe trend, momentum, volatility, participation, positioning or risk without providing a complete entry, exit, sizing or portfolio decision.




## What does it measure?



Linear Regression Slope measures specific market properties in the Statistical & Quantitative domain. The practical value is repeatability: the same inputs and formula can be applied across a defined dataset, allowing users to compare readings through time or across instruments when the calculation convention is held constant.




## How to read Linear Regression Slope



Interpretation depends on the market property being measured. A descriptive reading is not automatically predictive. The same numerical state can lead to different outcomes in a strong trend, quiet range, event-driven gap or illiquid market. Always combine with context from price structure, volume, and broader market regime before drawing conclusions.




## Strengths



- The slope states the average change per bar in the series' own units, so a reading of 0.5 means half a unit per bar.
- A zero slope identifies a flat fit, so both sign and size are directly readable without further transformation.
- Reproducible when the formula and data convention are fixed.




## Weaknesses and limitations



- Dividing the slope by price gives a percentage rate, but the denominator choice (start, end or mean price) changes the number.
- A straight line through a window with a V or inverted V shape can produce a slope near zero even though the path moved sharply.
- Correlated indicators can create false confidence by repeating the same underlying information.




## Editorial and risk note



This page is educational content, not individualized investment advice. It should not imply guaranteed prediction, accuracy or outperformance. Where multiple valid definitions exist, Swoopr states the alternatives and the reason for selecting its primary convention.







## Frequently Asked Questions


        



Is Linear Regression Slope a buy or sell signal?




No. Positive values indicate a rising fitted trend and negative values a falling one, with larger magnitude meaning a steeper path. The raw slope is in price units per bar, so it depends on the price level. A trade built on it still needs a trigger, an invalidation rule, a position size and realistic execution assumptions.










What is the best setting for Linear Regression Slope?




Linear Regression Slope takes these inputs: close prices; regression length N. There is no universal best setting for the tunable ones, so test them across instruments, regimes and out-of-sample periods and favor stable parameter regions over one historical winner.










Can Linear Regression Slope be used by itself?




The raw slope is in price units per bar, so it depends on the price level. It is sensitive to the start and end points of the window and to outliers. For that reason it is read next to measures of direction, participation, valuation, liquidity and risk, not alone.










Does Linear Regression Slope work on every timeframe?




The calculation (slope = (N * sum(x*y) - sum(x) * sum(y)) / (N * sum(x^2) - sum(x)^2), with x = 1..N) can be run on any bar size, but behavior is not portable: a reading on a five-minute chart describes a very different market window from the same reading on a daily chart. Validate the exact timeframe before relying on it.










Why does Linear Regression Slope give false signals?




Dividing the slope by price gives a percentage rate, but the denominator choice (start, end or mean price) changes the number. A straight line through a window with a V or inverted V shape can produce a slope near zero even though the path moved sharply. Lag, noise and regime changes add to this, because market participants react to new information after the reading is calculated.










How should Linear Regression Slope be backtested?




Rebuild Linear Regression Slope from close prices using point-in-time data, write the rules before testing, include delisted securities where relevant, model realistic fills and costs, reserve a validation sample and compare with a simpler baseline.












S




Swoopr Editorial Team



The Swoopr Editorial Team produces independent investment education, research, and tools for understanding markets, evaluating opportunities, and managing risk. All content is educational only and does not constitute personalized investment advice.



See our [editorial policy](https://www.getswoopr.com/legal/editorial-policy/) and [corrections policy](https://www.getswoopr.com/legal/corrections-policy/).
