Average True Range Calculation

Asked

Viewed 96 times

0

I have the following problem: I performed the calculation of ATR (Average True Range) using numpy library, there was no code problem (exception, etc...) however, the result shows a small decimal difference, when compared to a software that also performs this calculation. Is there any other library that calculates ATR? Or any other library that is geared towards the financial market? Thank you.

  • How much was this difference? Will it be significant? What code did you use?

  • 1

    Read this here: https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

  • Whoa, quiet? I managed to solve, it was just a matter of tuning really. But as a curiosity, I used as a basis the code of numpy book 3 edition (http://pdf.th7.cn/down/files/1602/NumPy,%203rd%20Edition.pdf). Thank you for your attention.

1 answer

1


Without you saying how much the difference is, it is impossible to answer this question with certainty - but most likely the difference is due to the natural error arising from how we represent the numbers on computational platforms. Understanding this article is fundamental: https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

Now, in general the numpy library will give correct results - even if it would suffice a person finding a real error of calculation - as what you fear you have found, to open a "bug report" in the project, since it is open on the internet, and thing be either resolved or well documented in a short time. (Already with commercial programs this cycle is much more complicated - even if there is a way to contact the seller to report defects, they are not visible either to the public or to other subscribers of the software).

Therefore, no, I do not believe that it is a "mistake" in numpy, but, above all, in a collaborative world that is made possible to the extent that one can have direct access to the developers of the software, a fundamental change that we need to have is "this does not work, let me use another" - numpy is more than a library- it is a platform for numerical computations that has evolved 20 years ago to Python, and based on numerical libraries in native code that exist and are used by millions of people maybe twice that time. Even if it was a mistake in numpy, the attitude of "this project is broken, let me use another", would not be the best solution: we can help tidy up here. (Of course, all with common sense - it may be that there is a library specialized in financial calculations, which evolves faster than numpy precisely by being more focused, etc... )

Browser other questions tagged

You are not signed in. Login or sign up in order to post.