OPEN-SOURCE SCRIPT
SevenDayHighLowTableWithBoxes [CHE]

SevenDayHighLowTableWithBoxes [CHE] — Seven-day day-range boxes with a weekday-aware “ghost” projection and a compact table that tracks recent extremes and per-weekday hit rates.
Summary
This indicator visualizes each trading day as a colored box and annotates the final high and low with compact markers. It maintains a rolling seven-day view and a five-column table showing day name, high, low, range, and a per-weekday projection hit statistic. A dashed “ghost” box projects a typical range for the current weekday using a running average and an adjustable scaling factor. The script is written in Pine v6, runs on the main chart (overlay true), and emphasizes stable object handling and closed-bar finalization at day boundaries.
Motivation: Why this design?
Intraday traders often need fast context for where today’s price sits relative to recent daily extremes, without switching timeframes. A simple daily high/low overlay is informative but lacks structure, sizing context, and continuity. By grouping bars into local days (configurable UTC offset), drawing explicit boxes, and projecting a weekday-typical range, the chart becomes easier to scan. The compact table gives a quick audit trail of the latest seven days while tracking how often the weekday projection would have covered the realized range.
What’s different vs. standard approaches?
Reference baseline: Plain daily high/low lines or session boxes without context.
Architecture differences:
Weekday-tinted boxes and labels for today plus up to six prior days.
Weekday average range drives a dashed projection (“ghost”) sized by a user-defined percentage.
Per-weekday hit statistics recorded as hits over totals and displayed in the table.
ATR-based vertical offsets keep labels readable.
Live updates intraday; state is finalized at the local day switch.
Practical effect: The chart shows where current price sits inside a known daily envelope, plus how “typical” the day’s movement is for this weekday, aiding expectations and planning.
How it works (technical)
The script computes a local daily timestamp using the user’s UTC offset. A day change finalizes the prior day, writes its high, low, start and end indices, and records the bar indices of the terminal high and low.
For each weekday, it maintains a running average of realized ranges with a cap on the lookback count. The ghost projection length is the weekday average scaled by the user’s percentage setting.
Anchor selection for the ghost uses the most recent extreme and the close relative to the intraday midpoint to choose a low-anchored or high-anchored box.
A five-column table (Day, High, Low, Range, Ghost OK) is refreshed on the last bar. The “Ghost OK” column shows per-weekday cumulative hits over totals with a percentage, calculated before including the just-finished day.
Object counts are bounded to seven days by pruning arrays and deleting old boxes and labels. Visual updates for historical objects occur on the last bar to minimize overhead. No `security()` calls are used.
Parameter Guide
UTC (+/−) — Controls local day boundaries — Default: minus five hours — Set to your venue’s local time.
Session (for Time gate) — Session string — Default: full week — (Optional) computed internally; not applied to gating.
Show 7-Day High/Low Table — Toggles the table — Default: true — Disable to reduce UI load.
Show Day Boxes in Chart — Toggles day boxes — Default: true — Disable for a cleaner chart.
Table Position — Nine-point anchor — Default: Middle Right — Move to avoid overlap.
Table Background / Text Color / Min Cell Width — Styling controls — Defaults: gray background, white text, width twelve characters.
Weekday Colors (Sun…Sat) — Row and box tints — Defaults: semi-transparent hues — Adjust for your theme.
Triangle Transparency — Marker opacity — Default: zero — Increase to fade high/low dots.
Day Label Transparency — Day name opacity — Default: zero — Increase to reduce emphasis.
Box Border Width — Box stroke width — Default: one — Increase for stronger edges.
Extend Boxes Right — Extend current box — Default: false — Useful for forward planning.
Show Average Range Ghost Box — Dashed projection — Default: true — Disable if distracting.
Ghost Border Color / Width — Ghost styling — Defaults: gray, width one.
Ghost Length percent of AvgRange — Projection scale — Default: one hundred; bounds zero to five hundred — Lower to be conservative.
Max History Days for Average — Cap per-weekday averaging — Default: two hundred fifty-two; bounds thirty to five hundred.
ATR Length / Day Label ATR Multiplier / Triangle Up ATR Multiplier / Triangle Down ATR Multiplier — Offsets for label placement — Defaults: length one hundred; multipliers zero — Increase on dense instruments to prevent overlap.
Reading & Interpretation
Day boxes: The filled rectangle marks each day’s full high-low span; color encodes the weekday.
Markers: Small dots near the terminal high and low highlight where the final extremes occurred.
Ghost box: A dashed box sized by the weekday average range, anchored based on recent behavior. It is a typical span, not a target.
Table: Row one shows “Today”. Rows below list up to six prior days. “Ghost OK” shows per-weekday cumulative hits over totals with a percentage, which reflects historical coverage quality for that weekday.
Practical Workflows & Combinations
Trend following: Use the current box plus recent boxes to read expansion or compression days; combine with basic structure such as higher-highs and higher-lows or lower-lows and lower-highs for confirmation.
Exits and risk: When price nears the ghost boundary late in the session, consider managing exposure more conservatively.
Multi-asset and multi-timeframe: Works on minute charts. As a starting point, use five to less than sixty minutes. For cross-checks, pair with a higher timeframe bias filter.
Behavior, Constraints & Performance
Repaint/confirmation: The indicator updates intraday; extremes and ghost position can move while the day is open. Values are finalized on the next local day start.
HTF/security: None used; repaint risk is limited to live-bar movement.
Resources: `max_bars_back` five thousand; arrays are pruned to seven days; the table and color sync run on the last bar; the live ghost updates only in real time.
Known limits: Weekday averages can be unrepresentative during regime shifts, events, or gaps. Day boundaries depend on the UTC offset being set correctly. No alerts are included. The script displays warning labels when the timeframe is below five minutes or at sixty minutes and above.
Sensible Defaults & Quick Tuning
Start with the defaults.
Ghost too aggressive: Lower the percent scale.
Labels overlap: Increase ATR multipliers.
Clutter or performance issues: Hide the table or boxes, or disable the ghost.
Day boundary misaligned: Adjust the UTC offset to your market.
What this indicator is—and isn’t
This is a visualization and context layer for daily extremes and a weekday-based typical span. It does not predict direction, does not manage orders, and is not a complete trading system. Use it alongside market structure, risk controls, and position management.
Disclaimer
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Do not use this indicator on Heikin-Ashi, Renko, Kagi, Point-and-Figure, or Range charts, as these chart types can produce unrealistic results for signal markers and alerts.
Best regards and happy trading
Chervolino
Summary
This indicator visualizes each trading day as a colored box and annotates the final high and low with compact markers. It maintains a rolling seven-day view and a five-column table showing day name, high, low, range, and a per-weekday projection hit statistic. A dashed “ghost” box projects a typical range for the current weekday using a running average and an adjustable scaling factor. The script is written in Pine v6, runs on the main chart (overlay true), and emphasizes stable object handling and closed-bar finalization at day boundaries.
Motivation: Why this design?
Intraday traders often need fast context for where today’s price sits relative to recent daily extremes, without switching timeframes. A simple daily high/low overlay is informative but lacks structure, sizing context, and continuity. By grouping bars into local days (configurable UTC offset), drawing explicit boxes, and projecting a weekday-typical range, the chart becomes easier to scan. The compact table gives a quick audit trail of the latest seven days while tracking how often the weekday projection would have covered the realized range.
What’s different vs. standard approaches?
Reference baseline: Plain daily high/low lines or session boxes without context.
Architecture differences:
Weekday-tinted boxes and labels for today plus up to six prior days.
Weekday average range drives a dashed projection (“ghost”) sized by a user-defined percentage.
Per-weekday hit statistics recorded as hits over totals and displayed in the table.
ATR-based vertical offsets keep labels readable.
Live updates intraday; state is finalized at the local day switch.
Practical effect: The chart shows where current price sits inside a known daily envelope, plus how “typical” the day’s movement is for this weekday, aiding expectations and planning.
How it works (technical)
The script computes a local daily timestamp using the user’s UTC offset. A day change finalizes the prior day, writes its high, low, start and end indices, and records the bar indices of the terminal high and low.
For each weekday, it maintains a running average of realized ranges with a cap on the lookback count. The ghost projection length is the weekday average scaled by the user’s percentage setting.
Anchor selection for the ghost uses the most recent extreme and the close relative to the intraday midpoint to choose a low-anchored or high-anchored box.
A five-column table (Day, High, Low, Range, Ghost OK) is refreshed on the last bar. The “Ghost OK” column shows per-weekday cumulative hits over totals with a percentage, calculated before including the just-finished day.
Object counts are bounded to seven days by pruning arrays and deleting old boxes and labels. Visual updates for historical objects occur on the last bar to minimize overhead. No `security()` calls are used.
Parameter Guide
UTC (+/−) — Controls local day boundaries — Default: minus five hours — Set to your venue’s local time.
Session (for Time gate) — Session string — Default: full week — (Optional) computed internally; not applied to gating.
Show 7-Day High/Low Table — Toggles the table — Default: true — Disable to reduce UI load.
Show Day Boxes in Chart — Toggles day boxes — Default: true — Disable for a cleaner chart.
Table Position — Nine-point anchor — Default: Middle Right — Move to avoid overlap.
Table Background / Text Color / Min Cell Width — Styling controls — Defaults: gray background, white text, width twelve characters.
Weekday Colors (Sun…Sat) — Row and box tints — Defaults: semi-transparent hues — Adjust for your theme.
Triangle Transparency — Marker opacity — Default: zero — Increase to fade high/low dots.
Day Label Transparency — Day name opacity — Default: zero — Increase to reduce emphasis.
Box Border Width — Box stroke width — Default: one — Increase for stronger edges.
Extend Boxes Right — Extend current box — Default: false — Useful for forward planning.
Show Average Range Ghost Box — Dashed projection — Default: true — Disable if distracting.
Ghost Border Color / Width — Ghost styling — Defaults: gray, width one.
Ghost Length percent of AvgRange — Projection scale — Default: one hundred; bounds zero to five hundred — Lower to be conservative.
Max History Days for Average — Cap per-weekday averaging — Default: two hundred fifty-two; bounds thirty to five hundred.
ATR Length / Day Label ATR Multiplier / Triangle Up ATR Multiplier / Triangle Down ATR Multiplier — Offsets for label placement — Defaults: length one hundred; multipliers zero — Increase on dense instruments to prevent overlap.
Reading & Interpretation
Day boxes: The filled rectangle marks each day’s full high-low span; color encodes the weekday.
Markers: Small dots near the terminal high and low highlight where the final extremes occurred.
Ghost box: A dashed box sized by the weekday average range, anchored based on recent behavior. It is a typical span, not a target.
Table: Row one shows “Today”. Rows below list up to six prior days. “Ghost OK” shows per-weekday cumulative hits over totals with a percentage, which reflects historical coverage quality for that weekday.
Practical Workflows & Combinations
Trend following: Use the current box plus recent boxes to read expansion or compression days; combine with basic structure such as higher-highs and higher-lows or lower-lows and lower-highs for confirmation.
Exits and risk: When price nears the ghost boundary late in the session, consider managing exposure more conservatively.
Multi-asset and multi-timeframe: Works on minute charts. As a starting point, use five to less than sixty minutes. For cross-checks, pair with a higher timeframe bias filter.
Behavior, Constraints & Performance
Repaint/confirmation: The indicator updates intraday; extremes and ghost position can move while the day is open. Values are finalized on the next local day start.
HTF/security: None used; repaint risk is limited to live-bar movement.
Resources: `max_bars_back` five thousand; arrays are pruned to seven days; the table and color sync run on the last bar; the live ghost updates only in real time.
Known limits: Weekday averages can be unrepresentative during regime shifts, events, or gaps. Day boundaries depend on the UTC offset being set correctly. No alerts are included. The script displays warning labels when the timeframe is below five minutes or at sixty minutes and above.
Sensible Defaults & Quick Tuning
Start with the defaults.
Ghost too aggressive: Lower the percent scale.
Labels overlap: Increase ATR multipliers.
Clutter or performance issues: Hide the table or boxes, or disable the ghost.
Day boundary misaligned: Adjust the UTC offset to your market.
What this indicator is—and isn’t
This is a visualization and context layer for daily extremes and a weekday-based typical span. It does not predict direction, does not manage orders, and is not a complete trading system. Use it alongside market structure, risk controls, and position management.
Disclaimer
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Do not use this indicator on Heikin-Ashi, Renko, Kagi, Point-and-Figure, or Range charts, as these chart types can produce unrealistic results for signal markers and alerts.
Best regards and happy trading
Chervolino
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.