Libraryless. Click here for Pure Java version (9944L/55K).
1 | static double smoothedMovingAverage(double period, double... a) {
|
2 | int n = l(a); |
3 | if (n == 0) ret Double.NaN; |
4 | double alpha = reciprocal(period); |
5 | double value = first(a); |
6 | for (int i = 1; i < n; i++) |
7 | value = blend(value, a[i], alpha); |
8 | ret value; |
9 | } |
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: | 396 / 521 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |