How to work with ccxt OHLCV?
Mangdar opened this issue · comments
how to work with data like this? please show me some example with ema or sma
[
[ 1635435180000, 4177.79, 4181.47, 4176.42, 4181.01, 141.193 ],
[ 1635435240000, 4181.01, 4184.96, 4180.5, 4184.91, 593.7 ],
[ 1635435300000, 4184.92, 4185.2, 4182.08, 4183.29, 936.606 ],
[ 1635435360000, 4183.29, 4184.92, 4183.28, 4184.29, 270.19 ],
[ 1635435420000, 4184.28, 4184.7, 4182.03, 4183.48, 259.201 ]
]
thats array is [time, open, high, low, close], just get each number from array by index.
for example:
[
[ 1635435180000, 4177.79, 4181.47, 4176.42, 4181.01, 141.193 ],
[ 1635435240000, 4181.01, 4184.96, 4180.5, 4184.91, 593.7 ],
[ 1635435300000, 4184.92, 4185.2, 4182.08, 4183.29, 936.606 ],
[ 1635435360000, 4183.29, 4184.92, 4183.28, 4184.29, 270.19 ],
[ 1635435420000, 4184.28, 4184.7, 4182.03, 4183.48, 259.201 ]
]
// ohlc[0] - time
// ohlc[1] - open
// ...etc
data.forEach(ohlc => {
const smaValue = sma.nextValue(ohlc[4]);
});