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
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: