0

I'm developing a financial technical analysis algortithm with node-talib, a wrapper of TALIB (Technical Analysis Library).

Giving a marketdata array of 400 positions, I execute an ADX and I get an array of 384 positions. What does it mean? What that array represent?

I add an example of the code:

const talib = require("node-talib")
// Load market data
var marketContents = fs.readFileSync('examples/marketdata.json','utf8'); 
var marketData = JSON.parse(marketContents);

// execute ADX indicator function with time period 9
talib.execute({
    name: "ADX",
    startIdx: 0,
    endIdx: marketData.close.length - 1,
    high: marketData.high,
    low: marketData.low,
    close: marketData.close,
    optInTimePeriod: 9
}, function (err, result) {

    // Show the result array
    console.log("ADX Function Results:");
    console.log(result);

});


where marketdata is an object of arrays like this: 

{
   "open": [
        448.36,
        448.45,
        447.49,
        (...) ],
  "close": [
        448.36,
        448.45,
        447.49,
        (...) ],
   "min": [
        448.36,
        448.45,
        447.49,
        (...) ],
   "max": [
        448.36,
        448.45,
        447.49,
        (...) ],
  "volume": [
        448.36,
        448.45,
        447.49,
        (...) ]
   }

And the result is an array of floats (always less than marketdata.open/close/min/max length).

Thanks

AlexAcc
  • 601
  • 2
  • 10
  • 28
  • The quality of your question would significantly improve if you provided a specimen/example of the output. Please use the *edit* button in case you decide to do so. – Patrick Trentin Aug 28 '17 at 21:03
  • The name of the library is TA-Lib, which you might want to use to avoid complications with your country's security forces. –  Aug 28 '17 at 21:18

1 Answers1

2

You'd better to read official c++ docs In a nutshell result array is always same size or less than input array. It is less, for example, for 5-day average. If you apply it to 60 days input data you'll get only 56 results. Because 5-day average require 5 values to be calculated and for first 4 days it's undefined. So result array contain data corresponding to last n input values where n <= input array size depending on indicator you apply.

truf
  • 2,843
  • 26
  • 39
  • I discovered it later, I supposed but no much info about that. I'm now using Tulip Charts (there're wrappers for node, python...) It's supposed to be much faster than TA-LIB: https://tulipindicators.org/benchmark – AlexAcc Aug 31 '17 at 09:55