Moving averages, velocity and acceleration
A moving average is more than a line to cross. Its slope is the trend's velocity, and the change in that slope is its acceleration. A long guide to deriving both, normalizing them with ATR, and not fooling yourself with them.
Most people use a moving average as a line: price above it, bullish; price below it, bearish; two of them cross, trade. That throws away most of the information. A moving average is a smoothed version of price, and anything smooth can be differentiated. Its slope tells you how fast the trend is moving. The change in its slope tells you whether the trend is speeding up or running out of steam. That is the same physics as position, velocity and acceleration.
This article builds those ideas step by step: the averages themselves, their lag, the first and second derivatives, how to make them comparable with ATR, and the traps that make derivatives look better in a backtest than they are.
The averages
The simple moving average gives every one of the last n closes the same weight:
SMA(t) = ( C(t) + C(t−1) + … + C(t−n+1) ) / nThe exponential moving average gives the newest close the most weight, and older closes exponentially less:
EMA(t) = EMA(t−1) + α × ( C(t) − EMA(t−1) ), α = 2 / (n + 1)There are others (weighted, Hull, Kaufman's adaptive average), but every one of them trades off the same two things: smoothness and lag.
Lag is the price of smoothness
An average of the last n bars is centered in the past. For an SMA, the center sits (n − 1) / 2 bars behind the current bar, so a 20-bar SMA describes where price was about ten bars ago. An EMA with the same n has about the same average lag, but it reacts sooner to new prices because the newest bars weigh more. There is no free lunch: less lag always means more noise, and more smoothing always means you find out later.
Every moving average answers the question "where was price, on average, a little while ago?" Velocity and acceleration ask "and where is that heading?"
Velocity: the first derivative
In discrete bars, a derivative is a difference. The velocity of the average over k bars is how much it moved in those k bars:
v(t) = MA(t) − MA(t−k)Positive velocity means the average is rising, negative means falling, and the size says how fast. With k = 1 the number is noisy; a k of a few bars is usually more useful.
The problem: v is in price units, so it has the same issue as ATR. A slope of 10 points per bar on NQ and 0.0005 per bar on EUR/USD cannot be compared, and even on one market the same slope means different things in quiet and wild periods. The fix is to measure velocity in ATRs:
v*(t) = ( MA(t) − MA(t−k) ) / ATR(t)Now v* reads as "the average moved 0.8 ATR in the last k bars". That number means the same thing on any market and in any year, and it is the version that is useful in rules.
Acceleration: the second derivative
Acceleration is the change in velocity:
a(t) = v*(t) − v*(t−k)Read the two together and you get four states:
- Velocity up, acceleration up: the uptrend is strengthening.
- Velocity up, acceleration down: still rising, but losing speed. This is often where trends start to tire, before price turns.
- Velocity down, acceleration down: the downtrend is strengthening.
- Velocity down, acceleration up: still falling, but braking.
The interesting part is timing. Acceleration usually crosses zero before velocity does, the same way a car stops accelerating before it stops moving. That makes it an early warning of a change, and also an early source of false alarms.
Every derivative amplifies noise
Differencing is a high-pass filter. It removes the slow part of a series and keeps the fast part, and the fast part of price is mostly noise. A rough way to see it: if the noise in each value is independent with variance σ², the first difference has variance 2σ², and the second difference (coefficients 1, −2, 1) has 6σ². Acceleration is three times noisier than the values it comes from, before you even start.
So derivatives need smoothing twice: once in the average itself, and again on the velocity before you take acceleration from it. In the chart above, velocity is smoothed with a short EMA before acceleration is computed. Without that step, the bottom panel would be almost unreadable.
Ways to use them in rules
- Trend filter: only take longs when v* is above a threshold, such as 0.3 ATR over k bars. This is a slope filter, and it is often more stable than "price above the average".
- Exhaustion filter: avoid new entries in the direction of the trend when acceleration is strongly against it.
- Exit timing: tighten a trailing stop when acceleration turns against the position, instead of waiting for velocity to flip.
- Regime map: classify each bar into the four velocity/acceleration states and measure how your strategy performs in each. Often a strategy works in one or two states and gives back its profit in the others.
Traps that make it look better than it is
- Centered averages. Some charts draw averages centered on the bar, which uses future prices. They look beautifully aligned with turning points, and they cannot be traded.
- Using the forming bar. The velocity of an average that includes the current, unfinished bar will change before the bar closes. Compute everything on closed bars.
- Too many parameters. MA length, k for velocity, smoothing for velocity, k for acceleration, a threshold for each. Five knobs can fit almost anything. Fix most of them with reasonable defaults and test only the ones that matter.
- Ignoring the plateau. If one combination works and its neighbours do not, it is noise. A real effect survives small changes in the settings.
- Forgetting costs. Derivative-based rules tend to trade more often. Include commissions and slippage from the first test.
Putting it together
A clean starting point: an EMA for the trend, velocity in ATRs over a few bars for direction and strength, smoothed velocity for acceleration, and a single question per rule. Is the trend strong enough to join? Is it still strengthening? Then test it on data the rules have never seen, and check that it holds on more than one market. If it only works on one market with one exact set of numbers, it was never about the market. It was about the numbers.
The charts in this article are drawn from simulated prices to show the shapes clearly. None of this is a recommendation for a specific trade or setting; it is a way to think about trend that you can measure and test.
— Alon