What it is
Linear regression draws the straight line that sits closest to all the recent closes. The slope of that line is a clean, unbiased measure of trend: it uses every candle in the window equally and is not pulled about by the oldest candle dropping out, as a simple average difference can be.
Because it is in points per candle, a slope of +1.5 on 15 minute gold means the fitted line is climbing about 1.5 points each candle.
How it is calculated
1. Take the last 20 closes and number them 1 to 20. 2. Fit the straight line that minimises the squared distance to every close (least squares). 3. The slope = (n x sum of (x times price) minus sum of x times sum of price) / (n x sum of x squared minus (sum of x) squared), where x is the candle number and n is 20. 4. Plot that slope for each candle.
Settings
| Setting | Default | Range | What it changes |
|---|---|---|---|
| Length | 20 | 3 to 400 | How many closes the line is fitted to. Short windows track recent swings; long windows show the bigger trend. |
How to read it
How to trade it
- 1
Use a 1 hour US30 chart with a 20 period slope as the trend filter: longs only above 0.
- 2
Wait for a pullback that leaves the slope positive but falling.
- 3
Enter long when the slope turns up again on a closed candle and price closes above the previous candle's high.
- 4
Stop below the pullback low, for example 60 to 100 points on 1 hour US30.
- 5
Exit if the slope crosses below 0, or at 2 times the stop.
The long is cancelled once the slope closes below 0, which means the fitted trend line over the window now points down.
WickSpeak writes a plain-English reading of the regression slope on the live candle: what it is, how steep the trend is right now, how to trade it and what would prove it wrong. In Playbook, a condition can check when the slope crosses above or below zero, stays above or below zero, or is rising or falling, a simple way to require an up-sloping trend before a play fires.
Best markets and timeframes
Works on every market and timeframe. Most useful on 15 minute to daily charts of gold, US30 and NAS100 as a trend filter.
Common mistakes
- Comparing slope values across markets. It is in points per candle, so gold and US30 have very different scales.
- Using a very short window, which makes it as noisy as price itself.
- Treating a falling slope above 0 as a downtrend. It is still an uptrend, only a gentler one.
Works well with
Questions traders ask
What does the linear regression slope tell you?
It tells you how steeply the best-fit line through recent prices is rising or falling. Positive means up, negative means down, and its size shows how fast.
What is the best period for the regression slope?
20 is a common default. Use 50 or 100 to measure the larger trend, or 10 for short-term swings.
Is the regression slope better than a moving average?
It answers a slightly different question. A moving average tells you the average price; the slope tells you the direction and speed. Many traders use both.
Why does the slope cross zero after price turns?
Because it fits a line through the whole window, older candles keep pulling it the old way until enough new candles agree. It is a confirmation tool, not an early warning.