April 6, 2024

Way back in the day, on **Wealth-Lab** (circa 2004), there was a **MoonPhaser** trading script. The general idea was simple: you bought shares on the full moon and sold them on the new moon. The program has been free and operational since then, and contrary to popular belief, it did not break down over time. It still makes money and outperforms SPY, even after what should be considered a 20-year walk forward on market data it has never been aware of since its development stage 20 years ago.

Price market data was not considered in its design. The trade-triggering mechanics were unrelated to market prices, whether past or future market data. All it cared about was the phase of the moon. No one makes a 20-year walk forward due to changing market conditions and the total waste of time it would represent. But here, the trading procedure is outside market conditions and could last centuries should there still be a market to trade in by then.

The *MoonPhaser* strategy should continue to make money. The question is not whether it makes any money but how much based on the trading methods used. I found the code determining the full and new moon dates elaborate and fascinating.

The moon has been around for eons, exerting its gravitational pull on the planet. Even if we do not feel its influence physically, we can see it in the tides. And we still like walking in the moonlight. The only thing that could influence the planet or humans is its gravity. It is not because, at times, we do not see all the moon that it is not there. The whole thing about moon phases having some impact on the stock market is practically nonsensical. You could adopt an 11-day-on/10-day-off long-term scenario, starting on any day of the week, and get about the same result.

Your astronomical beliefs are of little consequence in playing the stock market, but your participation in the game will have some impact on your trading account, whether you are right or wrong.

In my last article, **Anticipating A Stock Portfolio's Long-Term Outcome**, was given the following equation: ½ Ʃ (H_{d,j} ∙ Δ_{i}P_{d,j}) ≈ ½ Ʃ (H_{QQQ} ∙ ΔP_{QQQ}), which technically stated that if your trading strategy has a 50% market exposure, you should reap 50% less in profits or losses. Understandable. Using the 100 QQQ stocks and rebalancing weekly maintained near 100% exposure. Therefore, we should get about the same return as having bought QQQ and held for the duration. Refer to prior articles that also demonstrated this.

In the case of the *MoonPhaser* program, we are in the market only half the time as if only half of our capital is at work, and therefore, we should expect half the performance. We have 12 full moons a year. If we traded the 100 stocks from SPY, S&P 100, NASDAQ 100, or QQQ, we would buy on the full moon and resell later on the new moon. Then, we would wait for the next full moon to take new positions. We should expect to execute 12 ∙ 100 ∙ 20 = 24,000 trades over those 20 years, each lasting a little over two weeks (~10.5 trading days) followed by a 2-week break. However, we will get more trades due to the replacement of stocks dropping out. Some stocks also linger for several weeks before being delisted after merger and acquisition announcements.

The average price move over short intervals (such as two weeks) is usually relatively low. On average, we have 21 trading days per month (252 / 12 = 21). We should expect, on average, price moves of about 0.1 / 252 = 0.03968% per day and 0.1 / 252 ∙ 21 = 0.83333% per month. Half that if we are in the market for only 10 to 11 days per month (½ ∙ 0.1 / 252 ∙ 21 = 0.41666%).

However, we will also have price gaps and momentum plays to account for, producing higher price variations in some stocks. 24,000 trades with a low average profit per trade can still amount to something. Whatever the average profit per trade, it will be multiplied by 24,000+ or about.

Since the portfolio will be growing, positions will also increase with time. We can resume the outcome of the payoff matrix as Ʃ^{N} (**H** ∙ Δ**P**) = F_{0} ∙ [(1 + g_{avg})^{t} - 1] = N ∙ x_{avg}, where *N *is a monotonic function increasing by 100 or so every month, and x_{avg} is the evolving average profit or loss per trade. In this case, the average position size will increase with the portfolio's increasing value.

Take the program as is on Wealth-Lab. Simulate with the S&P100 dataset, which includes delisted stocks. Put 1% on each stock every full moon and close all positions on the new moon. The program will act as if rebalancing every month, holding its positions for two weeks and then having a two-week break before the next rebalancing.

The result of such a 20-year simulation on the *MoonPhaser* should be similar to the following equity curve:

**Fig. 1 ─ MoonPhaser ─ Equity Curve with SPY As Benchmark**

The portfolio metrics for the above chart were:**Fig. 2 ─ SPY 100 vs SPY ─ MoonPhaser**

