PROTECTED SOURCE SCRIPT
Mark 4H Candle Span

This TradingView indicator, called "Mark 4H Candle Span", serves to **visually highlight alternating 4-hour time blocks** directly on the price chart.It does this by coloring the background of the chart for one 4-hour period and leaving the next 4-hour period uncolored, creating a pattern of vertical stripes.---### How It WorksThe code operates in two main steps:1. **Calculation of the 4-Hour Block**:The line `session_id = math.floor(time("1") / (1000 * 60 * 60 * 4))` calculates a unique identification (ID) number for each 4-hour block.* `time("1")`: Gets the current time (in milliseconds).* `(1000 * 60 * 60 * 4)`: Is the total number of milliseconds in 4 hours.* By dividing the time by the 4-hour interval and rounding down with `math.floor`, the script assigns the same `session_id` to all the candles within the same 4-hour block.2. **Background Coloring**:The line `bgcolor(session_id % 2 == 0 ? color.new(color.blue, 85) : na)` decides whether to color the background.
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.