Home / Custom Indicators

Custom Indicators

Backtest Report: Stocks Above 5 Day Moving Avg. Indicator

This indicator is very simple. To calculate it, all one needs to do is decide which stocks to include in the universe, and then count the number of stocks trading above the 5 day moving average (5DMA). To be included in my universe, a stock must have a 50 day average volume greater than 100,000 shares and these shares should have averaged greater than $1,000,000 in liquidity.

The rules I have established for this indicator take advantage of mean reversion, meaning it will buy weakness and short strength.


  • Buy signal is generated for the open when the SPX is above its 200dsma and the 5DMA indicator crosses  beneath 700.
  • Sell signal is generated for the open when 5DMA indicator crosses above 2500, or the trade is held for 25 days.
  • Short signal is generated for the open when the SPX is trading beneath its 200dsma and the 5DMA indicator crosses above 2500.
  • Cover signal is generated for the open when the 5DMA indicator crosses beneath 700, or the trade is held 25 days.

To be clear, when there are many stocks trading higher than their 5 day moving average, more than 2500, this indicator will be selling. If there are fewer than 700 trading higher than their 5 day moving averages, then the indicator wants to be buying.

Note that all signals are to be acted on at the next open. The indicator does even better closing trades at the close, but this is unrealistic for me and for many other traders. Therefore, I have chosen to sacrifice performance instead of creating something that can’t be re-created in real life.


All results include .01/share for commissions. The indicator was applied to a variety of ETFs, using all history available for the ETFs.

Note that there are foreign ETFs tested, and that for all of these ETFs, the indicator is using the S&P500’s 200 day moving average. The difference in performance across the ETFs seems to be primarily due to the varying volatility of each ETF, but the short signal does not seem to work as well on the foreign ETFs. This is likely due to the fact that the indicator is using the SPX’s 200 day moving average for short signals. Performance may be improved by using the 200 day average for the ETF being traded rather than that of SPX.

A Look At the Indicator in Action:

As applied to IWM. The red line is the count of stock above the 5DMA. Note that the indicator would be holding an open short position.

Equity Curve for 5DMA Indicator Applied to IWM:


In the markets, complexity is not always necessary. This simple indicator, when combined with simple buy/sell rules and basic risk management (25 day time stop) has beat the markets.

You can track the buy/sell signals for this indicator under the posts titled “Market Dissector.”

Comments »