Returns momentum: the current value of source minus its value length bars ago.
ta.mom is source - source[length], an absolute price change over the window. It is positive when source is higher than it was length bars back.
The first value appears on bar number length + 1. An na at either end gives na.
Syntax
ta.mom(source: series int/float, length: series int) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| source | series int/ | required | Series to compare with its past value. |
| length | series int | required | How many bars back to compare. A whole number of 1 or more. |
Returns
series float: the difference between source and its value length bars earlier, or na on the first length bars.
Remarks
ta.rocexpresses the same change as a percentage of the old value.
Example
//@version=6
indicator("Momentum")
value = ta.mom(close, 10)
plot(value, "Momentum", color = value >= 0 ? color.green : color.red, style = plot.style_histogram)See also
Runs on Sidechair