Handbook
Glossary
ema ( seq n -- newseq )
Vocabulary
math
.
finance
Inputs
seq
a
sequence
n
number of periods
Outputs
newseq
a
sequence
Word description
Returns the Exponential Moving Average with the specified periodicity, calculated by:
•
A = 2.0 / (N + 1)
•
EMA[t] = (A * SEQ[t]) + ((1-A) * EMA[t-1])
Definition
USING:
kernel
math.finance.private
math.statistics
sequences
;
IN:
math.finance
:
ema
( seq n -- newseq )
[
cut
[
mean
dup
]
dip
]
[
a
]
bi
[
weighted
dup
]
curry
map
nip
swap
prefix
;