Libraryless. Click here for Pure Java version (9944L/55K).
static double smoothedMovingAverage(double period, double... a) { int n = l(a); if (n == 0) ret Double.NaN; double alpha = reciprocal(period); double value = first(a); for (int i = 1; i < n; i++) value = blend(value, a[i], alpha); ret value; }
Began life as a copy of #1010188
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1036438 |
Snippet name: | smoothedMovingAverage |
Eternal ID of this version: | #1036438/2 |
Text MD5: | c8edd9e2a3664544174933f57bf96eba |
Transpilation MD5: | 97151c374e294f684f8aaf1958e0b79f |
Author: | stefan |
Category: | javax / trading |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-12-12 01:24:09 |
Source code size: | 267 bytes / 9 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 143 / 209 |
Version history: | 1 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1036444 - SmoothedMovingAverage - TODO: rename to ExponentialMovingAverage |