Beat the Market with Stochastic Momentum Index
Beat the Market with Stochastic Momentum Index
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
Post a Comment