Hallo,
Vielleicht ist das ja etwas für Sie…
Dieser Indikator zeichnet “Support & Resistance”…
// https://www.prorealcode.com/topic/array-variables-availability-in-prorealtime/
// (please do not remove the link above for future reference)
// Example #1: support and resistance example, based on fractals points
defparam drawonlastbaronly=true
// --- settings
fractalP = 10
percent = 0.1
barlimit = 500
// --- end of settings
//fractals
cp=fractalP
if high[cp] >= highest[(cp)*2+1](high) then //new fractal high found
$TOPy[lastset($TOPy)+1] = high[cp] //store fractal value
$TOPx[lastset($TOPx)+1] = barindex[cp] //store fractal barindex
endif
if low[cp] <= lowest[(cp)*2+1](low) then //new fractal low found
$BOTy[lastset($BOTy)+1] = low[cp] //store fractal value
$BOTx[lastset($BOTx)+1] = barindex[cp] //stire fractal barindex
endif
if(islastbarupdate and isset($topy[0]) and isset($boty[0])) then
//check points in a range of X percent
for i = 0 to lastset($TOPy) do //loop through the tops
for y = 0 to lastset($TOPy) do //check first top with other tops
change=abs(($topy[y]-$topy[i])/$topy[i]) //percent range between the 2 tops
if change<=percent/100 and barindex-$TOPx[y]<barlimit and $topx[i]<>$topx[y] then
if close>min($topy[y],$topy[i]) then //define the color
r=0
g=255
else
r=255
g=0
endif
//plot points at each tops
DRAWPOINT($topx[i],$topy[i],2) COLOURED (r,g,0) BORDERCOLOR (r,g,0)
DRAWPOINT($topx[y],$topy[y],2) COLOURED (r,g,0) BORDERCOLOR (r,g,0)
midlevel=($topy[i]+$topy[y])/2
//display the mid level price
DRAWTEXT("#midlevel#", barindex+8, midlevel, monospaced, standard, 14)
//plot the zone
drawrectangle(min($topx[y],$topx[i]),$topy[y],barindex,$topy[i]) coloured(r,g,50,50) bordercolor(r,g,0)
endif
next
next
for i = 0 to lastset($BOTy) do //loop through the bottoms
for y = 0 to lastset($BOTy) do //check first bottom with other bottoms
change=abs(($boty[y]-$boty[i])/$boty[i]) //percent range between the 2 bottoms
if change<=percent/100 and barindex-$BOTx[y]<barlimit and $BOTx[i]<>$BOTx[y] then
if close<max($boty[y],$boty[i]) then //define the color
r=255
g=0
else
r=0
g=255
endif
DRAWPOINT($botx[i],$boty[i],2) COLOURED (r,g,0) BORDERCOLOR (r,g,0)
DRAWPOINT($botx[y],$boty[y],2) COLOURED (r,g,0) BORDERCOLOR (r,g,0)
midlevel=($boty[i]+$boty[y])/2
DRAWTEXT("#midlevel#", barindex+8, midlevel, monospaced, standard, 14)
drawrectangle(min($botx[y],$botx[i]),$boty[y],barindex,$boty[i]) coloured(r,g,50,50) bordercolor(r,g,0)
endif
next
next
endif
return