In: Finance
Calculate the 5-day and 50-day simple MA for the stock price from 28 Oct 2016 to 14 June 2017. Plot the MA5 and MA50. How many golden crosses (if any) are there?
Date | Time | Closing Price | 5-day MA | 50-day MA |
2016/10/28 | 1 | 204 | ||
2016/10/31 | 2 | 205.399994 | ||
2016/11/1 | 3 | 206 | ||
2016/11/2 | 4 | 203 | ||
2016/11/3 | 5 | 200.199997 | ||
2016/11/4 | 6 | 199.699997 | ||
2016/11/7 | 7 | 202.600006 | ||
2016/11/8 | 8 | 203.600006 | ||
2016/11/9 | 9 | 202.399994 | ||
2016/11/10 | 10 | 204.800003 | ||
2016/11/11 | 11 | 206.199997 | ||
2016/11/14 | 12 | 204.199997 | ||
2016/11/15 | 13 | 203.399994 | ||
2016/11/16 | 14 | 203.399994 | ||
2016/11/17 | 15 | 204 | ||
2016/11/18 | 16 | 203 | ||
2016/11/21 | 17 | 202.399994 | ||
2016/11/22 | 18 | 203.800003 | ||
2016/11/23 | 19 | 203.600006 | ||
2016/11/24 | 20 | 203.800003 | ||
2016/11/25 | 21 | 205 | ||
2016/11/28 | 22 | 204.800003 | ||
2016/11/29 | 23 | 203.600006 | ||
2016/11/30 | 24 | 204 | ||
2016/12/1 | 25 | 204.199997 | ||
2016/12/2 | 26 | 202.800003 | ||
2016/12/5 | 27 | 197.399994 | ||
2016/12/6 | 28 | 196.399994 | ||
2016/12/7 | 29 | 193.600006 | ||
2016/12/8 | 30 | 195 | ||
2016/12/9 | 31 | 192.699997 | ||
2016/12/12 | 32 | 189.600006 | ||
2016/12/13 | 33 | 189.600006 | ||
2016/12/14 | 34 | 190 | ||
2016/12/15 | 35 | 186.899994 | ||
2016/12/16 | 36 | 185.100006 | ||
2016/12/19 | 37 | 182.600006 | ||
2016/12/20 | 38 | 182.100006 | ||
2016/12/21 | 39 | 182.100006 | ||
2016/12/22 | 40 | 181 | ||
2016/12/23 | 41 | 179.899994 | ||
2016/12/28 | 42 | 180.699997 | ||
2016/12/29 | 43 | 180.899994 | ||
2016/12/30 | 44 | 183.199997 | ||
2017/1/3 | 45 | 184.300003 | ||
2017/1/4 | 46 | 182.600006 | ||
2017/1/5 | 47 | 185.300003 | ||
2017/1/6 | 48 | 185.399994 | ||
2017/1/9 | 49 | 185.600006 | ||
2017/1/10 | 50 | 187.5 | ||
2017/1/11 | 51 | 188.300003 | ||
2017/1/12 | 52 | 186.600006 | ||
2017/1/13 | 53 | 186.5 | ||
2017/1/16 | 54 | 185 | ||
2017/1/17 | 55 | 185.899994 | ||
2017/1/18 | 56 | 187.899994 | ||
2017/1/19 | 57 | 187.199997 | ||
2017/1/20 | 58 | 185.5 | ||
2017/1/23 | 59 | 185.199997 | ||
2017/1/24 | 60 | 185.199997 | ||
2017/1/25 | 61 | 185.800003 | ||
2017/1/26 | 62 | 187.800003 | ||
2017/1/27 | 63 | 188.699997 | ||
2017/2/1 | 64 | 188.5 | ||
2017/2/2 | 65 | 187.300003 | ||
2017/2/3 | 66 | 186.399994 | ||
2017/2/6 | 67 | 187.199997 | ||
2017/2/7 | 68 | 186.699997 | ||
2017/2/8 | 69 | 195.5 | ||
2017/2/9 | 70 | 195.5 | ||
2017/2/10 | 71 | 195.800003 | ||
2017/2/13 | 72 | 198.699997 | ||
2017/2/14 | 73 | 197.800003 | ||
2017/2/15 | 74 | 202 | ||
2017/2/16 | 75 | 202.399994 | ||
2017/2/17 | 76 | 200.199997 | ||
2017/2/20 | 77 | 200.800003 | ||
2017/2/21 | 78 | 199 | ||
2017/2/22 | 79 | 200 | ||
2017/2/23 | 80 | 200.399994 | ||
2017/2/24 | 81 | 198 | ||
2017/2/27 | 82 | 195.399994 | ||
2017/2/28 | 83 | 192.699997 | ||
2017/3/1 | 84 | 193.5 | ||
2017/3/2 | 85 | 192 | ||
2017/3/3 | 86 | 191.399994 | ||
2017/3/6 | 87 | 191.699997 | ||
2017/3/7 | 88 | 192.199997 | ||
2017/3/8 | 89 | 191.800003 | ||
2017/3/9 | 90 | 190.399994 | ||
2017/3/10 | 91 | 190.100006 | ||
2017/3/13 | 92 | 191.800003 | ||
2017/3/14 | 93 | 192 | ||
2017/3/15 | 94 | 194.699997 | ||
2017/3/16 | 95 | 197.399994 | ||
2017/3/17 | 96 | 196.5 | ||
2017/3/20 | 97 | 200.399994 | ||
2017/3/21 | 98 | 199.699997 | ||
2017/3/22 | 99 | 196.399994 | ||
2017/3/23 | 100 | 196.399994 | ||
2017/3/24 | 101 | 196.399994 | ||
2017/3/27 | 102 | 195 | ||
2017/3/28 | 103 | 195.399994 | ||
2017/3/29 | 104 | 194.600006 | ||
2017/3/30 | 105 | 194.399994 | ||
2017/3/31 | 106 | 195.600006 | ||
2017/4/3 | 107 | 196.100006 | ||
2017/4/5 | 108 | 197.399994 | ||
2017/4/6 | 109 | 196 | ||
2017/4/7 | 110 | 195.899994 | ||
2017/4/10 | 111 | 195.5 | ||
2017/4/11 | 112 | 193.800003 | ||
2017/4/12 | 113 | 195.199997 | ||
2017/4/13 | 114 | 194.199997 | ||
2017/4/18 | 115 | 191.699997 | ||
2017/4/19 | 116 | 190.800003 | ||
2017/4/20 | 117 | 191.5 | ||
2017/4/21 | 118 | 190.800003 | ||
2017/4/24 | 119 | 190.800003 | ||
2017/4/25 | 120 | 192 | ||
2017/4/26 | 121 | 193.699997 | ||
2017/4/27 | 122 | 194.100006 | ||
2017/4/28 | 123 | 191.600006 | ||
2017/5/2 | 124 | 191.600006 | ||
2017/5/4 | 125 | 190.600006 | ||
2017/5/5 | 126 | 189.300003 | ||
2017/5/8 | 127 | 189.600006 | ||
2017/5/9 | 128 | 194.399994 | ||
2017/5/10 | 129 | 194.199997 | ||
2017/5/11 | 130 | 195.699997 | ||
2017/5/12 | 131 | 195.5 | ||
2017/5/15 | 132 | 197.100006 | ||
2017/5/16 | 133 | 196.699997 | ||
2017/5/17 | 134 | 197.699997 | ||
2017/5/18 | 135 | 195.300003 | ||
2017/5/19 | 136 | 195.699997 | ||
2017/5/22 | 137 | 196.399994 | ||
2017/5/23 | 138 | 195.199997 | ||
2017/5/24 | 139 | 194.899994 | ||
2017/5/25 | 140 | 196.300003 | ||
2017/5/26 | 141 | 196 | ||
2017/5/29 | 142 | 197.199997 | ||
2017/5/31 | 143 | 196.699997 | ||
2017/6/1 | 144 | 196.800003 | ||
2017/6/2 | 145 | 205 | ||
2017/6/5 | 146 | 203.800003 | ||
2017/6/6 | 147 | 205 | ||
2017/6/7 | 148 | 204.199997 | ||
2017/6/8 | 149 | 205.600006 | ||
2017/6/9 | 150 | 205.399994 | ||
2017/6/12 | 151 | 199.699997 | ||
2017/6/13 | 152 | 201 | ||
2017/6/14 | 153 | 200.600006 |
First of All we will calculate the 5 and 50 day moving average as shown in following Table
Date | Time | Closing Price | 5-day MA | 50-day MA |
28/10/2016 | 1 | 204 | ||
31/10/2016 | 2 | 205.4 | ||
01/11/2016 | 3 | 206 | ||
02/11/2016 | 4 | 203 | ||
03/11/2016 | 5 | 200.2 | 203.72 | |
04/11/2016 | 6 | 199.7 | 202.86 | |
07/11/2016 | 7 | 202.6 | 202.30 | |
08/11/2016 | 8 | 203.6 | 201.82 | |
09/11/2016 | 9 | 202.4 | 201.70 | |
10/11/2016 | 10 | 204.8 | 202.62 | |
11/11/2016 | 11 | 206.2 | 203.92 | |
14/11/2016 | 12 | 204.2 | 204.24 | |
15/11/2016 | 13 | 203.4 | 204.20 | |
16/11/2016 | 14 | 203.4 | 204.40 | |
17/11/2016 | 15 | 204 | 204.24 | |
18/11/2016 | 16 | 203 | 203.60 | |
21/11/2016 | 17 | 202.4 | 203.24 | |
22/11/2016 | 18 | 203.8 | 203.32 | |
23/11/2016 | 19 | 203.6 | 203.36 | |
24/11/2016 | 20 | 203.8 | 203.32 | |
25/11/2016 | 21 | 205 | 203.72 | |
28/11/2016 | 22 | 204.8 | 204.20 | |
29/11/2016 | 23 | 203.6 | 204.16 | |
30/11/2016 | 24 | 204 | 204.24 | |
01/12/2016 | 25 | 204.2 | 204.32 | |
02/12/2016 | 26 | 202.8 | 203.88 | |
05/12/2016 | 27 | 197.4 | 202.40 | |
06/12/2016 | 28 | 196.4 | 200.96 | |
07/12/2016 | 29 | 193.6 | 198.88 | |
08/12/2016 | 30 | 195 | 197.04 | |
09/12/2016 | 31 | 192.7 | 195.02 | |
12/12/2016 | 32 | 189.6 | 193.46 | |
13/12/2016 | 33 | 189.6 | 192.10 | |
14/12/2016 | 34 | 190 | 191.38 | |
15/12/2016 | 35 | 186.9 | 189.76 | |
16/12/2016 | 36 | 185.1 | 188.24 | |
19/12/2016 | 37 | 182.6 | 186.84 | |
20/12/2016 | 38 | 182.1 | 185.34 | |
21/12/2016 | 39 | 182.1 | 183.76 | |
22/12/2016 | 40 | 181 | 182.58 | |
23/12/2016 | 41 | 179.9 | 181.54 | |
28/12/2016 | 42 | 180.7 | 181.16 | |
29/12/2016 | 43 | 180.9 | 180.92 | |
30/12/2016 | 44 | 183.2 | 181.14 | |
03/01/2017 | 45 | 184.3 | 181.80 | |
04/01/2017 | 46 | 182.6 | 182.34 | |
05/01/2017 | 47 | 185.3 | 183.26 | |
06/01/2017 | 48 | 185.4 | 184.16 | |
09/01/2017 | 49 | 185.6 | 184.64 | |
10/01/2017 | 50 | 187.5 | 185.28 | 195.47 |
11/01/2017 | 51 | 188.3 | 186.42 | 195.15 |
12/01/2017 | 52 | 186.6 | 186.68 | 194.78 |
13/01/2017 | 53 | 186.5 | 186.90 | 194.39 |
16/01/2017 | 54 | 185 | 186.78 | 194.03 |
17/01/2017 | 55 | 185.9 | 186.46 | 193.74 |
18/01/2017 | 56 | 187.9 | 186.38 | 193.51 |
19/01/2017 | 57 | 187.2 | 186.50 | 193.20 |
20/01/2017 | 58 | 185.5 | 186.30 | 192.84 |
23/01/2017 | 59 | 185.2 | 186.34 | 192.49 |
24/01/2017 | 60 | 185.2 | 186.20 | 192.10 |
25/01/2017 | 61 | 185.8 | 185.78 | 191.69 |
26/01/2017 | 62 | 187.8 | 185.90 | 191.36 |
27/01/2017 | 63 | 188.7 | 186.54 | 191.07 |
01/02/2017 | 64 | 188.5 | 187.20 | 190.77 |
02/02/2017 | 65 | 187.3 | 187.62 | 190.44 |
03/02/2017 | 66 | 186.4 | 187.74 | 190.11 |
06/02/2017 | 67 | 187.2 | 187.62 | 189.80 |
07/02/2017 | 68 | 186.7 | 187.22 | 189.46 |
08/02/2017 | 69 | 195.5 | 188.62 | 189.30 |
09/02/2017 | 70 | 195.5 | 190.26 | 189.13 |
10/02/2017 | 71 | 195.8 | 192.14 | 188.95 |
13/02/2017 | 72 | 198.7 | 194.44 | 188.83 |
14/02/2017 | 73 | 197.8 | 196.66 | 188.71 |
15/02/2017 | 74 | 202 | 197.96 | 188.67 |
16/02/2017 | 75 | 202.4 | 199.34 | 188.63 |
17/02/2017 | 76 | 200.2 | 200.22 | 188.58 |
20/02/2017 | 77 | 200.8 | 200.64 | 188.65 |
21/02/2017 | 78 | 199 | 200.88 | 188.70 |
22/02/2017 | 79 | 200 | 200.48 | 188.83 |
23/02/2017 | 80 | 200.4 | 200.08 | 188.94 |
24/02/2017 | 81 | 198 | 199.64 | 189.04 |
27/02/2017 | 82 | 195.4 | 198.56 | 189.16 |
28/02/2017 | 83 | 192.7 | 197.30 | 189.22 |
01/03/2017 | 84 | 193.5 | 196.00 | 189.29 |
02/03/2017 | 85 | 192 | 194.32 | 189.39 |
03/03/2017 | 86 | 191.4 | 193.00 | 189.52 |
06/03/2017 | 87 | 191.7 | 192.26 | 189.70 |
07/03/2017 | 88 | 192.2 | 192.16 | 189.90 |
08/03/2017 | 89 | 191.8 | 191.82 | 190.10 |
09/03/2017 | 90 | 190.4 | 191.50 | 190.29 |
10/03/2017 | 91 | 190.1 | 191.24 | 190.49 |
13/03/2017 | 92 | 191.8 | 191.26 | 190.71 |
14/03/2017 | 93 | 192 | 191.22 | 190.93 |
15/03/2017 | 94 | 194.7 | 191.80 | 191.16 |
16/03/2017 | 95 | 197.4 | 193.20 | 191.43 |
17/03/2017 | 96 | 196.5 | 194.48 | 191.70 |
20/03/2017 | 97 | 200.4 | 196.20 | 192.01 |
21/03/2017 | 98 | 199.7 | 197.74 | 192.29 |
22/03/2017 | 99 | 196.4 | 198.08 | 192.51 |
23/03/2017 | 100 | 196.4 | 197.88 | 192.69 |
24/03/2017 | 101 | 196.4 | 197.86 | 192.85 |
27/03/2017 | 102 | 195 | 196.78 | 193.02 |
28/03/2017 | 103 | 195.4 | 195.92 | 193.19 |
29/03/2017 | 104 | 194.6 | 195.56 | 193.39 |
30/03/2017 | 105 | 194.4 | 195.16 | 193.56 |
31/03/2017 | 106 | 195.6 | 195.00 | 193.71 |
03/04/2017 | 107 | 196.1 | 195.22 | 193.89 |
05/04/2017 | 108 | 197.4 | 195.62 | 194.13 |
06/04/2017 | 109 | 196 | 195.90 | 194.34 |
07/04/2017 | 110 | 195.9 | 196.20 | 194.56 |
10/04/2017 | 111 | 195.5 | 196.18 | 194.75 |
11/04/2017 | 112 | 193.8 | 195.72 | 194.87 |
12/04/2017 | 113 | 195.2 | 195.28 | 195.00 |
13/04/2017 | 114 | 194.2 | 194.92 | 195.11 |
18/04/2017 | 115 | 191.7 | 194.08 | 195.20 |
19/04/2017 | 116 | 190.8 | 193.14 | 195.29 |
20/04/2017 | 117 | 191.5 | 192.68 | 195.38 |
21/04/2017 | 118 | 190.8 | 191.80 | 195.46 |
24/04/2017 | 119 | 190.8 | 191.12 | 195.36 |
25/04/2017 | 120 | 192 | 191.18 | 195.29 |
26/04/2017 | 121 | 193.7 | 191.76 | 195.25 |
27/04/2017 | 122 | 194.1 | 192.28 | 195.16 |
28/04/2017 | 123 | 191.6 | 192.44 | 195.04 |
02/05/2017 | 124 | 191.6 | 192.60 | 194.83 |
04/05/2017 | 125 | 190.6 | 192.32 | 194.59 |
05/05/2017 | 126 | 189.3 | 191.44 | 194.37 |
08/05/2017 | 127 | 189.6 | 190.54 | 194.15 |
09/05/2017 | 128 | 194.4 | 191.10 | 194.06 |
10/05/2017 | 129 | 194.2 | 191.62 | 193.94 |
11/05/2017 | 130 | 195.7 | 192.64 | 193.85 |
12/05/2017 | 131 | 195.5 | 193.88 | 193.80 |
15/05/2017 | 132 | 197.1 | 195.38 | 193.83 |
16/05/2017 | 133 | 196.7 | 195.84 | 193.91 |
17/05/2017 | 134 | 197.7 | 196.54 | 194.00 |
18/05/2017 | 135 | 195.3 | 196.46 | 194.06 |
19/05/2017 | 136 | 195.7 | 196.50 | 194.15 |
22/05/2017 | 137 | 196.4 | 196.36 | 194.24 |
23/05/2017 | 138 | 195.2 | 196.06 | 194.30 |
24/05/2017 | 139 | 194.9 | 195.50 | 194.36 |
25/05/2017 | 140 | 196.3 | 195.70 | 194.48 |
26/05/2017 | 141 | 196 | 195.76 | 194.60 |
29/05/2017 | 142 | 197.2 | 195.92 | 194.71 |
31/05/2017 | 143 | 196.7 | 196.22 | 194.80 |
01/06/2017 | 144 | 196.8 | 196.60 | 194.84 |
02/06/2017 | 145 | 205 | 198.34 | 195.00 |
05/06/2017 | 146 | 203.8 | 199.90 | 195.14 |
06/06/2017 | 147 | 205 | 201.46 | 195.23 |
07/06/2017 | 148 | 204.2 | 202.96 | 195.32 |
08/06/2017 | 149 | 205.6 | 204.72 | 195.51 |
09/06/2017 | 150 | 205.4 | 204.80 | 195.69 |
12/06/2017 | 151 | 199.7 | 203.98 | 195.75 |
13/06/2017 | 152 | 201 | 203.18 | 195.87 |
14/06/2017 | 153 | 200.6 | 202.46 | 195.98 |
After that we will plot the data on a graph
Golden Cross - Golden Cross is formed when short term moving average crosses the long term moving average from the bottom
This has occured 2 times in the data given as shown in figure below