talib MACD return null
HiepNinh opened this issue · 2 comments
I'm using talib v1.0.3. Nodejs v9. Here is my code:
talib.execute({
name: "MACD",
startIdx: 0,
endIdx: end,
inReal: Data,
optInFastPeriod: 12,
optInSlowPeriod: 26,
optInSignalPeriod: 9
}, function (result) {
console.log(result);
});
The result is null. Could anyone know the reason please help me solve this stuff. Thank in advance.
How many periods of data did you feed this? If the algorithm doesn't have enough periods of data then you will not get anything out. As optInSlowPeriod is 26, then, I believe you will need at least 27-periods of data before you will get anything out. I'm not certain about the exact quantity, but hopefully this gives you an idea that maybe you need to feed more data in to get a result.
If anyone's out here hitting this in 2021, the ans is the callback signature is (err, data)
: I didn't get it til I checked out the examples in https://github.com/oransel/node-talib/blob/master/examples/adx.js#L21
Great lib tho!