Skip to content
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

ADI seems incorrect? #29

Closed
All8Up opened this issue Oct 29, 2022 · 4 comments
Closed

ADI seems incorrect? #29

All8Up opened this issue Oct 29, 2022 · 4 comments

Comments

@All8Up
Copy link

All8Up commented Oct 29, 2022

Hi folks, while working on a little Alpaca experiment, I was looking at yata and ended up poking at the adi method. Unfortunately, in testing things out, it gave me rather bad data. Looking at the code, it seems that it is using the clv against the single bar inputs rather than the 'day' low/high, which as I understand it is not correct? When I plugged in a custom implementation based on the days values, it seemed to correct the problem. Perhaps I'm reading it incorrectly?

@amv-dev
Copy link
Owner

amv-dev commented Oct 29, 2022

Hello!
I don't understand what do you mean by saying that using clv is incorrect. ADI method is described here https://en.wikipedia.org/wiki/Accumulation/distribution_index and it's implemented in yata just like this.
Can you provide some additional data?

@All8Up
Copy link
Author

All8Up commented Oct 29, 2022

From the linked article, emphasis added: "This ranges from -1 when the close is the low of the day". I'm fairly sure they mean that low/high in this context is not the low/high of the individual bar but the low/high of the day up to the point of the computation. I could still be reading it wrong but when I plotted things out and compared to trading view, making low/high the day low/high rather than the bar low/high looked much more accurate.

@amv-dev
Copy link
Owner

amv-dev commented Oct 29, 2022

I think it's just a mistake in the article. There are tons of problems if we consider using daily highs and lows. For example, you can't use ADI on week or month data. The whole indicator became inconsistent.
Here is another article and it's strictly says that we should use period values: https://www.investopedia.com/terms/a/accumulationdistribution.asp

@All8Up
Copy link
Author

All8Up commented Oct 29, 2022

In reading the new article you listed, I still believe that even that one is pointing out the "current" close versus the high low being for the entire period. But, at the same time I believe I know how to interpret it and where my disconnect came from. ADI, when displayed at a less than 1 day resolution is computed as the current state of the entire live session as if it were a partial "day" bar. While that may have been obvious to you, I missed it and as such was incrementally building the ADI from the minute bars which is just all sorts of wrong. When I tracked the low/high it got closer simply because at that point I was properly feeding it partial "day" bars but it was still incorrect since I defaulted it with a window size and that was not matching TradingView either. Zero the window and the shape actually matches now, but obviously doesn't start at the same point since they seed it with the prior "day" adi...

Blah, I really hate multi-resolution indicators on TradingView when they don't bother to point out they are actually multi-resolution.... Unfortunately, I don't believe I can use the incremental yata implementation if I want a 1:1 match, but I only need it for the current session and only care about direction so, hopefully it will work in my setup now that I understand the gotcha's....

@All8Up All8Up closed this as completed Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants