This ProBuilder script is designed to identify and draw support lines on a price chart until they are broken by subsequent price action. The code determines potential support levels based on specific candlestick patterns and then visually represents these levels with lines until the price breaks through them.
defparam drawonlastbaronly=true
REM Measure the length of real body, lower shadow, and upper shadow for white and black candles
IF OPEN < CLOSE THEN REM white candle realbody = CLOSE – OPEN lowershadow = OPEN – LOW uppershadow = HIGH – CLOSE ELSIF OPEN > CLOSE THEN REM black candle
realbody = OPEN – CLOSE
lowershadow = CLOSE – LOW
uppershadow = HIGH – OPEN
ENDIF
REM Store support
IF ((lowershadow / realbody) >= 2 AND (realbody/uppershadow) >= 2) AND NOT(OPEN = CLOSE) THEN
$support[i]=low
$bar[i]=barindex
i=i+1
ENDIF
REM check support line
if islastbarupdate and i>1 then
for j = 0 to i-1
checklow = $support[j]
bars = max(1,barindex-$bar[j])
check=0
for z = 1 to bars
if low[z] check=1
break
endif
next
if check=0 then
drawray($bar[j],$support[j],barindex,$support[j]) coloured(0,255,0)
endif
next
endif
RETURN
Explanation of the code:
drawonlastbaronly to true, ensuring that drawing operations are performed only on the last available bar to optimize performance.$support and $bar, respectively.This script is useful for traders and analysts who use technical analysis to visually identify and track support levels on price charts.