Here's some code that should give you what you're looking for. It's not quite as simple as you would have thought. Note that this code is specifically for the 1M & 5M TimeFrame only. It would not be difficult to modify it to support any timeframe up to 1Hour. Right now, it doesn't draw the vertical lines
overnight from midnight to market open (ET).
#***********
Def validChartTime = GetAggregationPeriod() == AggregationPeriod.MIN or GetAggregationPeriod() == AggregationPeriod.FIVE_Min;
# Modify this line to support other/additional timeframe charts
Def sessionStartTime = RegularTradingStart(GetYYYYMMDD());
## Expected session start time is 0930 ET
Def secondsFromStart = (GetTime() - sessionStartTime)/1000;
## Need to know what the start time of the candle is and whether or not it's at the top of the hour
Def onHour = secondsFromStart % 1800 < 1 and secondsFromStart % 3600 > 1;
## There are 3600 seconds per hour.
## For it to be on the top of the hour, the number must be divisible by 1800 (30 mins) but not by 3600
AddVerticalLine(validChartTime and onHour, color = Color.ORANGE, stroke = Curve.LONG_DASH);
#***********