Linear Regression Slope
Quick Reference
| Property | Value |
|---|---|
| Dimension | regime |
| Category | statistics |
| Version | v1.0 |
| Output Column | trend_slope |
Linear regression slope over a rolling window 鈥?measures trend direction and magnitude
Formula
linear_regression_slope(value, window)
CDM Inputs
| Column | CDM Table | Description |
|---|---|---|
value | cdm_* | CDM source table |
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
window | integer | 3600000 | Window for regression estimation |
Output
Column: trend_slope
Slope coefficient from rolling linear regression
Market Intuition & Trading Rationale
Linear regression slope fits a trend line over a rolling window: linear_regression_slope(value, window). Positive slope = uptrend (value is rising over time). Negative slope = downtrend. Near-zero slope = sideways/ranging. The slope magnitude indicates trend strength 鈥?steeper slopes mean faster price change. This is a more robust trend measure than simple return_momentum because it uses all observations in the window, not just endpoints.
Usage Cases
- Trend direction and strength: Positive + large = strong uptrend (go long). Negative + large = strong downtrend (go short). Near zero = ranging (avoid directional strategies).
- Trend exhaustion: Slope that was large and is declining 鈫?trend is losing momentum. Tighten stops, prepare for reversal or consolidation.
- context: Used in
order_flow_accumulationpack 鈥?slope of cumulative OFI trend confirms whether accumulation is translating into directional price movement.
YAML Definition
name: linear_regression_slope
description: Linear regression slope over a rolling window 鈥?measures trend direction
and magnitude
category: statistics
dimension: regime
version: v0.9.0 (Beta)
required_inputs:
- value
output_column: trend_slope
output_description: Slope coefficient from rolling linear regression
tags:
- regime
- trend
- statistics
parameters:
window:
type: integer
description: Window for regression estimation
required: false
default: 3600000
formula: linear_regression_slope(value, window)