En tâtonnant, j’ai réussi à trouver ce qui ne fonctionnait pas bien !
Voici le code modifié :
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 high[2] < low THEN
$support[i]= high[2] //modifié, ancien = 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])
endbar=barindex
for z = 1 to bars
if low[z]<checklow then
endbar=barindex[z]
endif
next
if endbar<barindex then
//drawsegment($bar[j],$support[j],endbar,$support[j]) coloured(0,255,0)
//drawrectangle($bar[j],high[max(0,barindex-$bar[j])],endbar,$support[j]) coloured(0,255,0,50) bordercolor(0,0,0,0) // ancien
drawrectangle($bar[j]-2,low[max(0,barindex-$bar[j])],endbar,$support[j]) coloured(0,255,0,50) bordercolor(0,0,0,0) // modifié
else
//drawray($bar[j],$support[j],barindex+1,$support[j]) coloured(0,255,0)
drawrectangle($bar[j]-2,low[max(0,barindex-$bar[j])],barindex,$support[j]) coloured(0,255,0,50) bordercolor(0,0,0,0)
endif
next
endif
RETURN