-
-
Notifications
You must be signed in to change notification settings - Fork 35
Averages
Ruben edited this page Sep 26, 2017
·
7 revisions
All average functions take as first parameter the list of values in ohlc format (open, high, low, close).
- The last parameter indicates the target attribute, e.g. the Moving Average uses by default the close value, but other can be provided.
- The returned list is a copy of the original input plus the average values.
Appends the ma attribute.
var maList = ma ({h:34.4}, {h:35.4}, ..., {h:40.3});
console.log(maList, 2, ["h"]);
{c:34.4}, {c:35.4}, ... {c:40.3, ma:40}
Appends the ema attribute.
var emaList = ema ({c:34.4}, {c:35.4}, ..., {c:40.3});
console.log(emaList, 4);
{c:34.4}, {c:35.4}, ... {c:40.3, ema:44}
Appends the wma attribute.
var wmaList = wma ({c:34.4}, {c:35.4}, ..., {c:40.3});
console.log(wmaList, 4);
{c:34.4}, {c:35.4}, ... {c:40.3, wma:32.2}