Averages/Simple moving average: Difference between revisions

Content deleted Content added
Line 1,054:
 
=={{header|Elena}}==
ELENA 3.12 :
<lang elena>import system'routines.
import system'collections.
Line 1,080:
if (aCount > thePeriod)
[
theList remove indexat:0.
aCount := thePeriod
].
var aSum := theList summarize:(Real new int:0).
^ aSum / aCount
Line 1,097:
var SMA5 := SMA new:5.
 
1 to:5 doEach: do(:i)
[
console print:printPaddingRight(30, "sma3 + ", :i, :" = ":, (SMA3 append:i) paddingRight:30 with:$32.
console printLine:("sma5 + ", :i, :" = ":, (SMA5 append:i)
].
 
5 to:1 doEach: do(:i)
[
console print:printPaddingRight(30, "sma3 + ", :i, :" = ":, (SMA3 append:i) paddingRight:30 with:$32.
console printLine:("sma5 + ", :i, :" = ":, (SMA5 append:i)
].