Momentum
Syntax
Description
The mm
function calculates the momentum of price data over a specified period for a given symbol or array of numerical data.
Momentum measures the rate of change in price over time and helps identify the strength or weakness of a trend. Positive momentum indicates upward price movement, while negative momentum indicates downward price movement.
Returns
The mm
function returns a single value representing the momentum of the price data over the specified period. If the rolling
option is specified, it returns an array of momentum values for the specified rolling period.
Parameters
len
: The length of the period over which to calculate the momentum.symbol
ordata
: Either the symbol for which to calculate the momentum or an array of numerical data.options?
(optional): An object with the following optional properties:rolling
: The number of data points for which to return the momentum values. If specified, an array of momentum values is returned.offset
: The number of data points ago to start the calculation. Default is 0 (current data point).
Examples
Using with Symbol and Length
Using with Numerical Data
Use Cases
Identifying Trend Strength:
Buy top 2 stocks by momentum:
Notes
- Momentum is a key indicator used by traders to assess the strength and direction of price trends.
- Positive momentum suggests bullish price movement, while negative momentum suggests bearish price movement.
- Traders often use momentum in combination with other technical indicators to make informed trading decisions and identify potential entry or exit points.