motivated by a discussion at Early Retirement.
Once upon a time I compared investing $12K all at once, or 12 monthly investments of $1K
(where you stick what you haven't invested in Money Market).
>That's Dollar Cost Averaging, eh?
Yes, DCA. In that earlier (ancient?) tutorial
(at the bottom) we had all the monthly returns for the S&P 500, from year 1928 to year 2001 and
considered a random 12-month sequence
(chosen from that time period) and compared the two rituals.
Now I want to consider an arbitrary portfolio made up of four assets, where you get to choose the allocation, like 25% Asset A + 35% Asset B + ...
First you download ten year's worth of asset prices, like so:
Then you get to choose your allocations, like this:
Click on picture to download the spreadsheet.
Then, each time you click F9 you get a different 12-month sequence
(selected from the 10-years worth of returns).
You also find out whether DCA or All-at-once wins.
You also get a bunch of charts:
 The 12 month evolution of the unit price, starting at $10.
 The 12 month evolution of a Portfolio: DCA and All-at-once.
 The units purchased each month (when you do the DCA thing).
 The cumulative total of units purchased each month.
(That doesn't change for all-at-once. It's $12,000 / $10 = 1200 units.)
If DCA gets you more units (after 12 months), then DCA wins!
If'n you get tired of pressing F9, you can click a button:
Then you get a bunch of F9 repetitions (or however many your choose, like 500 iterations, in the above example).
You also get the percentage of times that All-at-once won.
(In the above example, it was 60.4% of the time.)