Introduction
Automation Platform
Botmain DAO
Building Trading Strategies
API References Dev Live Stream
@botmain/indicators / Class

ExponentialMovingAverage

Extends BaseSeriesIndicator ImplementsIAverager

The Exponential Moving Average (Ema) is a widely-used technical indicator that gives more weight to recent price data, making it more responsive to new information compared to a Simple Moving Average (SMA). The Ema decreases the lag by applying more weight to recent prices relative to older prices. The Ema can provide key market signals. A common interpretation is that when the Ema crosses above the price, it's a buy signal, and when it crosses below, it's a sell signal. The Ema is calculated with the formula: EMA_i = EMA_i-1 + K * (Price - EMA_i-1) where K is the smoothing factor calculated by 2 / (Period + 1). This formula allows the Ema to be continuously updated as new price data becomes available.

Constructor

No documentation has been provided.
Presentation
constructor(
	period: number
): ExponentialMovingAverage;
Parameters
NameTypeDescription
period
number

The period of the Ema. The default is 14

Properties

NameTypeDescription
historyCapacity
inherited from BaseIndicator
number

The maximum history held by the indicator. As new data comes in only this many points are kept.

historyCount
inherited from BaseIndicator
number

The number of historical points currently held by the indicator. Will never be larger than historyCapacity.

last
inherited from BaseIndicator
T
values
inherited from BaseIndicator
T[]

Methods

add()

inherited from BaseSeriesIndicator
No documentation has been provided.
Presentation
add(value: number): void;
Parameters
NameTypeDescription
value
number

Adds the latest value (usually price) to the indicator. Normally called for each indicator in onBarClose()

Returns

void