tedchou12 / webull

Unofficial APIs for Webull.
MIT License
597 stars 181 forks source link

How to calculate MACD to match Webull number? #324

Open Alanavai opened 2 years ago

Alanavai commented 2 years ago

Hello,

I've looked at several ways to calculate the MACD indicator but the numbers seem to always be off of what Webull shows. Does anybody know of a way to get the accurate numbers?

Thanks

ICANTFINDAUSERNAMEATALL commented 1 year ago

I don't know if it will be exactly the same as webull but you can use python stock indicators:

https://daveskender.github.io/Stock.Indicators.Python/indicators/Macd/#content

When I use it, it is sometimes off by a little but I don't know why. Webull probably calculates everything slightly differently.

DaveSkender commented 1 year ago

The only way to really know if it’s accurate is to calculate it manually and compare. I have both code example in C#, the underlying algo for that Python package, and a manually calculated spreadsheet that you can drop in your raw quotes that might help. One side note, MACD can have convergence related errors in early warmup periods:

:hourglass: Convergence warning: The first S+P+250 periods will have decreasing magnitude, convergence-related precision errors that can be as high as ~5% deviation in indicator values for earlier periods.

Where S is slow periods and P is signal periods

DaveSkender commented 1 year ago

Sometimes it’s easier and more performant to just fetch the quotes from your provider API, then just use one of these PyPI or Nuget packages to compute the indicators.