PROTECTED SOURCE SCRIPT

Mark 4H Candle Span

126
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.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.