Dollar Cost Averaging vs 10% Drawdown from Recent Highs

As we all know dollar-cost averaging has been the go-to standard financial advice since Ben Graham first popularized it. So I was wondering how it would stack up against people trying to time the market. Specifically buying only when there is a 10 percent drop from the recent highs, then the last drop would count as a recent high (for example, a high at 100, drops to 90 buy-ins once, then 90 is the new recent high, and if it drops to 91 then buy in again etc etc).


I wrote the DCA as a monthly 100 dollar deposit to the S&P500 and growing the deposit amount at 2 percent inflation per year. Allowing the case of fractional shares of the S&P. I am using the historical data of S&P500 from 1993 to 2020. The code is as you can see below

moneyInvested = 0
counter = 0
totalShares = 0
num = 0
for row in csv_f:

   if counter % 22 == 0:
       num = num +1
       monthlyDCA = 100 * (1.000054255**counter)
       moneyInvested = monthlyDCA + moneyInvested
       sharesBought = monthlyDCA/(float(row[5]))
       totalShares = sharesBought + totalShares
   counter += 1

print((3236*totalShares)/moneyInvested)

Where 3236 is the price of the S&P500 the day I did these calculations. We get a total return on capital of 269% gain from the money invested.


While the drawdown strategy code is as follows:

moneyInvested = 0
moneyToInvest = 0
counter = 0
totalShares = 0
highpoint = 457.739990
daySinceInvesting = 0
for row in csv_f:
   if highpoint < float(row[5]):
       highpoint = float(row[5])
   if highpoint*.90 >float(row[5]):
       sharesBought = moneyToInvest/(float(row[5]))
       totalShares = totalShares + sharesBought
       moneyInvested = moneyInvested + moneyToInvest
       moneyToInvest = 0
       highpoint = float(row[5])
   dailyInvest = (100/22) * (1.000054255**counter)
   moneyToInvest = dailyInvest + moneyToInvest
   counter += 1

print((3236*totalShares)/moneyInvested)


The total return on capital is 236%. This shows that the DCA strategy works better, 13% better to be exact. I also played around with x percent drawdown, but none of them beat the DCA. This is due to long times out of the market, where there could be a bull market for a whole year until an x percentage drop, thus missing out on all the previous gains.