From the above chart, we have a 48.8% exposure, as should be expected, and an APR of 8.01%. Interestingly enough, the overall return is about the same as holding SPY for the duration, making the strategy a better risk-adjusted scenario than owning SPY, all with a lower drawdown, as seen in the following chart.

**Fig. 3 ─ SPY 100 vs SPY ─ MoonPhaser ─ Other Metrics**

You were better off using the *MoonPhaser* for its risk-adjusted basis: less market risks, less exposure, and a lower drawdown. And a 57.54% hit rate, not due to any forecasting but simply exploiting and mimicking the vagueries of a long-term evolving trend. There are more up days than down days.

We expected 24,000 trades and got 24,678. During the simulation, 180 symbols were used, with some lingering after acquisition or merger declarations. At the limit, it was at most 2.8% above the estimate. The average profit per trade was 0.69% for an average profit of x_{avg} = $14.84.

Trades lasted, on average, 10.13 days for winning positions and 10.15 days for losing positions. The trade duration estimate was 10.5 days. Since the general market trend has been up over those 20 years, we find a 57.54% hit rate for positive trades and a 42.46% for losing trades, all within the variance we should have expected.

However, the picture will change if you change the benchmark from SPY to QQQ.**Fig. 4 ─ MoonPhaser ─ Equity Curve with QQQ As Benchmark**

When considering the *MoonPhaser*, going for QQQ would still have been a better choice. You knew beforehand what would happen. So you could have made reasonable estimates and taken appropriate action. However, the above chart says that the *MoonPhaser* was not enough and that you could have done better.

The *MoonPhaser* has close to a 50% market exposure. The light green area between dark green strips shows those 2-week periods in cash. One thing to do is take positions from the new to the full moon, increasing exposure to nearly 100%. That is easy to do. A single line of code to buy on the new moon after the sell will do it. This move should increase overall returns and render the strategy as if holding for the duration, thereby almost eradicating the premise for the need for a *MoonPhaser* program even though the strategy could profit for years.

**Fig. 5 ─ MoonPhaser ─ Both Phases Equity Curve**

The above chart shows an increase in performance, an exposure of 98.07%, and a growth rate (APR) of 10.78%. Notice that after 2012, the curves start diverging, and this divergence increases as the years go by. The divergence comes from not being fully invested (see light green at the bottom of the chart) and not using 100% of available capital.

If you compare performance to holding SPY instead of QQQ, you will see that the full-phase *MoonPhaser *outperforms SPY, as should be expected. The divergence increases with time, again showing that you were better off buying the QQQ ETF and holding.

**Fig. 6 ─ MoonPhaser ─ Both Phases Equity Curve with SPY As Benchmark**

The above exercise demonstrates that you could have used any other day relative to the moon phase and get similar results since you would have been nearing fully invested for those 20 years. Switching to another day would still have had around 98% exposure, revealing that it was not your timing that mattered but your participation in the game. You can make or lose money at this game only if you participate.

The conclusion to this is simple. There is no reason to play the *MoonPhaser* strategy and spend time monitoring the program every moon phase when you have other simple solutions that, with ease, will outperform with practically no work. Once again, this shows that buying QQQ and holding for the duration is a reasonable scenario for the do-it-yourself individual. Moreover, you could build your self-managed retirement fund using QQQ as your preferred ETF. Add more QQQ shares whenever you want over the years. You would still outperform market average proxies like SPY and most money managers.

**One More Thing**

The *MoonPhaser* program has all its trading rules preset. In the future, it will buy on a full moon and resell on the new moon, as it did before. We can estimate where it is going, just as we could have 20 years ago.

We could have used more capital, but in this example, we started with an initial stake of $100,000 on 100 stocks using an equal-weight allocation, making each starting position $1,000. Trading for 20 years gives (252 ∙ 20 = 5,040) trading days. The portfolio can only grow during the weeks when it is holding positions. It has 12 holding periods of 2 weeks each, giving it a potential 50% exposure by construction. The growth rate during those periods should average about 0.3846% based on an average 10% annual growth rate. The portfolio should grow to: F(t) = F_{0} ∙ (1 + 0.3846)^{20} = $672,750.

Raising the annual growth rate by half a percent to 10.5% would generate F(t) = F_{0} ∙ (1 + 0.4038)^{20} = $736,623, which is similar to the outcome in *Figures *#5 and #6.

