Beat the Market with Stochastic Momentum Index

 

Beat the Market with Stochastic Momentum Index


Why is it important to beat S&P500 (the Market)? 

"Beating the Market" means to earn an investment return that exceeds the performance of the Standard & Poor's 500 index which measures the stock performance of 500 large American companies. What is important to understand here is the fact that S&P500 is actually a managed portfolio that frequently add newer, better companies and discard laggards. The rebalancing of S&P500 is done four times in a year by a committee and the included companies are weighted by market capitalization. The total current market cap of S&P500 is about $30 trillion. Many institutions (banks, insurance companies, pension funds, credit unions, hedge funds etc. called together institutional investors) invest primarily in stocks that are in the S&P500 and try to overweight or underweight their positions in certain sectors. This practice ensures they’ll never do much better or much worse than the S&P 500.    

The following computer tests were performed for the time period between 01/01/1985 and 30/11/2020. The price/volume data was read from Yahoo Finance website. Sixteen major declines of about 10% or more of the Market (=S&P500) were detected during that period of time. The purpose was to beat the Market, notoriously difficult task, holding the same stocks as S&P500 ( not different stocks, which is entirely different task!) but attempting to time the market using Stochastic Momentum Index of William Blau. All computer tests were done on weekly charts to smooth out the noise the Market is experiencing on daily basis.


Test Setup

We assume that the value of the S&P500 index is a fictitious price for which you can buy it. On 01.01.1985 you can buy 6.1095 shares of the index for the total price 1000$. How much money would you have after 35 years? Let's find out. 


Test1 

sell rule:

we sell our shares at date i if:

Price(i) < SMA20

SMI(i,10,3,3) < 42.55 and SMI(i-2,10,3,3)>74.69  - the fast stochastic line has declined from its average value 74.69 at the sixteen price peaks to its average value 42.55 two weeks later. 

buy rule: we buy again shares of S&P500 if: 

SMI(i,9,3,3)>SMI(i-1,9,3,3)>SMI(i-2,9,3,3)

Result: return = 5.4467/6.1095= 89% of S&P500 return

Oops! Its not easy to beat the Market!

Lets change our selling rules and require that the current price should be below 26 periods (=weeks) simple moving average SMA.


Test 1A

sell rule:

Price(i) < SMA26

SMI(i,10,3,3) < 42.55 and SMI(i-2,10,3,3)>74.69

buy rule: SMI(i,9,3,3)>SMI(i-1,9,3,3)>SMI(i-2,9,3,3)

