Los Angeles, California Republic
Legendary R.I.P. 1965-2023
Experience: None
Platform: Sierra Chart
Broker: CQG
Trading: ES
Posts: 1,928 since Jan 2011
Thanks Given: 1,375
Thanks Received: 3,722
|
In Thinkscript, there is a function called Ema2. Here is its description:
Ema2(IDataHolder data, int prefetch, double smoothing factor);
Description
Returns the Exponential Moving Average (EMA) of data with smoothing factor. The prefetch parameter controls the number of historical data points used to initialize EMA for the first bar.
Example
input additionalBars = 0;
plot ExpAvg = Ema2(close, additionalBars, 0.2);
The code plots the exponential average of a security Close price with a smoothing factor of 0.2. Note that studies using ema2 fetch a necessary number of additional bars for correct initialization, so adding more initialization data by increasing additionalBars input has little impact on the study.
Is there anything like this in NinjaScript?
If not, how would I go about getting the value of Ema2(Close, 5, 0.2) for instance?
|