-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistency with bbands indicator #60
Comments
No. This library is used by thousands of traders. Maybe the problem isn't with it, but in fact lies within your code.
All of the indicators work the same. Most have a lag, and you can find that amount with the
This means that a 20-period bbands will be 19 bars shorten than its input. Now let's try a complete example to show that it works:
Note how that example is complete in that anybody can copy/paste and run it? That way we're all on the same page. Also see that we implement error handling. It's good practice to have error handling before accusing someone of having broken code. If we run it, we get:
Of course you want to use the
Again, notice that the code is complete in that anybody can copy/paste and run it. Again, we check for errors. And again, it produces the expected output:
So where does that leave us? I have no doubt that your code isn't working. However, I can't run your code as you didn't provide a complete example. It's missing the |
There seems to be an inconsistency with bbands indicator compared to other indicators concerning the output. I don't know if the problem is within this library or tulip itself.
All indicators i've useds thus far return outputs that match the length of the inputs I feed into it minus any lag time. however the bbands indicator only returning 3 outputs (low, middle, high) with only one period (the last period). this makes it difficult and inefficient to plot on a graph.
sample code:
let bbands = await tulip.indicators.bbands.indicator([stock.close], [20, 2]);
console.log(stock.close.length) // = whatever 10,000
console.log(bbands[0].length) // =1
console.log(bbands[1].length) // =1
console.log(bbands[2].length) // =1
whereas any other indicator i've used MACD for example the above output arrays almost match the length of the initial input (the difference being the lag of the indicator)
The text was updated successfully, but these errors were encountered: