-
-
Notifications
You must be signed in to change notification settings - Fork 35
Bollinger Bands
Ruben edited this page Sep 26, 2017
·
2 revisions
Returns the Bollinger Bands (http://www.investopedia.com/terms/b/bollingerbands.asp) of the input provided.
The input represents n the size of the window and k the sd value of the bands.
The output contains ma the mean average value, ub upper band and lb lower band.
var serie = [{c:2.1},{c:4.3},{c:4.5},{c:4.8},{c:5.0},{c:5.8},{c:7.1},{c:9.1}];
var bbands = bollinger (serie, 5, 2); // n = 5, k = 2
console.log(bbands);
[ { ma: 2.1, ub: 4.196091601051824, lb: 0.003908398948176295 },
{ ma: 3.2, ub: 4.2384603988597735, lb: 2.161539601140227 },
{ ma: 3.6333333333333333, ub: 5.503520489743087, lb: 1.7631461769235799 },
{ ma: 3.925, ub: 7.106446212023707, lb: 0.7435537879762921 } ]