Zigzag indicator implementation using numba will close issue #443 and complete pr #693 #761
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello @twopirllc
I'm pleased to present a new pull request for the completion of the zigzag indicator.
In this update, I've utilized Numba for implementation, as opposed to the previous approach which relied on Pandas. and compared the results with TradingView's default zigzag indicator and everything seems to be so much similar.
Below, you'll find the outcome of applying a deviation of 5% and a pivot leg of 10 to the BTCUSD daily chart:
![Screenshot from 2024-02-07 14-08-49](https://private-user-images.githubusercontent.com/121802083/302954870-8986f09b-1456-47c2-b917-7afd3761c34d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMxMjEwMDIsIm5iZiI6MTcyMzEyMDcwMiwicGF0aCI6Ii8xMjE4MDIwODMvMzAyOTU0ODcwLTg5ODZmMDliLTE0NTYtNDdjMi1iOTE3LTdhZmQzNzYxYzM0ZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgwOFQxMjM4MjJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xZmQ2MjlhMmNjMjk3Nzg3MmMxMWUzOTU1YmY4ZjI1MDM4MGQxYjBhYzYxNzkxMmNmOGExZDc2NDgwMDkyMTc0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.tPi59p22jlHgxNiIVtRUdOQ1q45LYYUTa5bnmr4Z1w0)
Compare this with the result of the new implementation under the same configuration:
![Screenshot from 2024-02-07 14-08-26](https://private-user-images.githubusercontent.com/121802083/302955714-d9841f51-e149-479c-8250-b037fbc6579e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMxMjEwMDIsIm5iZiI6MTcyMzEyMDcwMiwicGF0aCI6Ii8xMjE4MDIwODMvMzAyOTU1NzE0LWQ5ODQxZjUxLWUxNDktNDc5Yy04MjUwLWIwMzdmYmM2NTc5ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgwOFQxMjM4MjJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iMWM1YzE5ZjM2ZTQ4NDI4ZTQ4ZTkxODU1MGZiYWEzN2VlNmRkMzJlOWI1NzQyNGJkZDVlNTg3ZjIyOTU0ZDRhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.ZdSkSvCMnIk8JcZplfoTTJ1OLS37ldkRhsoRVEg6D9M)
In order to test it yourself, use the following code:
Additionally, I believe this code snippet could prove beneficial for @AureliusMarcusHu and @KilianB in their Pandas-TA coding endeavors.