Constructor
new module:caplin/chart/study/SimpleMovingAverage(alias, derivationParams, listener, configOverridesopt)
Constructs a new
caplin.chart.study.SimpleMovingAverage
.
A study that calculates the
simple moving
average over the given period.
This study requires the period
to be passed in the derivation options. By default it will use the
`close` field as the value for calculating the study data. If you require a different field, set a `field`
property in the derivation options. See module:caplin/chart/series/Fields
for details.
This study only requires the configuration options defined by module:caplin/chart/Study
.
This study is aliased by the caplin.chart-sma-study
alias. To create a new instance of this study
use the module:caplin/chart/study/Factory
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
alias |
String | The Study alias. | |
derivationParams |
Object | Study derivation options. | |
listener |
Object | A listener object that implements the module:caplin/chart/study/StudyListener interface. |
|
configOverrides |
Object |
<optional> |
Configuration overrides passed to the parent class. This study uses the default configuration options. |
- Implements:
Methods
-
evaluate(data)
-
Calculates the simple moving average over the given period.
Once completed it will invoke the
module:caplin/chart/study/StudyListener#onStudyData
method on its listener.The format of the calculated data is:
[[timestamp, value(, state)], ...]
Parameters:
Name Type Description data
Array Chart series data in the Caplin Format.