TIME-Trading Indicator + Alerts

A Pine Script study that profiles intraday behavior by day+time windows in CET/CEST, verifies it on history, colors the chart by the expected bias & strength, shows tables/heatmaps with backtest stats, and can alert at the start of each window with a full trading summary.
Core ideas
Day is split into 7 CET windows: 0–6, 6–9, 9–12, 12–15, 15–18, 18–22, 22–24
(NYC is unified as 15–18 and 18–22 across the whole script.)
For each weekday & window we have an expectation (Bull/Bear/Neutral/Chop) with a strength 1–5 and a label (e.g., “Skokový rast”, “Výplach”…).
Script backtests those expectations on your chart’s history:
Computes return of each window (log-return from first bar open to last bar close of the window).
Counts Hit-rate (bull window = return>0; bear window = return<0; neutral/chop excluded).
Tracks Avg % drift, t-stat, and sample size N.
Trend regime (Auto/Manual)
Auto (EMA): price vs EMA(length) on a higher timeframe (configurable) + optional slope filter.
Manual override: Bull / Bear / Neutral.
Regime is read without look-ahead (uses previous bar’s regime when closing a window).
What you see
Background shading of the current window
– color family by category (green=bull, red=bear, gray=neutral, orange=chop), shade by strength 1–5.
Optional labels on window change with regime + label text (“Bull • Najsilnejší rast týždňa”).
Forecast panel (bottom-right) listing the next X windows with label & strength.
Results tables (three views):
Heatmap 7×7 (default): weekday × window grid, each cell shows one metric (toggle among Hit-rate / Avg % / t-stat).
Deň (stránkovanie): full stats for a single day (N, Hit-rate, Avg %, t, label).
Split 2× (dlhá): two stacked tables (Mon–Thu, Fri–Sun) to fit small screens.
Alerts (window start)
Optionally fire at the start of every window.
Message includes: weekday + window, expectation label, strength, current regime, recommended action (Long/Short/Wait), Hit-rate %, Avg %, and N.
Create alerts in TV with Condition → Any alert() function call (so the script’s dynamic text is used).
Optional filters (easy to add/adjust): min N, min Hit-rate, only Bull/Bear windows.
Inputs you control
Regime mode, EMA length, higher-TF for trend check, require EMA slope.
CET/CEST timezone (uses “Europe/Bratislava” by default).
Toggles: background, labels, forecast, results view, table text size, heatmap metric.
Alert enable; (we can add min-N / min-HR filters if you want them by default).
How stats are computed (important)
A window’s return is measured strictly inside the window (open of first bar → close of last bar).
The window is credited to the correct weekday even across midnight.
Hit-rate uses only directional windows (Bull/Bear). Neutral/Chop are excluded.
Best practices
Use chart TF that divides an hour (5/15/30/60m) so window boundaries align cleanly.
Read the heatmap primarily by Hit-rate (signal reliability) and cross-check with Avg % (effect size) and t-stat (significance).
Trade at the start of a strong window in the direction of the current regime, exit time-based (end of window) or on PT/SL.
If you want, I can also:
mask/show only cells with N ≥ threshold,
add NYC sub-split toggle off/on,
export stats to CSV,
or add webhooks-friendly compact alert strings.
Tập lệnh chỉ hiển thị cho người được mời
Chỉ những người dùng được tác giả đồng ý mới có thể truy cập tập lệnh này. Bạn cần yêu cầu và xin phép sử dụng tập lệnh này. Quyền truy cập thường được cấp sau khi thanh toán. Để biết thêm chi tiết, hãy làm theo hướng dẫn của tác giả bên dưới hoặc liên hệ trực tiếp với Denyzzzz.
TradingView KHÔNG khuyến khích trả tiền hoặc sử dụng tập lệnh trừ khi bạn hoàn toàn tin tưởng tác giả và hiểu cách hoạt động của tập lệnh. Bạn cũng có thể tìm thấy các giải pháp thay thế miễn phí, mã nguồn mở trong mục tập lệnh cộng đồng của chúng tôi.
Hướng dẫn của tác giả
Thông báo miễn trừ trách nhiệm
Tập lệnh chỉ hiển thị cho người được mời
Chỉ những người dùng được tác giả đồng ý mới có thể truy cập tập lệnh này. Bạn cần yêu cầu và xin phép sử dụng tập lệnh này. Quyền truy cập thường được cấp sau khi thanh toán. Để biết thêm chi tiết, hãy làm theo hướng dẫn của tác giả bên dưới hoặc liên hệ trực tiếp với Denyzzzz.
TradingView KHÔNG khuyến khích trả tiền hoặc sử dụng tập lệnh trừ khi bạn hoàn toàn tin tưởng tác giả và hiểu cách hoạt động của tập lệnh. Bạn cũng có thể tìm thấy các giải pháp thay thế miễn phí, mã nguồn mở trong mục tập lệnh cộng đồng của chúng tôi.