Levels@Symbolic (rounded levels) v2

Category: Indicators By: Daniele Maddaluno Created: November 12, 2020, 2:57 PM
November 12, 2020, 2:57 PM
Indicators
0 Comments

This indicator simply plots on the chart the nearest rounded levels to the last close level.

The indicator has just two inputs:

  • level”: represents the value used to identify the rounded levels. For example, as shown in the image, with level=100 the drawn levels are 13000, 13100, etc. It is a decimal so it can be set for any underlying (forex, indexes, …).
  • skips”: indicates how many extra ceils and floors you want to plot above and below the last close price.

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

Download
Filename: Levels@Symbolic.itf
Downloads: 176
Daniele Maddaluno Master
Currently debugging life, so my bio is on hold. Check back after the next commit for an update.
Author’s Profile

Comments

Logo Logo
Loading...