Using two different lines: an indicator high line for , and an indi low line for divergences
For your individual studies, choose your indicator and replace in line 10 with it, any thing else is auto. Script bottom: optional comparison linse addable
Note1: The script only shows divergences to recent , not between actual and one "a few ago"
Note2: Though reversal predictions with the example of SPLK here are quite good, in general better results are obtained with un-normalized indicators.
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.