Sector Math ... and Serendipity: appendix to Sector Rotation
thanks to KevinL

  • We started by looking at WMA, a Weighted Moving Average:
          WMA(N) = [2/N(N+1)] Σk=1,N k pk
  • We calculated its Rate of Change WMA(N) - WMA(N-1) and found it to be proportional to
          gMA = pN - Σk=1,N pk
  • We recognize the ordinary, garden variety Moving Average: Σk=1,N pk
  • To include a variety of Moving Averages (and changing the notation a wee bit), we have:
          gMA(x,y) = pN - Σk=N-x,N-y pk
    where we compare the current price pN to the Moving Average of prices from x weeks previous to y weeks previous.

In the picture:

x and y are selected in cells G4 and H4. In this example, the current price is compared to the Moving Average of four earlier prices, from x = 5-weeks-back to y = 2-weeks-back. Choosing different x and y values makes a difference!

Now, the significance of the Magic Number in cell I1:


The original objective was the switch to that sector which had the largest gMA, meaning its price was largest, compared to its Moving Average. That largest price presumably means an upward trend.

We're thinking: Buy High, Sell Higher.
However, to avoid frequent switching, the largest gMA must be greater than our Favourite's gMA by at least some user-defined factor (given in cell J4).
We find the Largest gMA and compare it to our Favourite gMA like so:
[*]       If gMA(Largest) > Factor x gMA(Favourite) Then switch to that "Largest" sector
where Factor is the factor provided by cell J4.
In Figure 1A, that means we'd switch to the sector denoted by the green circle
(assuming it was significantly larger than our Favourite).
Note that the blue square has a negative gMA. Its price is below its Moving Average.

Figure 1A

However, because some investors think Buy Low, Sell High, we wanted to include this stratgey, by choosing not the largest gMA, but the smallest.

Here's how we intended to do that:
      If we have two numbers A and B and A > B, then A is larger than B.
      If we multiply each by -1 and we get -A > -B, then A is smaller than B.
      Hence we simply compare M gMA where M is either 1 or -1.

Figure 1B shows the negatives of the gMAs from Figure 1A.
We want to switch to the blue square, right?


Figure 1B

So we find the largest gMA (as usual) ... that'd be our green circle - and apply the (modified) comparison:
[*]       If MgMA(Largest) > Factor x MgMA(Favourite) Then switch to that "Largest" sector

And does that give is the blue square?
Not likely!

Yet, we are switching. (See the coloured band at the bottom of the spreadsheet?)
But switching to what?

>Why don't you just change the comparison so that ...?
But look at how well we did with this as-yet-unknown switching criterion? Do you see that 639 in cell J1, in the upper right corner of the spreadsheet picture? That's actually a portfolio gain of 639.7% and we wouldn't want to change that, eh?

Serendipity

Okay, with M = -1 we switch to the sector with the largest gMA ... provided we have:
      -gMA(Largest) > - Factor x gMA(Favourite)

so we'd switch to the green circle (that's our largest gMA sector) if Figure 1C prevailed.
(Remember: Figure 1C shows the negatives of the sector gMAs !)

Or, equivalently, looking at the original gMAs (these "original" gMAs, without the -1 multiplier, are shown in Figure 1D), we switch provided:
      gMA(Largest) < Factor x gMA(Favourite)

Note: Figure 1D is Figure 1C without the -1 multiplier. If, according to Figure 1C, we switch to the green circle, that'd mean we switch when Figure 1D prevailed.


Figure 1C


Figure 1D

On other words, we switch to the sector with the largest gMA when that gMA falls well below the Favourite's gMA.
"Well below" means below the amplified gMA(Favourite) ... amplified by Factor.

>Don't you think that's a pretty weird criterion?
Yes.
>So?
Don't knock success.

In the meantime, check out this succession of sector gMAs, the largest of the bunch and the one that's selected using that weird selection criterion (with M = -1) where we compare:
[!] gMA(Largest) < Factor x gMA(Cash)
and our favourite happens to be Cash.

When the largest gMA (identified by the grey line) falls below Factor x gMA(Cash), then we switch to that sector as in step 3 where we switch to Software, then at step 6 to Biotech then at step ...
>Yeah, I can read the chart.


Figure 2

>So do you ever get back to Cash?
Sure. Remember that we identify the largest gMA among all gMAs, including our Favourite.
In Figure 2, the red triangle shows not gMA(Favourite), but Factor x gMA(Favourite) which explains why it's way up there ... especially if Factor is large.

When it happens that the largest gMA does NOT satisfy
[!]       gMA(Largest) < Factor x gMA(Cash)
then we don't do any switching. We keep our current sector.

Stare at this chart:

Here we start in Oil in steps 1 and 2 because gMA(Oil) had the largest gMA and satisfied [!].
At step 3 it's still the largest gMA, but it no longer satisfies [!] ... so we don't switch, but keep Oil.
At step 4 the largest gMA is now gMA(Cash). That's our Favourite, eh?
It drops to practically zero since gMA(Cash) ain't big!
See where the grey line went? It follows the largest gMA.
If this largest, namely gMA(Cash), satisfies [!], we'll switch to Cash.
Of course, if Factor is positive, Cash is guaranteed to satisfy: gMA(Cash) < Factor x gMA(Cash)
Hence, we switch to Cash.
>zzzZZZ
Wait! I'm not finished!
At step 7 Oil comes back like gangbusters. It's now has the largest gMA and, lo and behold, it even satisfies
      gMA(Oil) < Factor x gMA(Cash).

>Yeah, I can read the chart, but it's weird.
Don't knock ...
>I know! I know! Don't knock success. Besides, you always said that sector rotation was an illusion


Maybe we can think of it this way:

  • For M = -1:
  • We're always keeping our eye on the sector which has the largest Rate of Change of WMA.
    (WMA is our Weighted Moving Average and gMA measures that Rate of Change.)
  • We'd like to switch to that "most active sector" ... but only when it slows down.
  • So, when that "most active sector" has a Rate of Change which is small enough,
    namely gMA(Largest) < Factor x gMA(Favourite), then we BUY.
  • We wonder: "Why does slowing down mean: BUY?"
  • We're thinking:
    • gMA meaures the Rate of Change.
    • gMA is also the excess of the current Price over and above the Average Price
      (paid over the past umpteen weeks).
    • Since gMA has decreased (for this "most active" sector), it's no longer too expensive ... so we BUY!

  • For M = 1 we don't wait. We BUY as soon as we've identified that "most active sector".

>So why do you ignore all other sectors, just looking at the fastest moving sector?
We're concentrating on the fastest moving sector. Maybe that fastest movement means we're not too late. We'll make gains quickly. Stay away from those laggards, eh? Strike while the iron is hot! Just ...

>Oh, please!

Σk=1,N