Welcome to NexusFi: the best trading community on the planet, with over 200,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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);