PROTECTED SOURCE SCRIPT
Custom Time Frame Background with High-Low

🔍 Explanation:
Custom Time Frame Calculation: Converted to minutes, then used with time("xxx") to detect new periods.
New Period Detection: Using ta.change(time("xxx")).
Track High/Low: Variables (var) keep high/low values and reset on each new period.
Background Plotting: Uses bgcolor only during defined custom time frames.
Plot High/Low Lines: Visual representation of range boundaries for each time frame.
✅ Example Use:
Set Custom Hours = 4 → The chart background alternates color every 4 hours.
Displays background and high/low range lines for each custom time period.
If you would like to extend the script further—such as showing only during specific times of day (e.g., market open/close from 9:00 to 16:00)—I can help with that as well. Just let me know.
To make your Pine Script display the background only during custom time frames and also show the high and low values of that period, we need to:
Track the high (high) and low (low) of each custom time frame
Highlight the background only during that specific period
Custom Time Frame Calculation: Converted to minutes, then used with time("xxx") to detect new periods.
New Period Detection: Using ta.change(time("xxx")).
Track High/Low: Variables (var) keep high/low values and reset on each new period.
Background Plotting: Uses bgcolor only during defined custom time frames.
Plot High/Low Lines: Visual representation of range boundaries for each time frame.
✅ Example Use:
Set Custom Hours = 4 → The chart background alternates color every 4 hours.
Displays background and high/low range lines for each custom time period.
If you would like to extend the script further—such as showing only during specific times of day (e.g., market open/close from 9:00 to 16:00)—I can help with that as well. Just let me know.
To make your Pine Script display the background only during custom time frames and also show the high and low values of that period, we need to:
Track the high (high) and low (low) of each custom time frame
Highlight the background only during that specific period
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.