Concept
MA Slope Filter
MA Slope Filter is a Trend concept. The Library holds 8 implementations, each one a working definition you can pull into Quant.
Top MA Slope Filter indicators
8 total
What is an MA Slope Filter?
An MA slope filter uses the direction of a moving average itself, rather than price's position relative to it, as the trend condition. The slope is typically measured as the average's value now minus its value some bars ago: positive means the average is rising and long trades are permitted, negative means falling and shorts are permitted. Many versions add a small threshold around zero so a nearly flat average counts as neutral instead of flip-flopping every bar.
Two implementation details do most of the work. First, the choice of average and lookback sets responsiveness: slower averages such as a long SMA change slope direction late but rarely, while low-lag averages such as the HMA turn earlier at the price of occasional overshoot. Second, raw slope is in price units per bar, so it is not comparable across symbols or timeframes; normalizing by ATR or by percentage change makes thresholds portable. Slope 'angle' in degrees is unreliable because it depends on zoom and chart scaling.
The filter matters because it is one of the cheapest usable regime tests: it asks a single question, whether the average itself is heading up or down, and thereby ignores much of the whipsaw that price-versus-average rules suffer in chop, since price can cross a flat average dozens of times while its slope barely moves. It still lags by construction, and every threshold added is another parameter that can be overfit.
How to calculate an MA slope filter
The calculation is a subtraction; the design decisions are the length, the lookback, and what counts as flat.
- 1Compute the moving average whose horizon matches the trend you care about, for example an EMA in the 20 to 50 range for swing trends or the 200 SMA for the major regime.
- 2Measure the slope as the average's value on this bar minus its value n bars back, with n commonly between 1 and 10. The sign gives direction; the magnitude gives steepness.
- 3Normalize the magnitude, dividing by ATR or by the average's own level, if you plan to compare markets or set numeric thresholds. Avoid degree-based angles, which change with zoom and price scale.
- 4Define the states: rising beyond the threshold permits longs, falling beyond it permits shorts, and the flat zone between is treated as no-trend, where the filter blocks entries or cuts size.
How traders use it
- As a directional gate: entry signals are taken only while the slope agrees, a standard way to keep mean-reversion and crossover systems from fighting the prevailing trend.
- As a chop filter: the flat-slope zone defines conditions where no trend-following entries are taken at all, which is where such systems typically bleed.
- As exit logic: a slope rollover on the average that carried the position, from rising to flat or falling, triggers tightening or closing without waiting for a full crossover.
- As the reduction inside a higher-timeframe trend filter or regime label: a higher timeframe's average slope is one of the most common single-value summaries of its trend, and slope frequently colors the average or the bars for an at-a-glance regime display.
MA Slope Filter vs. related concepts
Moving Average Crossovers: A crossover compares two lines (price and an average, or a fast and slow pair) and fires at the crossing. A slope filter interrogates one average about its own direction, which usually means fewer, differently timed state changes.
ROC: The one-bar slope of an n-period simple average equals the n-bar price change divided by n, so the two are close relatives. ROC is the raw price change expressed as a percentage; a slope filter smooths first and reads direction off the smoothed line.
Disparity Index: Disparity measures how far price sits from its average in percent, a stretch reading. Slope measures which way the average itself is heading; price can be far above an average that is still falling, and the two filters disagree exactly there.
Trend Regime Label: The regime label is the output: trending up, trending down, or ranging. A slope filter is one common input that can produce such a label, alongside crossovers, ADX readings, and structure rules.
More MA Slope Filter implementations
Related concepts · MA applications
Concept family
Trend
100 concepts mapped · 88 in the Library
MA Slope Filter FAQ
How do you measure the slope of a moving average?
Subtract the average's value n bars ago from its current value. The sign gives direction, the size gives steepness, and dividing by ATR or by the average's level makes the number comparable across markets. Degree-based angle measurements are best avoided, because the same move produces different angles at different zoom levels and price scales.
What is a good slope threshold for a trend filter?
There is no universal number: the right threshold depends on the average's length, the timeframe, and the instrument's volatility, which is why thresholds are usually set in normalized units such as ATR multiples or percent per bar. Fit it on historical data, then verify out of sample, since a tuned flat zone is an easy thing to overfit.
Is MA slope better than price crossing the MA?
They fail differently. Price-cross rules react faster but whipsaw badly when price oscillates around a flat average; slope rules stay quiet through that chop but turn later at genuine reversals. Many systems combine them, requiring price above a rising average for longs, so each condition covers the other's weakness. Neither is better in all regimes.
Which moving average should a slope filter use?
Smoother averages give cleaner but later slope turns; low-lag averages like the HMA flip earlier and can briefly reverse sign around sharp moves. The 200-day SMA's slope is a widely watched slow regime proxy, while shorter EMAs suit faster horizons. Test a few lengths rather than hunting a single best; the differences are trade-offs, not rankings.
Build MA Slope Filter your way.
Quant writes, tests, and refines it with you — then it runs on LuxAlgo charting or ports to TradingView.
.png&w=3840&q=75)

.png&w=3840&q=75)