Comment on page

# Moving Average

## Moving Average Convergence Divergence

Definition: A customized momentum indicator that measures the convergence/divergence of a short length trend line and long length trend line.
Syntax: `macd(shortLength, longLength)`
Arguments
• `shortLength`: The number of previous values in calculating for short trend.
• `longLength`: The number of previous values in calculating the long trend.
Return: Time series measuring convergence/divergence
Description: The Moving Average Convergence Divergence (MACD) is a popular technical indicator that measures the relationship between two moving averages of an asset's price. It is calculated by subtracting the 26-period exponential moving average (EMA) from the 12-period EMA. The MACD line can be used to identify trend changes, momentum, and potential buy and sell signals.
Example
macdValue = SPY.close -> macd(15, 30)

## Simple Moving Average

Syntax: `sma(length)`
Arguments: `length` = the number of previous values used in the calculation
Return: A time series of smoothed values
Description: Simple moving average (SMA) is a widely used technical indicator that calculates the average price of an asset over a specific time period. It is a lagging indicator, meaning it responds slowly to changes in price. Traders use SMAs to identify trends and potential buy and sell signals, with longer periods (e.g., 50-day SMA) used for long-term trends and shorter periods (e.g., 10-day SMA) used for short-term trends.
Example:
avgSimpleValue = SPY.close -> sma(30)

## Combine List

Definition: Combines values from a list of input time series. The values from all inputs at each point in time are combined using a specified calculation.
Syntax: `combine_lists(combine, weights)`
Arguments:
• `combine` - what calculation to use when combining values
• `weights` - optional, is used to adjust the weighed average.
Return: Single time series of combined values from each point in time
Description: Supported combination methods are:
• `avg`, `mean` - value is the average of values from inputs
• `max` - value is the maximum of values from inputs
• `min` - value is the minimum of values from inputs
• `sum` - value is the sum of values from inputs
The default value is `combine=”avg”`.
How does Weight get calculated:
We multiply each number by its corresponding weight, sum up the weighted values, and then divide them by total weight.
`Weighted Average = (Number1 * Weight1 + Number2 * Weight2) / (Weight1 + Weight2)`
Example:
combined_values = [SPY, ORCL].close -> combine_lists(combine=”max”, weights="7,9")