This indicator plots levels of support/resistance calculated with high/low pivot points:
At a price bar preceded by 4 higher lows and followed by 2 higher lows, a new support line is found and green line is starting. It starts at the lowest low and stops until the line is later crossed or when a new support is formed later.
The same for a red resistance line at a price bar with 4 lower Highs before and followed by 2 lower Highs.
The code has been made following a request in the ProBuilder forum.
DEFPARAM CalculateOnLastBars = 1000
PivotBAR = 2 //2 bars AFTER pivot
LookBack = 4 //3 bars BEFORE pivot
BarLookBack = PivotBAR + 1
IF low[PivotBAR] < lowest[LookBack](low)[BarLookBack] THEN
IF low[PivotBAR] = lowest[BarLookBack](low) THEN
MySupport = BarIndex - PivotBAR
SupportPrice = low[PivotBAR]
ENDIF
ENDIF
IF high[PivotBAR] > highest[LookBack](high)[BarLookBack] THEN
IF high[PivotBAR] = highest[BarLookBack](high) THEN
MyResistance = BarIndex - PivotBAR
ResistancePrice = high[PivotBAR]//high[BarIndex - MyResistance]
ENDIF
ENDIF
DRAWSEGMENT(MyResistance,ResistancePrice,BarIndex,ResistancePrice) COLOURED(255,0,0,255)
DRAWSEGMENT(MySupport,SupportPrice,BarIndex,SupportPrice) COLOURED(0,128,0,255)
RETURN