There you go:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
PeriodMASlow = 21
PeriodMAFast = 8
Signal= 0
MAType= 0
x = 0
for MAType= 1 to 3 do
a1= 0
a2= 0
a3= 0
if MAType = 1 then
MASlow1 = Average [ PeriodMASlow] (WeightedClose )
MAFast1 = Average [ PeriodMAFast] (close )
elsif MAType = 2 then
MASlow2 = ExponentialAverage [ PeriodMASlow] (WeightedClose )
MAFast2 = ExponentialAverage [ PeriodMAFast] (close )
elsif MAType = 3 then
MASlow3 = EndPointAverage [ PeriodMASlow] (WeightedClose )
MAFast3 = EndPointAverage [ PeriodMAFast] (close )
endif
if MAType= 1 then
cond1 = (MAFast1 crosses over MASlow1)
a1= 0
for i1= 0 to 10 do
if cond1[ i1] then
a1= 1
break
else
a1= 0
endif
next
endif
if MAType= 2 then
cond2 = (MAFast2 crosses over MASlow2)
a2= 0
for i2= 0 to 10 do
if cond2[ i2] then
a2= 1
break
else
a2= 0
endif
next
endif
if MAType= 3 then
cond3 = (MAFast3 crosses over MASlow3)
a3= 0
for i3= 0 to 10 do
if cond3[ i3] then
a3= 1
break
else
a3= 0
endif
next
endif
x = 0
if a1= 1 or a2= 1 or a3= 1 then
signal= + 1
x = signal
IF signal = signal[ 1 ] THEN
x = 0
endif
break
else
x = 0
signal= 0
endif
next
return x as "Signal MA Cross"
I added lines 6, 10-12, 64, 67-70, 73, then modified line 78 (the last one).
1 user thanked author for this post.