In this article, we will analyze the stock market with a focus on the medium to long term, trying to understand how a basket of stocks behaves in response to two key events: the breaking of the highest high and the lowest low of the last six months. Through a quantitative analysis, we will try to answer a fundamental question: how do stocks really react in these situations? Do they tend to continue in the direction of the break or do they follow an opposite logic, reversing the course?
Do you want help improving your trading approach? Click here >>>
Approach used to test strategies on the stock market
To analyze this behavior, we will use a basket made up of Nasdaq shares, one of the most representative stock indices of the American market, which mainly includes technological and innovative companies. The data analyzed will start from 2000. This choice allows us to include periods of particular historical relevance, for example the dot-com bubble, a phenomenon linked to the explosion in the valuations of technology companies in the late 1990s and early 2000s , or 2008, the year of the subprime crisis.
The portfolio, however, is not limited to the stocks currently in the index. We have also included those shares that have been delisted over the years, so as to guarantee a complete view of market behavior. Furthermore, for each operation, a check was carried out to ensure that, on the specific date, the stock was actually part of the index. For example, if the strategy involves an entry signal on a stock like Tesla in 2012, we verify that it was actually included in the index at that time before opening the position. If the action was not part of it, on that specific date, we would not have carried out the operation.
Finally, for academic purposes, we will dedicate a total capital of $1 million to the portfolio, investing $10,000 in each transaction.
Short-term stock trading: strategies on the highs and lows of the last 5 days
The stock market is generally thought to respond well to a mean reverting logic in the short term. This means that, after a marked upward or downward movement, the price tends to reverse direction and return towards average levels. For example, if a stock breaks a significant low, this may be an oversold zone in which to open a long position as a price reversal is expected.
Trend following, however, is the opposite. A reversal is not expected, but the price is assumed to continue in the direction of the initial movement. For example, if the price breaks a high, trend following logic suggests that the bullish movement may continue in that direction.
To verify which of the two logics tends to prevail in the short term, we will test two simple strategies considering a daily time frame:
- Mean Reverting: We will buy at the break of the lowest low among the lows of the last 5 bars (a stock market week) and we will close the position at the break of the highest high among the highs of the last 5 bars.
- Trend Following: We will buy at the break of the highest high among the highs of the last 5 bars and we will close the position at the break of the lowest low among the lows of the last 5 bars.
Short-term results: Trend following and Mean reverting compared
The results of the trend following strategy, which involves buying at the break of the maximum high and selling at the break of the minimum low of the last 5 daily bars, show a rather poor trend. The equity line, visible in Figure 1, is decidedly irregular, with evident drawdown phases. The average trade, shown in Figure 2, stands at a value of around 3 dollars, a result too low for the strategy to be used in live trading, considering operating costs such as slippage and commissions.
The results of the mean reverting strategy, which instead involves buying at the breaking of the low minimum and selling at the breaking of the high maximum of the last 5 daily bars, show a clearly positive trend. The equity line, visible in Figure 3, presents regular and constant growth over time, with limited drawdowns. The average trade, shown in Figure 4, stands at a value of around 53 dollars, a result that definitely represents a good starting point.
These backtests demonstrate that mean reverting logic works remarkably well in the short term. However, now the question to ask is the following: does this logic also remain valid over longer periods?
Long-term stock trading: strategies on the highs and lows of the last 6 months
After having analyzed the mean reverting and trend following strategies on a short-term horizon, let’s now test what happens considering a broader period. To do this, we will use the same operating logic, but applying them to the highs and lows of the last 6 months.
This time, the backtests will be performed on a weekly time frame. The high high and low low will be calculated over the last 26 bars, which correspond to a period of 6 months.
The operating rules remain the same:
- Mean Reverting: We will buy at the break of the lowest low among the lows of the last 26 bars and we will close the position at the break of the highest high among the highs of the last 26 bars.
- Trend Following: We will buy at the break of the highest high among the highs of the last 26 bars and we will close the position at the break of the lowest low among the lows of the last 26 bars.
The objective of these tests is to verify whether the results observed in the short term are also confirmed over a longer period, or whether different market behaviors emerge.
Long-term results: Mean reverting and trend following compared
The results of the mean reverting strategy, applied to a 6-month time horizon with a weekly time frame, show a disappointing equity line. As visible in Figure 5, the trend is irregular, with particularly pronounced drawdowns during recession phases, such as in 2000 and 2008. The average trade, reported in Figure 6, stands at a value of approximately 522 dollars. This value is large enough to cover operational costs such as slippage and commissions, but this mainly comes from the fact that the movements captured are larger.
The results of the trend following strategy, however, show a clear improvement compared to the mean reverting logic. As visible in Figure 7, the equity line presents constant and regular growth over time, with lower drawdowns compared to the previous strategy. The average trade, shown in Figure 8, stands at a value of 1,411 dollars, which represents approximately 14% of the capital dedicated to each operation. This is an excellent result considering the simplicity of the strategy. It is also interesting to note that this value is almost three times higher than that obtained from the mean reverting strategy.
Final considerations on the best equity strategies based on the reference time horizon
The results of these tests clearly highlight how the behavior of the stock market can vary considerably depending on the time horizon considered. In the short term, mean reverting logic seems to work best, probably because many extreme moves tend to correct quickly. However, over longer periods, such as those analyzed in the second part of the study, the trend following logic prevails, probably because markets tend to follow more defined trends, driven by macroeconomic factors.
These results represent an interesting starting point, but the analyzed strategies could be further refined to obtain even better results. For example, for the long-term trend following strategy, you might work to identify an optimal period for calculating high highs and low lows.
Do you want help improving your trading approach? Click here >>>
Until next time,
Andrea Unger