Skip to main content

Moving Average Trend Slope

Quick Reference

PropertyValue
Dimensionregime
Categorymomentum
Versionv0.9.0 (Beta)
Output Columntrend_slope

Moving average trend slope - captures directional drift in equilibrium price using regression slope of moving average

Formula

linear_regression_slope(rolling_mean(price, ma_window), slope_window)

CDM Inputs

ColumnCDM TableDescription
pricecdm_*CDM source table

Parameters

ParameterTypeDefaultDescription
ma_windowinteger [5, 1000]100Window for moving average calculation
slope_windowinteger [2, 100]20Window for slope estimation on the moving average

Output

Column: trend_slope

Estimated slope of the moving average trend line

Market Intuition & Trading Rationale

MA trend slope measures the directional drift of the smoothed price: linear_regression_slope(rolling_mean(price, ma_window), slope_window). The double smoothing (MA first, then regression slope) produces an exceptionally stable trend estimate. The MA removes microstructure noise; the regression slope captures the underlying drift. This is slower to react than raw momentum but produces far fewer false signals.

Usage Cases

  • Slow trend following: Positive slope → long, negative → short. The double smoothing makes this suitable for position-sized trades where false signals are costly. Reversals are infrequent but high-conviction.
  • Trend maturity assessment: Slope that was positive and is flattening → uptrend is maturing (reduce size). Slope crossing from positive to negative → trend reversal (exit long, consider short).
  • Regime baseline: Use ma_trend_slope as the "slow" trend signal in a multi-timescale trend system. Pair with faster signals (return_momentum, rate_of_change) for entry timing.

YAML Definition

name: moving_average_trend_slope
description: Moving average trend slope - captures directional drift in equilibrium
price using regression slope of moving average
category: momentum
version: v0.9.0 (Beta)
dimension: regime
status: Pre-release
required_inputs:
- price
output_column: trend_slope
output_description: Estimated slope of the moving average trend line
parameters:
ma_window:
type: integer
description: Window for moving average calculation
required: false
default: 100
constraints:
min: 5
max: 1000
slope_window:
type: integer
description: Window for slope estimation on the moving average
required: false
default: 20
constraints:
min: 2
max: 100
formula: linear_regression_slope(rolling_mean(price, ma_window), slope_window)