I collect stuff. All kinds of stuff, including old, used, and useless/worn-out trading systems. I have dozens of them, and like most collectors, I rummage around in my trading system collection every couple of months to see if there might be an overlooked treasure hiding there. Last month I decided to revisit a system called the AggM.

The AggM trading system was invented by prolific indicator creator David Varadi, and first appeared around 2009. I did many trials of this system back around 2012, added to those in 2018, and re-evaluated the system performance yet again in July.

**Here’s** a link to the original discussion of the AggM by its creator.

For those readers that are less interested in mechanical trading systems, I hope that this study will still provide a view into how I find, backtest, and improve any trading system. There’s thousands of trading systems out there; some discretionary, some mechanical, some chart based, but the majority sound better than they actually perform. Finding real edges in trading isn’t easy. I encourage rigorous analysis of any system you propose to follow. It’s all too easy to overlook some aspect of the system that produces poor performance. As an example, moving average crossover systems seem particularly prone to ignoring minor touches that are actually major whipsaws, but people continue to post them as if they have wonderful performance.

Getting back to the AggM system; it has intrigued me since I first saw it described, more than 12 years ago. To my knowledge it has no followers – there were a few comments on the introductory page, and a few references on other websites, but that was it. Score a plus for disinterest. But the biggest point in its favor was my noting that one variation of this system that I tested had a single day return of 10% in 2008. It was in cash (a sell signal) for weeks, bought the afternoon before a big rally, then sold at the end of the day. Amazing performance: a perfect detection of a heavily oversold condition with a perfect entry and exit. However – the system has also annoyed me since I first came across the write-up; it has so much promise, the reported results were outstanding, but I have yet to crack the secret to harnessing its potentially good performance in a consistent fashion.

AggM is an Excel based market timing system that combines trend and mean reversion signals to decide whether to be in or out of the market. It compares today’s closing price to prior HLC (high, low, and close; the open is ignored) prices over two time periods; one long term, several months, and one short term, a few days. The long term comparison is effectively determining if the market is trending up or down, while the short term comparison can be thought of as the mean reversion component, determining if the market is moving away from or closer to the longer term trend. (Moving closer to the trend implies the stock is mean reverting.)

The Excel function of Percentrank is key to the system’s operation: it generates a number that represents what percentile the last day’s closing price is relative to the previous HLC prices. If the output is 0.5 (50th percentile) then the current closing price is just at the median level of the total range of prices over the time period, whether it’s the long period or the short period. Mr Varadi chose the median (to repeat, median is the level where half are higher and half are lower) likely because averages can be skewed by a few extreme values, giving you a false impression of strength or weakness.

Varadi chose defaults of 252 for the trend lookback period, and 10 days for the mean reversion lookback. He acknowledged these as rough starting points and they might not be optimum. More on that later.

In practice, a stock that is above the median of the HLC prices over the last 252 days is probably trending up, while a price that is lower than the median over the last 10 days is probably going down, ie mean reverting. The opposite conditions for both trend (below the median of 252 days) and mean reversion (above the median of 10 days) is also true. As a guess, the system might work best in strongly trending markets with regular pullbacks.

The AggM averages the trend and the negative of the mean reversion percentranks, and then applies a two day EMA to that result. If that calculation is over 0.5, the system is in a buy; under 0.5 is a sell. Note there are many variables – two lookback periods, the percentrank for each, the averaging, the EMA (or SMA) period, and finally the threshold for buy/sell. We can easily curve fit this system to any market, or spend many hours chasing our tail and getting completely confused.

Let’s look at a snippet of Excel to see how I test this system. This is actually a fairly trivial Excel spreadsheet, and very easy to implement.

This screenshot shows the standard SPY data (from Yahoo Finance) on the left in columns A through G, SPY equity for buy and hold in H and I, and then the various columns for the AggM system calculations: the long term trend in column L, the short term mean reversion calculation in column M, the arithmetic for subtracting short term from long term, averaging it, and smoothing it in N, O, and P. Column Q is the output (1 is buy and 0 is sell), and finally the system’s equity and performance is in R through Y.

