EMA Function

Top  Previous  Next

Returns the Exponential Moving Average, based on the last value of the series, the new value, and the number of days in the moving average.

 

Syntax

 

value= EMA( lastValueOfSeries, movingAverageDays, newValue )

 

Parameters

lastValueOfSeries

 

the previous value in the series

movingAverageDays

 

the number of days in the moving average

newValue

 

the new value

 

 

 

returns

 

the current EMA value

 

Examples

 

A calculated indicator could be defined as follows. This would be the moving average of today's close minus yesterday's close, where the name of this calculated indicator is "closeChangeMovingAverage," and the number of days in the moving average is "daysInMovingAverage."

 

EMA( closeChangeMovingAverage[1], daysInMovingAverage, instrument.close - instrument.close[1] )

 

 

Or more simply, the 10 day exponential moving average of the close would be defined as follows, where closeEMA is a series variable.

 

closeEMA = EMA( closeEMA[1], 10, instrument.close )