We have a program frozen in time some 20 years ago, and it is still standing. It is a simple program. It did not break down over those 20 years as many would have expected. You can make those projections on the premise that the average market trend will continue over the next few decades. You can make a 20-year extrapolation and be relatively close to the outcome.

Here is another interesting chart extracted from one of the simulations.

**Fig. 7 ─ MoonPhaser ─ Position Size & Percent Profit**

The above chart shows AAPL's position size from 2007 to 2024 and its percent profit for each trade (209) for one of the simulations. I only did one of those charts since it already had the answers I wanted, and other charts would have naturally given similar results, all with their respective regression lines.

The upward linear regression in the above chart has an R^{2 }of 0.9385, which is a reasonable fit. Since all positions taken represent 1% of the total, multiplying a position size by 100 gives the portfolio's value. Each stock's position size is representative of the whole portfolio by construction. You know the position size of any of the stocks at any purchasing time (1%); it is enough to determine the liquidation value of the entire portfolio.

The other interesting point is that the percent profit per trade is somewhat erratic, if not quasi-random-like. Its regression line has an R^{2 }of 6E-05, practically zero, showing no correlation in the data series. Yet, during that period, AAPL went from $4.33 to $170.39. Its stock price had a 24.38% growth rate. And yet, it barely shows on the chart. It accounted for roughly 1% of the total portfolio.

Back to the x_{avg} thing.

The payoff matrix was expressed as Ʃ^{N} (**H** ∙ Δ**P**) = F_{0} ∙ [(1 + g_{avg})^{t} - 1] = N ∙ x_{avg}. Now, we can express x_{avg} in other terms. Ʃ^{N} x_{i} = Ʃ^{N} (ps_{i} ∙ r_{i}) where (ps_{i}) is the position size of trade *i* and r_{i} is the percent profit or loss on trade *i*. From the above chart, we have the average profit r_{i_avg} tends to a constant r_{i_avg} → 1.16%, and therefore, we could say: Ʃ^{N} x_{i} = 0.0116 ∙ Ʃ^{N} ps_{i}, leaving to the position size and the number of trades the burden of lifting the portfolio value. There is just so much that the market can offer over two-week periods.

Making the position size a constant, say $1,000, would reduce the portfolio's outcome since x_{avg} would entirely depend on the number of trades taken *N*: Ʃ^{N} x_{i} = Ʃ^{N} $1,000_{i} ∙ 0.0116. Increasing performance would require increasing the number of trades, which, in turn, would reduce the average percent profit per trade. You would need to change the trading method used. Even though the *MoonPhaser* outperformed SPY over the 20-year walk forward, it did not outperform the simple strategy of buying and holding QQQ. At least, it did outperform SPY.

We have a set of equations to determine the value of one's portfolio at any one time (F(t)). It is erratic, quasi-random-like, stochastically driven on most fronts, mostly unpredictable, and occasionally with some predictability. Sufficient at times to make probabilistic predictions or forecasts. Nonetheless, we have equations to give us the outcome at time *t*, as shown above.

Since the outcome of your trading strategy has for equations:

F(t) = F_{0} + Ʃ^{N} (**H** ∙ Δ**P**) = F_{0} ∙ (1 + g_{avg})^{t} = F_{0} + Ʃ^{N} x_{i} = F_{0} + N ∙ x_{avg} = F_{0} + Ʃ^{N} (ps_{i} ∙ r_{i})

We have to concede that due to the equal signs, they all represent the same thing, the same outcome. The position size (ps_{i}) is easy to determine. We have ps_{i} = q_{i} ∙ p_{i} = b_{i}, the initiating buy-at-market order for any bets made. In the holding matrix **H**, you will find the ongoing inventory **H** = **H**_{0} + **B** - **S**, where the **B** and **S** matrices have, respectively, all the executed buy and sell orders.

Your trading strategy, whatever it is, will have to comply with every equal sign and every variable in that set of equations. You change a variable, and it will have some impact on the outcome. You reduce *N*, the trading interval *t*, the average bet size (*b*_{avg}), or the average return (*r*_{avg}), and you will see a reduction in the outcome. The converse is true; increasing these variables will improve results.

Therefore, the search in building a long-term stock trading portfolio is to find ways to increase any of those four variables (*N*, *t*, *b*_{avg}, and *r*_{avg}), or all simultaneously and by any means available. It is to say that any trading method could make you money, even a *MoonPhaser*.

Created: April 6, 2024, © Guy R. Fleury. All rights reserved.