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
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.