part is based on the with Direction indicator, but modified - now: 1) it is not restricted by length and uses all available data 2) it absolute, not relative.
The SR part is also based on identifying high/low/higherhigh/lowerlow. On price it uses wicks.
Then script trying to predict possible divergencies.
It "predicts" because it is using not confirmed HH and LL: for example, any high over resistance counts as HH.
SR plotting is available in options.
Scrypt plots dots:
hidden bear div =color.orange
hidden bull div =color.lime
Because of using unconfirmed HHLL states this dots is early signals, needs to be manually verified.
By standard only first dot of signal plots, plotting of signal tails is available in options.
Commentary for the screenshot.
Green dots pointed by arrows is signaling for bull div , it confirms on VD indicator bellow.
The first pointed (lower) maroon dot is faked because of VD indicator not confirmed HL. This have no tails as it was invalidated on the next candle.
The second pointed (upper) maroon dot is bear div: HH by price and LH by .