boxSize = 15
renkoMedian = (renkoMax + renkoMin)/2
once renkoMax = ROUND(close / boxSize) * boxSize
once renkoMin = renkoMax - boxSize
if dopen(0)<>dopen(0)[1] then
//renkomax = ROUND(dopen(0) / boxSize) * boxSize
//renkoMin = renkoMax - boxSize
renkomedian = dopen(0)
renkomax=renkomedian+boxsize/2
renkomin=renkomedian-boxsize/2
drawvline(barindex)
endif
IF high > renkoMax + boxSize THEN
WHILE high > renkoMax + boxSize
renkoMax = renkoMax + boxSize
renkoMin = renkoMin + boxSize
WEND
ELSIF low < renkoMin - boxSize THEN
WHILE low < renkoMin - boxSize
renkoMax = renkoMax - boxSize
renkoMin = renkoMin - boxSize
WEND
ENDIF
RETURN renkoMax as "RMax40", renkoMin as "RMin40",renkoMedian as "Median",dopen(0) coloured(200,0,0)