ATR for specific times of day?

Spot87

New member
VIP
Wondering if there is a way to track ATR for specific times of the day over the last few months, first 30 minutes after open, power hour, 11-2, last 30 minutes of the day, etc.
I saw a short video on YouTube showing some crazy percent changes in 0DTE strangles if SPY moved $2 over a day or part of day, and I started thinking it would be interesting to see volatility broken down throughout the day. Could be useful for both selling and buying strategies. Thanks!!

Edit to add- AI gave me a script that seems to work
Here is one averaging 30 days of power hour ATR

Code:
# Isolate Power Hour Volatility (3pm - 4pm EST)
# Target: 30-day True Range Average for the 15:00 candle

input targetTime = 1500;
input length = 30;

# Detect when the 3:00 PM EST hourly bar opens
def isPowerHour = SecondsFromTime(targetTime) == 0;

# Calculate the True Range for that specific hour
def phTrueRange = if isPowerHour
then Max(high - low, Max(AbsValue(high - close[1]), AbsValue(low - close[1])))
else phTrueRange[1];

# Build a rolling average using only the historical Power Hour values
def phSum = if isPowerHour
then phSum[1] + phTrueRange - GetValue(phTrueRange, length * 7) # Approximate chart buffer multiplier
else phSum[1];

# Calculate and display the final metric on your chart
plot PowerHourATR = if isPowerHour then Average(phTrueRange, length) else Double.NaN;
PowerHourATR.SetDefaultColor(Color.YELLOW);
PowerHourATR.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

# Add a clean visual upper-left text label
AddLabel(yes, "30-Day Power Hour ATR (3-4 PM): " + Round(Average(phTrueRange, length), 2), Color.CYAN);
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
2002 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top