# Momentum Indicator

**Definition**: Calculates the absolute price oscillator (APO) for the input time series.

**Syntax**:

`apo(fastperiod, slowperiod, matype)`

**Arguments**:

`fastperiod`

: period of fast average`slowperiod`

: period of slow average`matype`

: type of moving average (See table of types)

**Return**: A time series of values representing the absolute price oscillator for the input time series

**Description**: A momentum oscillator that measures the absolute difference between fast and slow moving averages, divided by the slow moving average

**Example**:

apo_values = ETH.close -> apo(12, 26, "sma")

**Definition**: Calculates the Chande momentum oscillator (CMO) for the input time series.

**Syntax**:

`cmo(period)`

**Arguments**:

`period`

- number of values to use in the calculation**Return**: A time series of values representing the Chande momentum oscillator for the input time series.

**Description**: The Chande momentum oscillator (CMO) is a momentum oscillator that measures the difference between the number of advancing and declining periods in the input time series. It is calculated as the difference between the sum of the up periods and the sum of the down periods, divided by the sum of the absolute up and down periods.

**Example**:

cmo_values = ETH.close -> cmo(15)

**Definition**: Calculates the percentage price oscillator (PPO) for the input time series.

**Syntax**:

`ppo(fastperiod, slowperiod, matype)`

**Arguments**:

`fastperiod`

: period of fast average`slowperiod`

: period of slow average`matype`

: type of moving average (See table of types)

**Return**: A time series of values representing the percentage price oscillator for the input time series.

**Description**: The percentage price oscillator (PPO) is a momentum indicator that measures the difference between two moving averages. It is calculated as the difference between the fast moving average and the slow moving average, divided by the slow moving average. This function allows you to specify the fast and slow periods for the moving averages, as well as the type of moving average to use.

**Example**:

ppo_values = ETH.close -> ppo(12, 26, "trima")

**Syntax**:

`roc(period)`

**Arguments**:

`period`

- the length of period to use in the calculation

**Return**: A time series of values representing the rate of change for the input time series.

**Description**: The rate of change (ROC) is a momentum indicator that measures the proportional change in the input time series. It is calculated as the difference between the current value and a prior value, divided by the prior value.

**Example**:

roc_values = ETH.close -> roc(15)

**Definition**: Calculates the rate of change percentage (ROCP) for the input time series.

**Syntax**:

`rocp(period)`

**Arguments**:

`period`

- the length of period to use in the calculation**Return**: A time series of values representing the rate of change percentage for the input time series.

**Description**: The rate of change percentage (ROCP) is a momentum indicator that measures the percentage change in the input time series. It is calculated as the difference between the current value and a prior value, divided by the prior value, and divided by 100.

**Example**:

rocp_values = ETH.close -> rocp(15)

**Definition**: Calculates the rate of change ratio (ROCR) for the input time series.

**Syntax**:

`rocr(period)`

**Arguments**:

`period`

- the length of period to use in the calculation**Return**: A time series of values representing the rate of change ratio for the input time series.

**Description**: The rate of change ratio (ROCR) is a momentum indicator that measures the percentage change in the input time series. It is calculated as the difference between the current value and a prior value, divided by the average of the current value and the prior value.

**Example**:

rocr_values = ETH.close -> rocr(15)

**Definition**: Calculates the rate of change ratio (ROCR100) for the input time series, scaled up by 100.

**Syntax**:

`rocr100(period)`

**Arguments**:

`period`

- the length of period to use in the calculation**Return**: A time series of values representing the rate of change, scaled up by 100, for the input time series.

**Description**: The rate of change ratio (ROCR100) is a momentum indicator that measures the percentage change in the input time series. It is calculated as the difference between the current value and a prior value, divided by the average of the current value and the prior value.

**Example**:

roc_100_values = ETH.close -> rocr100(15)

**Definition**: Calculates the triple exponential average (TRIX indicator) for the input time series.

**Syntax**:

`trix(period)`

**Arguments**:

`period`

- the length of period to use in the calculation**Return**: A time series of values representing the TRIX indicator for the input time series.

**Description**: The TRIX indicator is a momentum indicator that shows the percent rate of change of a triple exponentially smoothed moving average. It is calculated by taking the difference between the current value and a prior value of the triple exponentially smoothed moving average, dividing it by the prior value, and multiplying it by 100.

**Example**:

trix_values = ETH.close -> trix(15)

**Definition**: Normalizes a time series based on the recent values.

**Syntax**:

`rsi(length)`

**Arguments**:

`length`

= the number of previous values to use in the calculation.**Return**: A time series of values, normalized to a range of +/- 100.

**Description**: Harmonization, or normalization, transforms data to enable operations, such as adding or averaging, on disparate time series (eg, asset prices).

**Example**:

normalized = BTC.close -> rsi(30)

**Definition**: Calculates the True Strength Index, which is a momentum indicator that uses double smoothing to reduce lag.

**Syntax**:

`tsi(shortLength, longLength, averageLength)`

**Arguments**:

`longLength`

: The number of previous values to use for the long trend line calculation.`shortLength`

: The number of previous values to use for the short trend line calculation.`avgLength`

: The number of previous values to use in the averaging calculation.

**Return**: Time series of true strength index values with a range of +/- 100.

**Description**: It is calculated by smoothing out the difference between two exponential moving averages of an asset's price and dividing it by the sum of the smoothed difference and a third exponential moving average.

**Example**:

tsiValues = BTC.close -> tsi(30, 90, 60)

**Definition**: Calculates the difference between the value of the current value of a time series and a previous value.

**Syntax**:

`mom(length)`

**Arguments**:

`length`

= number of values back used in the calculation**Return**: Time series of differences

**Description**: Market momentum can be used as a measure of market sentiment.

**Example**:

momValue = BTC.close -> mom(20)

**Name**: dx

**Definition**: Determines whether a current value is greater than, less than, or equal to a previous value. The resulting value is +1, -1, or 0, respectively, times a scale factor.

**Syntax**:

`dx(length, scale)`

**Arguments**:

`length`

: number of values back used in the calculation`scale`

: scale factor for values (default = 100)

**Return**: Time series of directional values

**Description**: Compares the current value to a previous value. The output value is +1, -1, or 0, if the current value is greater than, less than, or equal to the previous value, respectively, multiplied by a scale factor.

**Example**:

BTC.close -> dx(15)

ETH.close -> dx(50, scale=1.0)

Last modified 8d ago