Mawreez' RSI Divergence Detector

The idea behind this indicator is to have an expression for the amount of divergence on a given chart at every point in time. To achieve this, it adds up the magnitudes any valid divergence of any kind; bullish , bearish or their hidden variants. Where a valid divergence consists of a line on the source series (almost always the closing price), and a line on an oscillator (here: the RSI ). The slopes of said lines must have opposite signs, that is to say, one line must be sloping up while the other slopes down. Said lines may not cross their respective series.

The length of the RSI is configurable (default length: 14). The lengths of the divergences are configurable (default: minimum length 3 and maximum length 28 - the latter being twice the default length of the RSI ).

This indicator will detect divergences which are still building up. Be duly warned: upcoming divergences may still get invalidated. Another case that one should be very mindful of is that an upcoming divergence may still increase in magnitude before it plays out. Possibly over several more timesteps, there may even be entire additional drives.

The value of this indicator indeed reflects the magnitude of divergence on a chart. However, there is no reason to think the magnitude of a divergence affects the likelihood of said divergence playing out.

The color of the indicator indicates the kind of divergence. The default colors are

Please let me know if you would like to see a version of this indicator that plots both the RSI and this histogram. I will do this for personal use, but I am being a bit of a purist with this publication.

In fact, please don't hesitate to make any comment or to give any kind of suggestion.
Phát hành các Ghi chú: At release I forgot to note that this indicator is particularly good at indicating the complete absence of divergence. I often see the question whether a chart contains divergence. If this indicator has a value of 0 at some point, then at that point there is absolutely no divergence. At least no divergence of a length the indicator is configured to detect.

I was originally going to leave it to the user of this indicator
  • to verify the validity of a possible divergence and
  • to determine the type of a possible divergence.
I was able to satisfyingly automate the identification of divergence types. However, verifying validity is still left to the user. There will be false positives. In an attempt to automate more of the validation process, I wrote code
  • to check for tops and bottoms, and
  • to check whether all values in a series are above or below a line.
Applying these principles did not actually lead to satisfying results. Many of the good reads were no longer recognized. I provided the aformentioned code in case anyone wants to have a go for themselves. Feel free to drop comments or further suggestions. Otherwise, this is probably as far as I'll go with this indicator.
Gỡ bỏ khỏi Script Ưa thích Thêm vào Script Ưa thích

Bình luận

thanks for sharing this awesome script. how to detect nested divergence?
Phản hồi
This publication will be featured in our "Best Scripts of The Month" selection. Thank you for your valuable contribution to the TradingView community, and congrats!
Phản hồi
Mawreez PineCoders
@PineCoders, wow, that's amazing! Thank you!
Phản hồi
Trang chủ Bộ lọc cổ phiếu Bộ lọc Forex Bộ lọc Tiền điện tử Lịch kinh tế Cách thức hoạt động Tính năng Biểu đồ Trả phí Giới thiệu bạn Quy tắc Áp dụng Trung tâm Trợ giúp Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Thư viện Biểu đồ Lightweight Blog & Tin tức Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Giới thiệu bạn Xu Ticket Hỗ trợ của tôi Trung tâm Trợ giúp Các ý tưởng đã đăng Người theo dõi Đang theo dõi Tin nhắn riêng Trò chuyện Đăng xuất