Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1036438 // smoothedMovingAverage

JavaX fragment (include) [tags: use-pretranspiled]

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;
}

Author comment

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: 141 / 206
Version history: 1 change(s)
Referenced in: [show references]