This script is more likely a method support than a study - and your exit from the default club:
Most people use for ins and outs by 20 rsp 80 (a default behavior MM know well to deal with). C.G. Lane, the inventor of this indicator,
however used it to find divergences with quote (price / close) to predict reversals. Constance Brown refined this method by laying
a fix time cycle underneath the chart that is in rhythm with specific highs or lows of a stock or an index.
The length of one cycle divided by 2 equals the proper value for %D specified for that stock /index. The script offers an input for this specific value.
C. Brown stresses that good signals are only given within the bull or bear ranges (20-65 for bear markets, 40-80 for bull markets).
For your convenience, I laid these areas underneath the graphs. You can automate the divergence research (relative to quote)
by using my script "Bull Bear Divergence Indicator". Feedback welcome. Have fun and success.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.