OPEN-SOURCE SCRIPT

45-Minute Range

//version=5
indicator("45-Minute Range", overlay=true)

// Define the start time (9:15 AM) and the end time (10:00 AM) in Indian stock market hours
var float rangeHigh = na
var float rangeLow = na
var bool rangeSet = false

// Define the session start (9:15) and end (15:30) times
startTime = timestamp(year, month, dayofmonth, 9, 15)
endTime = timestamp(year, month, dayofmonth, 15, 30)

// Capture high and low in the first 45 minutes of trading (9:15 AM - 10:00 AM)
if (hour == 9 and minute >= 15 and minute <= 59) or (hour == 10 and minute == 0)
rangeHigh := na(rangeHigh) ? high : math.max(rangeHigh, high)
rangeLow := na(rangeLow) ? low : math.min(rangeLow, low)

// Reset the range at the start of a new trading day
if (hour == 9 and minute == 15)
rangeHigh := na
rangeLow := na
rangeSet := false

// Plot the range after 10:00 AM with dotted lines, only for the current day
if (hour >= 10 and not rangeSet)
// Draw dotted line for high and low from 9:15 AM to 15:30 PM
line.new(x1=startTime, y1=rangeHigh, x2=endTime, y2=rangeHigh, color=color.green, width=2, style=line.style_dotted, xloc=xloc.bar_time)
line.new(x1=startTime, y1=rangeLow, x2=endTime, y2=rangeLow, color=color.red, width=2, style=line.style_dotted, xloc=xloc.bar_time)

rangeSet := true

// Optionally, plot the range on the chart
plot(rangeHigh, color=color.green, linewidth=2, title="45 Min High")
plot(rangeLow, color=color.red, linewidth=2, title="45 Min Low")
Bands and Channels

Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının yazarı komut dosyasını açık kaynak olarak yayınlamıştır, böylece yatırımcılar betiği anlayabilir ve doğrulayabilir. Yazar çok yaşa! Ücretsiz olarak kullanabilirsiniz, ancak bu kodun yayında yeniden kullanımı Ev kurallarına tabidir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?

Feragatname