Anonymous user
Averages/Simple moving average: Difference between revisions
m
→{{header|Elena}}
(Added Easylang) |
imported>Arakov |
||
(2 intermediate revisions by 2 users not shown) | |||
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
console.printPaddingRight(30, "sma3 + ", i, " = ", SMA3.append
console.printLine("sma5 + ", i, " = ", SMA5.append
};
for (int i := 5
console.printPaddingRight(30, "sma3 + ", i, " = ", SMA3.append
console.printLine("sma5 + ", i, " = ", SMA5.append
};
Line 4,885 ⟶ 4,887:
{{trans|Go}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="
var sma = Fn.new { |period|
Line 4,908 ⟶ 4,910:
for (x in [1, 2, 3, 4, 5, 5, 4, 3, 2, 1]) {
Fmt.precision = 3
}</syntaxhighlight>
|