Averages/Simple moving average: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl 6}}: Combine into a single file for ease of testing)
Line 1,054: Line 1,054:


=={{header|Elena}}==
=={{header|Elena}}==
ELENA 3.2 :
ELENA 3.4 :
<lang elena>import system'routines.
<lang elena>import system'routines.
import system'collections.
import system'collections.
Line 1,080: Line 1,080:
if (aCount > thePeriod)
if (aCount > thePeriod)
[
[
theList remove at:0.
theList removeAt:0.
aCount := thePeriod
aCount := thePeriod
].
].
var aSum := theList summarize(Real new int:0).
var aSum := theList summarize(Real new).
^ aSum / aCount
^ aSum / aCount
Line 1,092: Line 1,092:
}
}


program =
public program =
[
[
var SMA3 := SMA new:3.
var SMA3 := SMA new:3.