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!
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?