You are on page 1of 5

Description

SMA(A): Simple Moving Average (Closing price shown in formula for simplicity.
The offset function returns a cell range which is just A Cells which need to be summated.
The offset funciton could also be used to select which price column is used (open, high, low,
close, volume) but is not shown.
Parameter A sets the time period for the SMA
SMAR(A) is a simple moving average of the price range. The sum of the differences between the
high and low for each day is mathematically equivalent to taking the difference between the sum
of the highs and the sum of the lows. Or even the difference between an SMA of the Highs and an
SMA of the lows.
EMA(A): Exponential Moving Average
Note for a Wilder implementation of the Wilder EMA see my spreadsheet on DMS.
The problem with an EMA is that unless it has been calculated in finitem the result is not accurate
because the formula requires historical values. This implementation uses an SMA as the initial
value for the EMA. The 3 columns - Seed data calculate the SMA for each seed period. Whilst it
looks confusing at first, the EMA calculation checks if there are sufficient days to calculate an
EMA accurately, if not it uses the SMA value instead as the previous value.
Parameter A is the time period for the EMA
Parameter B is a formula optimisation
Paramater C allows for the conversion of the EMA to a Per Unit Calculation
For the EMA to be calculated in Per Units rather than price, place the current price or reference
price in this cell.

Stock Price Data and Formula notes


This row indicates which Formula is in use
Parameters (A,B,C,D,E) are used
by each algorithm in each Column
System Results may also be calculated in these rows

Param

SMA(A)/C
20

SMA(A)
Range
20

1.0000

1.0000

Code

TradeDate

Open

High

Low

Close

A
B
C
D
E
F
G
H
J
K
L
M
N
P
Result

Code

TradeDate

Open

High

Low

Close

Volume

SMA (20)

4751120
4713918
3874019
5898108
6244101
23298620
8022286
2690305
3567889
762291
6699094
6165833
15332080
19343000
7308155
6838404
6033271
1403029
2890764
3976386
17023520
12085540
4069024
6837315
16193840
6601374
5234586
11270850
8962088
9529200
5024256
4866177

4.68
4.67
4.65
4.64
4.62
4.60
4.57
4.56
4.54
4.53
4.51
4.50
4.48
4.46
4.44
4.43
4.42
4.42
4.42
4.42
4.41
4.41
4.41
4.41
4.41
4.41
4.40
4.40
4.40
4.40
4.39
4.17

FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL

5/7/2004
5/6/2004
5/5/2004
5/4/2004
5/3/2004
4/30/2004
4/29/2004
4/28/2004
4/27/2004
4/26/2004
4/23/2004
4/22/2004
4/21/2004
4/20/2004
4/19/2004
4/16/2004
4/15/2004
4/14/2004
4/13/2004
4/8/2004
4/7/2004
4/6/2004
4/5/2004
4/2/2004
4/1/2004
3/31/2004
3/30/2004
3/29/2004
3/26/2004
3/25/2004
3/24/2004
3/23/2004

4.70
4.74
4.71
4.82
4.85
4.76
4.72
4.75
4.73
4.75
4.79
4.79
4.76
4.64
4.58
4.49
4.45
4.45
4.47
4.43
4.37
4.41
4.41
4.41
4.39
4.41
4.43
4.45
4.46
4.40
4.41
4.42

4.72
4.74
4.76
4.82
4.86
4.90
4.76
4.77
4.79
4.75
4.81
4.80
4.90
4.77
4.61
4.57
4.49
4.47
4.47
4.48
4.43
4.42
4.43
4.41
4.42
4.42
4.43
4.46
4.48
4.46
4.42
4.42

4.67
4.65
4.71
4.72
4.80
4.75
4.71
4.74
4.72
4.72
4.72
4.75
4.75
4.64
4.52
4.49
4.43
4.42
4.42
4.42
4.37
4.33
4.40
4.39
4.39
4.39
4.41
4.41
4.45
4.40
4.40
4.40

4.68
4.70
4.75
4.73
4.82
4.89
4.75
4.74
4.76
4.72
4.73
4.79
4.80
4.75
4.61
4.55
4.49
4.44
4.44
4.48
4.42
4.38
4.42
4.39
4.40
4.39
4.41
4.42
4.48
4.45
4.40
4.42

SMAR
(20)
0.075
0.075
0.075
0.074
0.070
0.069
0.063
0.061
0.062
0.060
0.062
0.058
0.057
0.051
0.046
0.046
0.044
0.045
0.044
0.043
0.043
0.042
0.038
0.039
0.039
0.040
0.040
0.041
0.041
0.042
0.040
0.039

FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL
FGL

3/22/2004
3/19/2004
3/18/2004
3/17/2004
3/16/2004
3/15/2004
3/12/2004
3/11/2004
3/10/2004
3/9/2004
3/8/2004
3/5/2004
3/4/2004
3/3/2004
3/2/2004
3/1/2004
2/27/2004
2/26/2004

4.39
4.40
4.47
4.43
4.37
4.41
4.40
4.38
4.36
4.35
4.39
4.38
4.34
4.35
4.32
4.37
4.34
4.33

4.42
4.43
4.47
4.46
4.45
4.42
4.40
4.43
4.39
4.36
4.39
4.41
4.39
4.35
4.36
4.41
4.37
4.34

4.39
4.39
4.38
4.42
4.37
4.39
4.38
4.36
4.35
4.34
4.35
4.38
4.34
4.32
4.32
4.36
4.32
4.32

4.41
4.39
4.40
4.44
4.43
4.39
4.40
4.42
4.38
4.36
4.37
4.41
4.38
4.33
4.35
4.41
4.37
4.34

5767930
8824880
11466880
3953599
6082748
3300617
2125319
12596020
3274963
3030341
2562125
7240259
10639450
10868530
6965415
7091303
7062791
5171122

3.95
3.73
3.51
3.29
3.07
2.85
2.63
2.41
2.18
1.97
1.75
1.53
1.31
1.09
0.87
0.66
0.44
0.22

0.038
0.037
0.035
0.030
0.028
0.024
0.023
0.022
0.018
0.016
0.015
0.013
0.012
0.009
0.008
0.006
0.003
0.001

EMA(A)/C
20
0.0952
1.0000

Day Seed
50
49
48
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19

EMA
Seed
4.51
4.51
4.50
4.50
4.49
4.49
4.48
4.47
4.46
4.46
4.45
4.44
4.43
4.42
4.42
4.41
4.41
4.40
4.40
4.40
4.40
4.40
4.40
4.40
4.40
4.40
4.40
4.40
4.40
4.39
4.39
4.39

EMA(20)
4.46
4.44
4.41
4.37
4.33
4.28
4.22
4.16
4.10
4.03
3.96
3.88
3.79
3.68
3.57
3.46
3.34
3.22
3.09
2.95
2.79
2.62
2.43
2.22
2.00
1.74
1.46
1.15
0.81
0.42
0.00
0.00

18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1

4.39
4.39
4.39
4.39
4.38
4.38
4.38
4.37
4.37
4.37
4.37
4.37
4.36
4.36
4.37
4.37
4.36
4.34

0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00

You might also like