Here is a screenshot showing the percentrank formula for the 252 day long term calculation. Note it uses columns C to E – the daily High, Low, and Close prices for SPY, and compares them to cell E2, which is the current closing price. Open and dividend adjusted prices are ignored. (I’ve tried using dividend adjustments, but it makes the system very complex.) Column M is calculated similarly, but uses only the past 10 days of data. Both 252 and 10 day calculations include today’s data, so if you try to follow this system, you will run the spreadsheet at 3:50 PM and assume the close doesn’t change by too much.

Finally, here is the equity curve for the AggM system, shown in red, while the buy and hold equity is in blue. Performance is highly variable over the span of 31 years of SPY data, ranging from quite good to miserable.

If I make a great big deal out of the system equity curve, it’s because in my opinion this is the single most important bit of data regarding any trading system. How smooth is it? How big are the drawdowns? How often does it switch between buy and sell? How long are flat periods? Can you actually trade this system, and live with the result? A system that does 100 trades over 5 years but goes nowhere during that time, then does one huge 100% winner, is probably not a system that any reasonable person could live with. . Academic papers are notorious for providing only conclusions, not equity curves. It’s as if the authors never actually traded the systems they write about…

Here is a summary of the performance of this system. Really good overall from 1993, but not so hot from 2010, after the 2008-2009 bear market. Something about the market changed, and the system didn’t keep up.

When I first tested this system, around 2012, I ran many dozens of variations of the 252 day trend, ranging from 100 to 400 days, and the 10 day mean reversion, ranging from 5 to 50 days. The default selections of 252 days and 10 days, seem to be as good as any, but none of the combinations was consistently outstanding. In previous systems I’ve worked with – my long term and volatility systems – running a number of sets of parameters and voting for the buy/sell signal worked well. Voting here would use the best individual systems, say 200/5, 150/10, 300/12, and so on, and let the majority decide. Performance with voting was awful. It just didn’t help. Why? I’ll guess the market jumps between regimes of varying trend and reversion parameters, but there’s no consistent or dominant trend or reversion time periods.

There is yet another issue with this system that I haven’t mentioned; the 252/10 day combo generated 369 switches. More than 180 round trips over 30 years, or about 2 complete buys and sells every month. That’s a lot for a system with marginal performance, and the real world performance will be even worse if bid-ask spreads are included.

And one more thing to note: to my knowledge there is no equivalent method of using technical analysis in place of Excel – even though only price is used in the calculations, there’s no easy way to include the averaging and EMA in a graphic format. Sure, the trending and mean reversion parts seem straightforward, but past that I don’t see a solution. I welcome reader’s input into a chart based interpretation, as that might provide additional views into why this system is so sporadic.

And that where I have stopped the trials, at basically the same point in 2012, 2018, and 2022. Hundreds of hours with little to show for that effort. Why repeat work on a system that I haven’t been able to get to work, not just once, but three times? There are a couple of good reasons.

1) All of the work since 2009 is out of sample, meaning no one could claim this system is just an artifact of the data.

2) The system may be the same, but I’m not. I have more than 12 additional years of learning, testing, and trying different things since 2010, knowledge that is invaluable to diagnosing issues and finding solutions. So what are potential solutions to the poor consistency? We will need to identify which regime the market is in, and use that data to pick and choose the optimum trend/mean reversion parameters. That’s not a trivial exercise.

This is where things stand as I write; here’s a system that appears to have good potential but is difficult to adapt to the market, while I try very hard to squeeze in another hundred hours of playing around to get to a proof of concept stage. If it looks promising, an addition few hundred hours might be necessary, and will be easily justified. But after the first hundred hours, if there’s still no progress, I’ll give up, sunk costs notwithstanding, and move on to some other antique system. And maybe one of the readers will be able to make headway where I couldn’t.

“If at first you don’t succeed, try, try again. Then quit. No use being a damn fool about it.”

W.C. Fields