Ma Crossover
Quick Reference
| Property | Value |
|---|---|
| Dimension | technical |
| Category | technical |
| Version | v0.9.0 (Beta) |
| Output Column | ma_crossover |
MA crossover signal: fast_ma > slow_ma - binary trend signal when faster moving average crosses above/below slower MA
Formula
diff((rolling_mean(price, fast_window) > rolling_mean(price, slow_window)), 1)
CDM Inputs
| Column | CDM Table | Description |
|---|---|---|
price | cdm_* | CDM source table |
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
fast_window | integer [2, 200] | 10 | Fast moving average window |
slow_window | integer [5, 1000] | 50 | Slow moving average window |
Output
Column: ma_crossover
Crossover signal: 1=fast above slow (bullish), 0=fast below slow (bearish)
Market Intuition & Trading Rationale
MA Crossover produces a binary trend signal: diff(fast_ma > slow_ma, 1). When the fast moving average crosses above the slow MA, the signal pulses +1 (bullish crossover / "golden cross" when using 50/200). When it crosses below, -1 (bearish crossover / "death cross"). Most of the time the signal is 0 — crossovers are rare events that mark potential trend changes.
The diff-of-comparison construction is elegant: fast_ma > slow_ma produces a boolean (1 when fast is above, 0 when below), and diff(..., 1) converts level changes into pulses. A transition from 0 to 1 produces +1 (just crossed above). 1 to 0 produces -1 (just crossed below). No change produces 0. This gives you a clean event signal — fire on crossover, stay flat the rest of the time.
The default windows (10/50) capture short-term vs medium-term trend alignment. Smaller windows (5/20) produce more frequent crossovers suitable for intraday trading. Larger windows (50/200) produce the classic "golden cross/death cross" signals used for long-term trend following.
Usage Cases
- Trend following entries: Go long on +1 crossover, go short on -1 crossover. The crossover confirms that the short-term trend has aligned with (or broken away from) the medium-term trend.
- Trend filter for other strategies: Only take long signals from other features when ma_crossover > 0 (fast above slow = uptrend). Only take short signals when ma_crossover < 0. This simple filter eliminates counter-trend trades.
- Regime classification: ma_crossover = 1 means trending up; = -1 means trending down; and the duration since the last crossover tells you how mature the trend is. Recently crossed → early trend (higher potential). Crossed long ago → mature trend (closer to exhaustion).
YAML Definition
name: ma_crossover
description: 'MA crossover signal: fast_ma > slow_ma - binary trend signal when faster
moving average crosses above/below slower MA'
category: technical
version: v0.9.0 (Beta)
dimension: technical
status: Pre-release
required_inputs:
- price
output_column: ma_crossover
output_description: 'Crossover signal: 1=fast above slow (bullish), 0=fast below slow
(bearish)'
parameters:
fast_window:
type: integer
description: Fast moving average window
required: false
default: 10
constraints:
min: 2
max: 200
slow_window:
type: integer
description: Slow moving average window
required: false
default: 50
constraints:
min: 5
max: 1000
formula: diff((rolling_mean(price, fast_window) > rolling_mean(price, slow_window)),
1)