Histogram-based price zones

This indicator provides a new approach to creating price zones that can be used as support and resistance. The approach does not use pivot points or Fibonacci levels. Instead, it uses the frequency of occurence of local maxima and minima to determine zones of interest where price often changed direction.

The algorithm is as follows:
- Gather price data from the last Lookback trading periods
- Calculate rolling minima and rolling maxima along the price points with window size Window size
- Build a histogram from the rolling extrema which are binned into different zones. The number of bins and therefore the width of a zone can be adjusted with the parameter Zone width factor
- Select only the top fullest bins. The number of bins selected for plotting can be controlled with Zone multiplier

The result are a number of boxes that appear on the chart which mark levels of interest to watch for. You can combine multiple instances of this indicator on different settings to find zones that are very relevant.

Shown as an example is the Nasdaq 100 futures (NQ1!) on the D timeframe with levels built from the last 100 periods with default settings. The boxes are the only output of the indicator, no signals are created.

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。