Anonymous user
Averages/Simple moving average: Difference between revisions
m
→{{header|Elena}}
m (→{{header|Wren}}: Minor tidy) |
imported>Arakov |
||
Line 1,324:
=={{header|Elena}}==
ELENA
<syntaxhighlight lang="elena">import system'routines;
import system'collections;
Line 1,347:
count =>
0 { ^0.0r }
if (count > thePeriod)
{
theList.removeAt
count := thePeriod
Line 1,361:
}
}
// --- Program ---
public program()
{
var SMA3 := SMA.new
var SMA5 := SMA.new
for (int i := 1, i <= 5, i += 1) {
console.printPaddingRight(30, "sma3 + ", i, " = ", SMA3.append
console.printLine("sma5 + ", i, " = ", SMA5.append
};
for (int i := 5, i >= 1, i -= 1) {
console.printPaddingRight(30, "sma3 + ", i, " = ", SMA3.append
console.printLine("sma5 + ", i, " = ", SMA5.append
};
|