Size Matters In A World Of Dwarves (Cost Averaging With Variable Size)

harry_can
8 min readApr 3, 2022

--

As mentioned last time — there is a world of dwarves. And they’re digging for riches.

For you humans who haven’t yet read the clever dwarf Hulrum’s first story, let me reiterate. In a parallel world to ours, dwarves are digging for riches in their mines. They are working in noble professions such as blacksmiths and brewers, among others. Thus, they earn their currency — “ickles” — which they do their best to wisely invest in the dwock market. The whole dwock market is represented by the dwindex. Hulrum Gravelgleam, a particularly clever dwarf, managed to open a tunnel into our world (yes, dwarves have talents with tunnels). By this means, he contacted the author to help him with a few dwinvestment concepts.

After he asked last time what would happen if he bought a certain ickle amount of dwindex certificates — these respectable looking documents — each month, he was a bit disappointed about what happened if the dwarves’ economy stalled or shrank. So, on a beautiful Sunday, he presented to the author his newest clever idea:

Each month, what about if I invest more of my ickles if the dwindex is low — so I’m buying cheaper — and less ickles if the dwindex is high?

What would happen in each of our three scenarios:

  • UP: industrious dwarves don’t drink too many pixie stouts, so dwindex up;
  • SIDEWAYS: not more, but also not less digging, so range-bound; and
  • DOWN: many pixie stouts and lots of business for the brewery, but no digging, so overall dwindex falls?

And, as you might remember, you don’t reject a dwarf’s request, except if you are fond of some rather vexatious consequences. And then, there was the promise of a wish granted someday…

Disclaimer: the following content is for informational purposes only and does not constitute financial advice. Do not take any decisions based solely on my writing.

Dear Hulrum,

this “buy more when cheap and vice versa”-thing sounds intriguing to me. Of course, we have to define, in some way, when the dwindex is “expensive” or “cheap”. Let me come up with something very simple.

There is a number we earthbound humans call “moving average”. A moving average works by looking back a certain time window, say, five days. Of these five days, the average is calculated. Then we’ll do this in a rolling fashion, kindly look at this example:

Let me plot this for you:

You might see that the moving average lags the dwindex close price — it moves a bit slower (quite different from your enviable working speed in the gold mine!). So maybe we can agree on the definition, that if the dwindex close moves above the moving average, this means “expensive”. Thought the other way round, the close price hurries away from its average. So if the close is below the moving average, we consider this as cheap.

(Slightly impatient, yet still interested noises in the tunnel.)

As you want to invest your ickles for a long timespan, I suggest a very earthly moving average over 200 days for our experiment. Again, I simulated your dwindex using statistical data from a human-made index (see the dig-deeper-section in the first story if you’re interested).

So, how much will we invest when the dwindex is average, above, and below average? As last time, dear Hulrum, you wanted to invest 500 ickles each month, I suggest the following rule:

  • If the dwindex is exactly on its 200-day moving average when it is time to buy each month, you’re going to invest 500 ickles.
  • If it is 10 % above its average, you’ll invest 40 % less (times 4!), that is, you invest 300 ickles. If it is 20 % above 80 % less, thus only 100 ickles remain; and 25 % or more above: nothing.
  • And vice versa, if close price stands 10 % below its moving average, you’ll invest 40 % more, thus 700 ickles; 20 % below means 80 % more, 900 ickles; and 25 % or more below: 100 % more, thus 1000 ickles.

Again, we will look into three possible outcomes in the future: the dwindex moving down, the dwindex staying within a certain range (sideways), and the dwindex moving up:

Huh, these graphs from your world, human author. But please proceed…

Sure, Hulrum, I will gladly explain. In each of these charts, you see four series:

· The black line depicts the dwindex close prices each day.

· The red-brown line is the 200-day moving average (MA).

· The dashed line, as you know from previous correspondence, is the average price you paid for your dwindex shares.

· The bars on the bottom show the amount you would purchase under future conditions — no sizing (left) means you buy dwindex shares for 500 ickles each month. In case of sizing, you buy more when the dwindex is low and vice versa, as described before.

You might see that in the upward scenario, sizing will leave you with a lower average price than constant amounts — which, of course, is good as your profit will be larger.