Result: 

  You have bought shares  = 6,109482177213925 for 1000 dolars at 1984-12-31

  You should sell at 1988-11-07 sell price = 267,920013

  You should buy at  2018-11-12 buy price = 2736,27002

   ........
  Now you have shares = 5,841293072842256 but your cash is = 0

  Now you have shares = 5,841293072842256
  Your total cash is = 0
  The current value of SP500 index is 3638,350098
  Time elapsed: 00:19:10.0342743

  (that's correct - this test took me 19 minutes and 10 seconds on my new Lenovo Yoga Slim 7 laptop!)

 Return: 5.8413/6.1095 = 95.6% of S&P500 return - still not good enough.  


Test1B

sell rule: 

Price(i) < SMA26

SMI(i-2,10,3,3) - SMI(i,10,3,3)>74.69-42.55=32.14 - the two week drop of the fast stochastic line K should be greater than the difference between the average values

SMI(i-2,10,3,3)>55 - the Stochastic Momentum Index must have been in overbought position

buy rule - the same as test1A

Results: 

You have bought shares  = 6,109482177213925 for 1000 dolars at 1984-12-31

You should sell at 1988-11-07 sell price = 267,920013
Now you have shares = 0 but your cash is = 1636,852544342423

You should buy at  1988-12-12 buy price = 276,290009
Now you have shares = 5,924400054373385 but your cash is = 0

....
Now you have shares = 6,128554462417772
Your total cash is = 0
The current value of SP500 index is 3638,350098
Time elapsed: 00:20:35.0398696

Return=6.1286/6.1095=100.3% of S&P500 return  Voila ! We beat the Market! Hmmm - by very small amount. Let's smooth the K-line more. 

Test 2A

sell rule: 

Price(i) < SMA26

SMI(i,12,4,4) < 55.09  and  SMI(i-2,12,4,4)>70.38 - the fast stochastic K-line now with settings (12,4,4) has declined from its average value 70.38 at the sixteen price peaks to its average value 55.09 two weeks later. 

buy rule: SMI(i,9,3,3)>SMI(i-1,9,3,3)>SMI(i-2,9,3,3)

Results: 

You have bought shares  = 6,109482177213925 for 1000 dolars at 1984-12-31

You should sell at 2007-02-26 sell price = 1387,170044

......

You should buy at  2020-03-30 buy price = 2488,649902
Now you have shares = 7,160320087635551 but your cash is = 0

Now you have shares = 7,160320087635551
Your total cash is = 0
The current value of SP500 index is 3638,350098
Time elapsed: 00:19:00.7235007

Return = 7.1603/6.1095 = 117.2% of S&P500 return. Here we are - we beat the market by a substantial amount! 

Test2C 

sell rule: if ClosePrice[i] < SMA27[i] &&

StocMomIndex(12, 4, 4)[i - 2]- StocMomIndex(12, 4, 4)[i]> 20.0

&& StocMomIndex(10, 3, 3)[i - 2]>70.38

this test was a mistake - it should have been SMI(12,4,4)>70.38

buy rule: SMI(i,9,3,3)>SMI(i-1,9,3,3)>SMI(i-2,9,3,3)

Result: 

You have bought shares  = 6.109482177213925 for 1000 dolars at 1984-12-31

You should sell at 2000-01-24 sell price = 1360.160034
Now you have shares = 0 but your cash is = 8309.873485881686

You should buy at  2000-03-06 buy price = 1395.069946
Now you have shares = 5.956599889280165 but your cash is = 0

You should sell at 2007-02-26 sell price = 1387.170044
Now you have shares = 0 but your cash is = 8262.81693050316

You should buy at  2007-03-26 buy price = 1420.859985
Now you have shares = 5.815363243200322 but your cash is = 0

You should sell at 2010-05-03 sell price = 1110.880005
Now you have shares = 0 but your cash is = 6460.170748683189

You should buy at  2010-07-12 buy price = 1064.880005
Now you have shares = 6.066571555809417 but your cash is = 0

You should sell at 2018-10-08 sell price = 2767.129883
Now you have shares = 0 but your cash is = 16786.99143943804

You should buy at  2018-11-12 buy price = 2736.27002
Now you have shares = 6.134990814772746 but your cash is = 0

You should sell at 2020-02-24 sell price = 2954.219971
Now you have shares = 0 but your cash is = 18124.11238690321

You should buy at  2020-03-30 buy price = 2488.649902
Now you have shares = 7.282708737913594 but your cash is = 0

Now you have shares = 7.282708737913594
Your total cash is = 0
The current value of SP500 index is 3638.350098
Time elapsed: 00:19:19.8304324

Although a mistake the result is: return= 7.2827/6.1095 = 119.2% of S&P500 return.

Test2D

Correction of the mistake in test2C: 

sell rule: if ClosePrice[i] < SMA27[i] &&

StocMomIndex(12, 4, 4)[i - 2]- StocMomIndex(12, 4, 4)[i]> 20.0

&& StocMomIndex(12, 4, 4)[i - 2]>70.38

buy rule: SMI(i,9,3,3)>SMI(i-1,9,3,3)>SMI(i-2,9,3,3)

result = the same as test2C

Test2E
                     

sell rule: if ClosePrice[i] < SMA27[i] &&

StocMomIndex(12, 4, 4)[i - 2]- StocMomIndex(12, 4, 4)[i]> 16.31+13.35=29.66 && StocMomIndex(12, 4, 4)[i - 2]>70.38

16.31 is the average 2-week drop of fast SMI line

13.35 is the standard deviation of that drop

buy rule: SMI(i,9,3,3)>SMI(i-1,9,3,3)>SMI(i-2,9,3,3)

Result: 

You have bought shares  = 6.109482177213925 for 1000 dolars at 1984-12-31

You should sell at 2018-10-08 sell price = 2767.129883
Now you have shares = 0 but your cash is = 16905.730702224555

You should buy at  2018-11-12 buy price = 2736.27002
Now you have shares = 6.178385385454231 but your cash is = 0

You should sell at 2020-02-24 sell price = 2954.219971
Now you have shares = 0 but your cash is = 18252.30949424342

You should buy at  2020-03-30 buy price = 2488.649902
Now you have shares = 7.3342214505845025 but your cash is = 0

Now you have shares = 7.3342214505845025
Your total cash is = 0
The current value of SP500 index is 3638.350098
Time elapsed: 00:19:21.8258729

Return = 7.3342/6.1095 = 120.05% of S&P500 return.

Test2F

sell rule: if ClosePrice[i] < SMA27[i] &&

StocMomIndex(12, 4, 4)[i - 2] - StocMomIndex(12, 4, 4)[i]> 16.31 

&& StocMomIndex(12, 4, 4)[i - 2]>70.38

buy rule: SMI(i,9,3,3)>SMI(i-1,9,3,3)>SMI(i-2,9,3,3)

result = the same as test2C

Test3

sell rule: if ClosePrice[i] < SMA27[i] && StocMomIndex(12, 4, 3)[i - 2]- StocMomIndex(12, 4, 3)[i]> 23.0
                        && StocMomIndex(12, 4, 3)[i - 2]>73.85

buy rule: SMI(i,9,3,3)>SMI(i-1,9,3,3)>SMI(i-2,9,3,3)

Result: 

You have bought shares  = 6.109482177213925 for 1000 dolars at 1984-12-31

You should sell at 2000-01-24 sell price = 1360.160034
Now you have shares = 0 but your cash is = 8309.873485881686

You should buy at  2000-03-06 buy price = 1395.069946
Now you have shares = 5.956599889280165 but your cash is = 0

You should sell at 2007-02-26 sell price = 1387.170044
Now you have shares = 0 but your cash is = 8262.81693050316

You should buy at  2007-03-26 buy price = 1420.859985
Now you have shares = 5.815363243200322 but your cash is = 0

You should sell at 2010-05-03 sell price = 1110.880005
Now you have shares = 0 but your cash is = 6460.170748683189

You should buy at  2010-07-12 buy price = 1064.880005
Now you have shares = 6.066571555809417 but your cash is = 0

You should sell at 2018-10-08 sell price = 2767.129883
Now you have shares = 0 but your cash is = 16786.99143943804

You should buy at  2018-11-12 buy price = 2736.27002
Now you have shares = 6.134990814772746 but your cash is = 0

You should sell at 2020-02-24 sell price = 2954.219971
Now you have shares = 0 but your cash is = 18124.11238690321

You should buy at  2020-03-30 buy price = 2488.649902
Now you have shares = 7.282708737913594 but your cash is = 0

Now you have shares = 7.282708737913594
Your total cash is = 0
The current value of SP500 index is 3638.350098
Time elapsed: 00:19:49.9682156

Return:7.2827/6.1095=119.2% of S&P500 return

                                                      

Comments

Popular posts from this blog

AppLovin Corporation (APP) - stock investment thesis

Microsoft Corporation (MSFT) - stock Investment thesis

Are Recessions predictable?