Skip to main content

tema

Function tema 

Source
pub fn tema(data: &[f64], period: usize) -> Result<Vec<Option<f64>>>
Expand description

Calculate Triple Exponential Moving Average (TEMA).

TEMA = 3 * EMA - 3 * EMA(EMA) + EMA(EMA(EMA)) Further reduces lag compared to DEMA.

§Arguments

  • data - Price data (typically close prices)
  • period - Number of periods

§Formula

TEMA = 3 * EMA - 3 * EMA(EMA) + EMA(EMA(EMA))

§Example

use finance_query::indicators::tema;

let prices = vec![10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0];
let result = tema(&prices, 3).unwrap();