Moving Average (EMA)
Previous Topic  Next Topic 

Definition

Courtesy of www.stockcharts.com
Courtesy of www.marketscreen.com

Syntax

EMA(int period)
EMA(IDataSeries inputData, int period)

Returns default value
EMA(int period)[int barsAgo]
EMA(IDataSeries inputData, int period)[int barsAgo]


Parameters

period

The number of bars to include in the calculation

inputData

Indicator source data (?)


Examples

// Prints the current value of a 20 period EMA using default price type
double value = EMA(20)[0];
Print("The current EMA value is " + value.ToString());

// Prints the current value of a 20 period EMA using high price type
double value = EMA(High, 20)[0];
Print("The current EMA value is " + value.ToString());


Source Code

You can open up the indicator source code via the NinjaScript Editor