OPEN-SOURCE SCRIPT

First 30 Min Range (Stable)

50
//version=5
indicator("First 30 Min Range (Stable)", overlay=true)

// --- Settings ---
startHour = 9
startMinute = 15
endHour = 9
endMinute = 45

// --- Variables ---
var float rangeHigh = na
var float rangeLow = na
var bool rangeDone = false

// Detect new day
if ta.change(time("D"))
rangeHigh := na
rangeLow := na
rangeDone := false

// Check if current time is between 09:15 and 09:45
currentMinutes = hour * 60 + minute
startMinutes = startHour * 60 + startMinute
endMinutes = endHour * 60 + endMinute

inRange = currentMinutes >= startMinutes and currentMinutes < endMinutes

// Capture range
if inRange
rangeHigh := na(rangeHigh) ? high : math.max(rangeHigh, high)
rangeLow := na(rangeLow) ? low : math.min(rangeLow, low)

// Plot lines
plot(rangeHigh, title="30 Min High", color=color.green, linewidth=2)
plot(rangeLow, title="30 Min Low", color=color.red, linewidth=2)

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.