Idea in brief
A simple system on the slope of a moving average reverses the position at every bend in the line. In a range, the average wobbles around one level, and the position flips on almost every bar. On Kevin Davey's diagram, such a stretch gives 14 signals.
The filter from Perry Kaufman's book "Smarter Trading" (p. 151, next to the KAMA code) remembers the value of the average at its last turning point. A buy is allowed only when the average has risen from its last low by more than a threshold. Shorts mirror this: the average must fall from its last high by more than the threshold. On the same diagram, 2 signals remain with the filter.
Davey called the filter a "hidden gem" and tested it on 44 futures markets. On the same webinar, Kaufman added how to set the threshold: one standard deviation of the adaptive average itself over 10–15 days.
Why it might work
A bend in the average during a range says almost nothing about the trend. Price moves within a range, the average oscillates, and every small bend produces a reversal. Individually these trades are small. Davey stresses that people usually do not notice them when looking at a chart, but together they add up to a noticeable loss, and one big trend does not always cover it.
The threshold requires the average to travel a distance larger than normal noise. In a trending stretch, this costs a slightly late entry. In a range, it removes most of the reversals. The exit threshold also tightens by itself: every new local high of the average updates the point from which a downward turn is measured.
Kaufman explains the one-sigma threshold this way: it is enough to remove small oscillations while the system moves sideways. Kaufman also reminds that the adaptive average is designed as a trend system. So Davey's result on the countertrend entry, where the average trade got worse, did not surprise Kaufman.
The video gives no explanation of why the filter removes specifically the worst trades. There is a summary table across 44 markets and one illustrative example on crude oil.
Rules
Base system: slope of the average (Davey)
MAVal = SMA(Close, MALen) // author: Average(Close, MALen); length not named in the test
// without the filter: always in the market, a buy reverses a short and vice versa
IF MAVal > MAVal[1] THEN BUY AT NEXT BAR OPEN
IF MAVal < MAVal[1] THEN SELL SHORT AT NEXT BAR OPEN
Filter from the last turn (author)
// remember the value of the average at the turning point
IF MAVal > MAVal[1] AND MAVal[1] < MAVal[2] THEN ExtLow = MAVal[1] // upward turn
IF MAVal < MAVal[1] AND MAVal[1] > MAVal[2] THEN ExtHigh = MAVal[1] // downward turn
IF MAVal > MAVal[1] AND MAVal - ExtLow > Filter THEN BUY AT NEXT BAR OPEN
IF MAVal < MAVal[1] AND ExtHigh - MAVal > Filter THEN SELL SHORT AT NEXT BAR OPEN
// no separate stop or target: the position lives until a signal in the opposite direction
// Finetiq: until there has been at least one turn, ExtLow and ExtHigh are undefined, so signals are not counted
The Filter threshold
// Davey's variant: an absolute number in price units, chosen by walk-forward, value not shown
Filter = const
// book variant (photo of the page on slide 28): inputs period(10), filter(.1),
// signals on the adaptive average and execution at the bar close (buy on close)
// Kaufman's variant on the webinar (46:00)
Filter = 1 * StdDev(MAVal, 10) // author: sigma of the values of the average itself over 10 or 15 days
// Finetiq: a second reading for testing, sigma of the changes in the average
Filter_alt = StdDev(MAVal - MAVal[1], 10)
Kaufman also describes the threshold as a band above and below the adaptive average. The video does not say how exactly the band combines with the turning point from the code. We take the reading that is compatible with the code: sigma replaces the absolute Filter.
Variant B. The filter on Kaufman's adaptive average
In the book, the filter sits on KAMA, not on a simple average. For trend trading, Kaufman now recommends a period of 60 instead of 10 and a fast smoothing end of 6–8 days instead of 2–3, because markets became noisier after 2000.
ER = |Close - Close[Period]| / Sum(|Close - Close[1]|, Period) // straight-line distance over the sum of steps
Fast = 2 / (FastLen + 1)
Slow = 2 / (SlowLen + 1)
SC = (ER * (Fast - Slow) + Slow) ^ 2
AMA = AMA[1] + SC * (Close - AMA[1])
// author: Period = 60, FastLen = 6..8 (webinar); SlowLen = 30 (Davey's code and the caption of Kaufman's chart)
// then the same filter: MAVal = AMA, Filter = StdDev(AMA, 10..15)
Where to apply it (Davey)
The filter was tested on a trend entry: buying while the average is rising. On the countertrend entry (buying while the average is falling), it reduced the number of trades and the total loss, but the average trade got worse. Davey concludes that the filter suits trend systems, while for mean reversion systems it has to be tested separately.
Parameters
| Parameter | Value | Source |
|---|---|---|
| Base system average | simple, Average(Close, MALen) |
author |
| MALen | 50 | Finetiq: this is what Davey's diagram shows, the length is not named in the test |
| Filter, Davey's variant | absolute, chosen by walk-forward | author (value not shown) |
| Filter, book variant | 0.1 with period 10 | author (slide 28) |
| Filter, Kaufman's variant | 1 σ of the values of the average | author |
| Sigma window | 10 or 15 bars | author |
| Sigma of the changes in the average | for testing | Finetiq |
| Execution | open of the next bar | author (Davey's code), at the bar close in the book |
| Bar sizes in the test | 180–1440 minutes | author |
| Test period | 2007–2025, runs with fewer than 50 trades discarded | author |
| Stop and target | none, reversal on the opposite signal | author |
| Variant B: KAMA | period 60, fast end 6–8, slow 30 | author |
What to test
- Off versus on. Run the base system without the filter and with it on the same set of markets and timeframes. Compare the number of trades, the average trade and the net result. This is how Davey read the test: the base system can lose money, what matters is the shift.
- Which threshold. An absolute threshold, 1 σ of the values of the average over 10 and over 15 bars, 1 σ of the changes in the average. An absolute threshold cannot be carried over between markets and decades, while sigma adjusts to current noise by itself.
- Parameter neighborhood. Sigma multiplier 0.5, 1 and 1.5, average length 40, 50 and 60. If the improvement holds only at one point, the threshold is overfitted.
- Trend versus countertrend entry. Repeat Davey's experiment: the same filter on buying while the average rises and on buying while it falls. According to Davey's data, the average trade gets worse on the countertrend entry. If you see the same, the filter should not be put on top of mean reversion systems.
- Kaufman's advice on market selection. Split markets by the efficiency ratio of daily bars into the upper and lower half. Compare the effect of the filter in each. Kaufman claims that on trending markets the base system will not lose money, but this was not tested in the video.
- SMA versus KAMA. The same filter on a simple average and on KAMA with settings 60, 6–8, 30. Kaufman tested the filter specifically on the adaptive average.
- Savings on costs. Without the filter, the base system reverses often in a range. Run both variants with commission and slippage and see what part of the improvement comes from fewer trades and what part from selection.
Platform notes
TradingView (Pine Script)
ta.stdevis the population version by default (biased = true), likeStdDevin EasyLanguage. Nothing needs changing for sigma to match EasyLanguage.- There is no built-in KAMA, so it is written from the formula. Check that the ER period and the fast and slow EMA lengths match the source: indicator authors in the library sometimes use different settings.
strategy.entryin the opposite direction reverses the position. A repeated signal in the same direction is ignored withoutpyramiding, which matches the logic of Davey's code.- An absolute threshold depends on the series. For continuous futures, check whether back-adjustment of rollovers is enabled, otherwise the distance from the turning point will be distorted at contract joins.
MultiCharts and TradeStation (EasyLanguage)
- The code from the slides is written for TradeStation and carries over as is:
Average,buy next bar at market,sellshort next bar at market. - Davey specifically stressed that the 1440-minute bars in the test are not daily bars. For futures in TradeStation, the daily bar closes at settlement, while the 1440-minute bar closes at the last trade. Signals will differ, so test and trade on the same bar type.
StdDevis the population version,StdDevSthe sample version. On a window of 10, the sample sigma is about 5% larger, and the threshold shifts with it.- In the book, signals are executed at the close of the same bar (
buy on close). In a backtest this is more optimistic than entering on the next bar, as in Davey's test.
MetaTrader 5 (MQL5)
- The built-in
iAMAtakes the ER period and the fast and slow periods. For variant B, set 60, 6–8 and 30, and check the line against the formula on a few bars. - Calculate the sigma of the average yourself from the array of its values.
iStdDevby default measures the dispersion of price, not of the average. - The 3-hour timeframe (H3) exists in MT5, but bars are built on the broker's server time. Their boundaries will not match 180-minute futures bars in TradeStation.
- CFDs on commodities and indices differ from futures in price and trading hours. The absolute threshold from Davey's test does not carry over to them. Take the signal from the closed bar (index 1) and check for a new bar.
Where the idea can break
- In Davey's test, the base system loses money in total across 44 markets both with and without the filter. The filter reduced the loss but did not make the system profitable. Davey says directly that this is not a strategy to trade.
- In the summary test, the threshold was chosen by walk-forward, and its values are not shown. The link between Davey's absolute threshold and Kaufman's sigma was not tested in the video. Before talking about the sigma of the average, Kaufman misspeaks twice, naming first the efficiency and then the smoothing constant.
- Davey says the filter removed 58% of trades, and a bit earlier says "about half". According to the table on the slide, 416 of 1115 trades remained, which means 62.7% were removed.
- There is one crude oil example, and it was chosen for the demonstration. According to the reports on the slide, with the filter the profit grew almost equally on longs and on shorts (from $23,775 to $56,280 and from $59,920 to $91,030). Only the shorts raised their win rate, and for longs it fell slightly: 39.31% without the filter and 38.46% with it.
- The length of the average in the test is not named. MA(50) on the diagram is an illustration, not a test parameter.
- On the countertrend entry, the filter made the average trade worse. It should not be put on top of mean reversion systems without testing.
- The webinar serves as a warm-up before a paid masterclass. The ranking of markets by efficiency ratio that Kaufman refers to is not shown in the video.