MovingAverage ( int length );
Default values:
length: 12
Description
Returns the average value of specified type and length
for a data
set. Available average types are: Simple, Exponential, Weighted, Wilder's, and Hull. Each type can be defined using AverageType constants.
Input parameters
Parameter | Default value | Description |
---|---|---|
averageType | AverageType.Simple | Defines type of average to be applied. This parameter accepts AverageType constants as value. |
data | - | Defines data for which the average is found. |
length | 12 | Defines period on which the average value is found. |
Example
input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.DAY;
input length = 12;
input averageType = AverageType.SIMPLE;
plot MovAvg = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod), length);
This example script plots a moving average of specified type and length for specified fundamental data.