Documentation

tripleEMA() function

Flux 0.38.0+

The tripleEMA() function calculates the exponential moving average of values in the _value column grouped into n number of points, giving more weight to recent data with less lag than exponentialMovingAverage() and doubleEMA().

tripleEMA(n: 5)
Triple exponential moving average rules
  • A triple exponential moving average is defined as tripleEMA = (3 * EMA_1) - (3 * EMA_2) + EMA_3.
    • EMA_1 is the exponential moving average of the original data.
    • EMA_2 is the exponential moving average of EMA_1.
    • EMA_3 is the exponential moving average of EMA_2.
  • A true triple exponential moving average requires at least requires at least 3 * n - 2 values. If not enough values exist to calculate the triple EMA, it returns a NaN value.
  • tripleEMA() inherits all exponential moving average rules.

Parameters

n

(Required) Number of points to average.

tables

Input data. Default is piped-forward data (<-).

Examples

The following example uses data provided by the sampledata package to show how tripleEMA() transforms data.

Calculate a three point triple exponential moving average

import "sampledata"

sampledata.int()
  |> tripleEMA(n: 3)

View input and output


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.