amit1337

Kagi Implementation (+ATR)

My Own Kagi Indicator Implementation!
I couldn't find anywhere on the internet a simple implementation of the Kagi indicator (apart from a seemingly complicated JavaScript implementation).
So I decided to implement it myself and test it against the built-in Kagi indicator calculated by the built-in security function - They ended up exactly the same! (You can see my orange plot completely covers the security's purple plot)
My calculations are based on this article from a site called "euroland", the article is called "Kagi Chart" (I can't post the link because of TradingView restrictions)
Bonus: The built-in kagi indicator uses only Fixed Amount Reversal Size. One that is interested in an ATR Reversal Size can modify the calculation a bit (see script's comments) to easily create and use it.

Some interesting info about the security function I discovered while doing this script:
After I implemented it I noticed that my calculations are the same except the fact that all my values are delayed by 1 bar (relative to the security's indicator). After some research I discovered that the security function uses future data in it's calculation and therefore it cannot be trusted for testing live-trading strategies, unless it is given the appropriate parameters (see script for example).

Have fun trading and don't lose money!
Skrip sumber terbuka

Dalam semangat TradingView yang sebenar, penulis skrip ini telah menerbitkannya dengan menggunakan sumber terbuka supaya pedagang-pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda dapat menggunakannya secara percuma tetapi penggunaan semula kod ini dalam penerbitan adalah dikawalselia oleh Peraturan Dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.

Ingin menggunakan skrip ini pada carta?