Skip to main content

Exponential Moving Average (EMA)

The EMA gives more weight to recent prices using a smoothing factor of 2/(period + 1).

Registration Name: "EMA"

Parameters:

  • period (required): Number of bars for smoothing factor calculation
  • field (required): Price field to use ("open", "high", "low", "close")

Returns: The exponentially weighted moving average

registerIndicator("EMA", "BUILTIN", {
period: 12,
field: "close"
}, "EMA_12_CLOSE"); // Custom ID for this instance