Handbook
Glossary
momentum ( seq n -- newseq )
Vocabulary
math
.
finance
Inputs
seq
a
sequence
n
number of periods
Outputs
newseq
a
sequence
Word description
Returns the Momentum of the sequence, calculated by:
•
MOM[t] = SEQ[t] - SEQ[t-n]
Definition
USING:
kernel
math
math.vectors
sequences
;
IN:
math.finance
:
momentum
( seq n -- newseq )
[
tail-slice
]
2keep
[
dup
length
]
dip
-
head-slice
v-
;