cinar / indicatorts

IndicatorTS - Stock technical indicators and strategies in TypeScript for browser and server programs.
MIT License
283 stars 48 forks source link

onBalanceVolume returns only nan #426

Closed brlocky closed 6 months ago

brlocky commented 6 months ago

onBalanceVolume returns always NAN

The fix should be pretty simple once the "i" is compared to 0 but "i" is never 0

 for (let i = 1; i < result.length; i++) {
    if (i === 0) {
      result[i] = 0;
    } 
    ...

to

 for (let i = 1; i < result.length; i++) {
    if (i === 1) {
      result[i] = 0;
    } 
    ...
cinar commented 6 months ago

Great catch. Thank you for reporting it. Sounds like an easy fix.

brlocky commented 6 months ago

Great catch. Thank you for reporting it. Sounds like an easy fix.

There are no easy fixes !

cinar commented 6 months ago

I think this fixed the issue, but please feel free to reopen if you expect the results to be different.