OPEN-SOURCE SCRIPT

Volatility Time Windows

520
Volatility Time Windows finds the hours of the day when a market statistically moves the most and draws them on your chart as zones: past occurrences, the window that is running right now, and the next one coming up.

WHAT IT DOES
Every intraday market has a rhythm. Some hours are consistently wild, others are consistently dead. This script measures that rhythm from your chart's own history instead of relying on fixed session times. It splits the day into time slots (default 60 minutes), measures how much price moves in each slot, and merges the slots that are consistently above average into "volatile windows". Those windows are then drawn as boxes around the actual high-low range of every occurrence, so you can see at a glance where the movement clusters.

HOW IT WORKS
1. For every bar, the high-low range in percent of price is measured.
2. To make different regimes comparable, each value is normalized by the average range of the previous 24 hours. A wild week in 2022 therefore counts the same as a quiet week today, only the intraday pattern matters.
3. The normalized values are aggregated per time slot across all loaded bars (minimum 20 samples per slot). The result is a ratio per slot: 1.00 = average hour, 1.50 = 50 % more movement than an average hour.
4. Consecutive slots at or above the threshold (default 1.2x average) are merged into one window. A single slot between two volatile slots joins the window if it is at least average, so a small dip does not split a session in two.
5. Windows are ranked by their average ratio and the top ones (default 2) are shown.

WHAT YOU SEE
- Blue boxes around the high-low range of every past occurrence of a window, with a label showing the time span and the average high-low range of that window in percent (e.g. 13:00-17:00 · Ø 1.35 %).
- The window that is running right now is drawn slightly stronger and its label shows when it ends.
- The next occurrence within the following 24 hours is drawn as a dashed box around the current price. Its height equals the average range of that window, so you get a feeling for the expected move, and its label counts down to the start.
- Hover a label to see the ratio of the window versus the daily average.

HOW TO USE IT
- Use an intraday chart that is not larger than the chosen time resolution (e.g. a 5m, 15m or 1h chart with 60-minute slots). More history means more reliable statistics; the script uses everything TradingView loads.
- Set the timezone to the one you think in. Slot boundaries and labels follow that timezone, so daylight saving changes are handled correctly.
- Use "Mon-Fri" for crypto if weekends dilute your profile, or "Sat-Sun" to study weekend behaviour separately.
- Lower the threshold (e.g. 1.15) for longer windows, raise it (1.3 or more) to isolate the peak hours only.
- Alerts: "Volatility window starts" fires at the start of a window. The heads-up alert warns a configurable number of minutes before the start (create the alert with "Any alert() function call").

SETTINGS
Time resolution: size of the slots the day is split into (15 / 30 / 60 / 120 min).
Timezone: timezone used for slot boundaries and labels.
Days: which weekdays enter the statistics.
Volatile if ≥ x average volatility: threshold for a slot to count as volatile.
Windows to show: how many of the top windows are drawn.
Days of history: how far back zones are drawn (0 = all loaded bars).
Show next occurrence: dashed projection of the upcoming window.
Labels, text size, zone color.
Heads-up minutes: lead time for the pre-alert.

NOTES
- The statistics are descriptive, not predictive. They show when the market has moved the most in the loaded history, which helps with timing entries, sizing stops and avoiding dead hours, but a volatile window is not a directional signal.
- TradingView limits a script to 500 boxes and labels, so the oldest zones drop off once the limit is reached.
- Works on any symbol with intraday data: crypto, forex, indices, futures, stocks.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.