So, let us have a look at the amount invested (muddy black line in the following images) and your portfolio value over time. Fees are set to zero in this case for simplicity. But fees in general are very important, so let’s discuss these payments to clever dwindex share supply dwarves another time.

You might notice in the muddy curves with sizing (right side), these behave more like a “wave”, with more and less invested from time to time, in comparison with the steady icklevestment without sizing (left side). For the down and sideways scenarios, you might notice no big difference, except that sizing in the down scenario requires a higher overall investment under this buy-more-when-low-rule.

In the upward scenario, however, you will notice a big difference. Even though you invested less overall (grey dashed line), you get a similar portfolio value at the end with and without sizing (green arrow).

When we look at your returns in each case, you might like these results. Sizing seems to work very well in our upward scenario (around 11 percentage points better! Think about the pints of pixie stout!). In the sideways scenario, there is no big difference and very modest gains. For the downward scenario, sizing will save you a few ickles in losses. However, it is not too much.

Overall, that’s good news. But there is also something else to consider, my dear tiny friend.

This sizing stuff might keep you from investing many ickles early on — maybe, at the beginning, the close is above the MA, i.e., we consider the dwindex “expensive”. If the dwindex rises sharply later on, your advantage of not buying “expensively” at the beginning might vanish, as “early expensive” might have been rather cheap when compared to the risen index later. So, it might be wise to choose this sizing method only if you expect a moderate growth.

So, this whole ickle and dwindex thing is actually not itsy-bitsy-easy-peasy. But don’t be discouraged — there is, nonetheless, so much to gain from it and you won’t know beforehand which route is best.

Dear human friend,

Thank you for this tale of icklevesting. It is an interesting thing that varying monthly ickle amounts can actually benefit me. But I will be careful — our dwarf economy is strong, maybe we will grow very fast, and then it’s more intelligent to shovel in more ickles earlier on.

Yours gleamingly

Hulrum

P.S.: Will let you know when it’s time to tunnel a wish. But be patient, dear human, as we are fellows who want you to earn what you deserve.

For dwarves who want to dig deeper:

The choice of scaling the size — how much our dwarf increases or reduces the size of his monthly icklevestment dependent on (i.e., as a function of) difference between dwindex close and MA — largely influences the impact of the sizing. In the author’s tunneling to Hulrum this time, he chose a very large linear scaling factor of 4 (e.g., 25 % difference MA-to-close will create 100 % difference in temporary sizing). Less aggressive scaling lowers the sizing benefits (or, of course, it also lowers the disadvantages in some specific cases when early icklevesting would actually have made more sense).

And I’d like to repeat from last time, to save you the time of switching articles: As dwarves slightly seem to show human traits (our digging dwarves are more amicable and happier, though), their dwindex, somehow, statistically resembles percentage return distributions of a human-made index. For those inclined: real-world distribution is not normal https://towardsdatascience.com/are-stock-returns-normally-distributed-e0388d71267e. Mind the fat tails, and I mean, not those of the dwarves. The author, as the dwarves’ observer, obtained this kind of open-high-low-close data using random walks “picking” from the original return distribution. However, dwarves rather take random walks sometimes to relax in their vast forests. — Furthermore, the monthly dwindex purchases are simulated as being carried out at the marked open — as it is not possible to buy right after close — at a four-week interval (about once a month).

Coding human’s acknowledgements: Studies were carried out using backtrader (https://www.backtrader.com/) within the PyCharm IDE (https://www.jetbrains.com/pycharm/), among other libraries, especially plotly https://github.com/plotly/plotly.py. A big thank you to the developers for providing such great user-friendly and reliable tools. And thanks to www.mypetsname.com for the great dwarf’s name generator.

DISCLAIMER: This article presents my own learnings based on studies generated on synthesized (random, i.e., artificial) data which is statistically similar to real-world time series, and personal experience. The content is, thus, purely educational. Past performance is not a reliable indicator of future results. The article should not be considered Financial or Legal Advice. Consult a financial professional before making any major financial decisions.

--

--

harry_can

Open-minded engineer and PhD with a strong finance hobby, striving to provide and gain practical knowledge.