Averages/Simple moving average: Difference between revisions

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