This indicator simply plots on the chart the nearest rounded levels to the last close level.
The indicator has just two inputs:
This v2 code has been edited to work correctly even on PRT v11.
// Settings: level = 100, skips = 0
// 09.11.2020
// Author: Daniele Maddaluno
once floorBase = close
once ceilBase = close
price = close[1]
if price < floorBase or price > ceilBase then
frac = price/level
rounded = round(frac)
// computing floorBase and ceilBase (functions are not available in v10.3)
if rounded > frac then
ceilBase = rounded * level
floorBase = (rounded-1) * level
else
floorBase = rounded * level
ceilBase = (rounded+1) * level
endif
endif
// Choose one of these chars to mark levels (see https://en.wikipedia.org/wiki/Dash):
// ― - — ― ‒
// ~ ∼ ➖ ⁃ ✛
// • ● ○ ∙ ◦
IBar = barindex
for skip = 0 to skips do
skipSize = skip*level
ceilLev = ceilBase + skipSize
floorLev = floorBase - skipSize
drawtext("◦", IBar, ceilLev, Dialog, Standard, 10) //coloured (rCeil, gCeil, bCeil, tCeil)
drawtext("◦", IBar, floorLev, Dialog, Standard, 10) //coloured (rFloor, gFloor, bFloor, tFloor)
next
return