0.0.6 • Published 9 years ago
atr v0.0.6
Average True Range
Use ATR to calculate the volatility of a set data.
Usage
Pass the atr()
function your data set, in the form of an array matrix. Supply the second
parameter with an array of the keys you've used. Supply the third parameter with the number of smoothing periods desired.
var atr = require('atr');
var data = [
{
high: 10,
low: 8,
close: 9
}
...
];
atr(data, ['high', 'low', 'close'], 14);
Produces an array of objects, containing:
[{
frange: 1.0600000000000023,
hrange: 0.1700000000000017,
lrange: 0.8900000000000006,
trange: 1.0600000000000023,
atr: 1.3628571428571423
}]
Note, the first n atr
are calculated only using the trange
and the first
item in the array will not be calculated, as it requires a previous set.