OPEN-SOURCE SCRIPT

ABHITHEMAHI Previous Day High/Low & Round Numbers

//version=5
indicator(title="Previous Day High/Low & Round Numbers", overlay=true)

// Previous Day High and Low
prevHigh = request.security(syminfo.ticker, "D", high[0])
prevLow = request.security(syminfo.ticker, "D", low[0])
prevclose = request.security(syminfo.ticker, "D", close[0])
// Determine if the chart is intraday
isIntraday = ta.change(time("D")) == 0

// Plot Previous Day High and Low
plot(isIntraday ? prevHigh : na, title="Previous Day High", style=plot.style_cross, color=color.red, linewidth=2)
plot(isIntraday ? prevLow : na, title="Previous Day Low", style=plot.style_cross, color=color.green, linewidth=2)
plot(isIntraday ? prevclose : na, title="prevclose", style=plot.style_cross, color=color.green, linewidth=2)

// Round Number Levels
incrementVal = input.float(defval=500, title="Unit Place Rounding Value", tooltip="The Unit Place that a number will be rounded and distance between rounded levels. Example Value setting of 100 and a price of 225.00 would result in a line level value of 200.00; Where a price of 265.00 would result in a line level value of 300 with the same value setting of 100")
lQty = input.int(defval=2, minval=1, maxval=50, title="Line Amount", tooltip="Each Line Amount increase will add a line level above and below baseline level; Baseline = line nearest to price)")
offset = input.int(defval=50, minval=0, maxval=490, step=10, title="Line Price Horizontal Offset", inline="a")
textCol = input.color(defval=color.white, title="Price Label Text Color", tooltip="Use Horizontal Offset to adjust the X position of the price labels. To hide price labels disable Labels on the style tab", inline="a")
belowColor = input.color(defval=color.blue, title="Line Color Below price", inline="b")
aboveColor = input.color(defval=color.orange, title="Line Color Above price", inline="b")
ext = input.string(defval="To Right", options=["To Right", "Both"], title="Extend Line: ")
float iv = incrementVal
lQty := lQty + 1

// Calculate Round Number Levels
RoundValue(value) =>
math.round(value / iv) * iv

baseVal = RoundValue(close)

// Plot Round Number Levels
if isIntraday
for j = 0 to lQty - 1
line.new(bar_index, baseVal + (j * iv), bar_index+1, baseVal + (j * iv), extend=ext == "Both" ? extend.both : extend.right, color=close > baseVal + (j * iv) ? belowColor : aboveColor)

for k = 1 to lQty - 1
line.new(bar_index, baseVal - (k * iv), bar_index+1, baseVal - (k * iv), extend=ext == "Both" ? extend.both : extend.right, color=belowColor)
Candlestick analysisChart patterns

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité