Averages/Simple moving average: Difference between revisions

Line 3,471:
 
$inputs = @() #Create an array to hold all inputs as they are entered.
$Period1period1 = 3 #Define the periods you want to utilize
$period2 = 5
 
Line 3,492:
try{$inputs += [decimal] (Read-Host)}catch{Write-Host "Enter only numbers" -ForegroundColor Red} #Enter the numbers. Error checking to help mitigate bad inputs (non-number values)
"Added " + $inputs[(($inputs.Count) - 1)] + ", sma($Period1period1) = " + (getsmagetSMA $inputs $Period1) + ", sma($period2) = " + (getsmagetSMA $inputs $period2)
}
</lang>
 
=={{header|PureBasic}}==
<lang PureBasic>Procedure.d SMA(Number, Period=0)