OPEN-SOURCE SCRIPT
Bar Count (Timezone Fixed | Colorful Multiples)

Bar Count (Timezone Fixed | Colorful Multiples)
This indicator sequentially numbers each bar within a trading day, featuring two key improvements over traditional bar counters:
1. Timezone Fixed – No More Noon Reset
Uses the exchange’s timezone to detect a new trading day (time("D", syminfo.timezone)), rather than local time or calendar date. The counter resets only at the exchange’s actual session start, eliminating the common issue where numbers reset at noon due to timezone differences or lunch breaks.
2. Colorful Multiples – Highlight Key Intervals
Supports custom colors for bars at specific multiples (e.g., every 12th, 24th bar). Visual markers help you easily identify repeating cycles, important time windows, or rhythm points without manual calculation.
Input Parameters
Use Case
Ideal for intraday traders, especially those trading futures, forex, or indices with overnight sessions or lunch breaks. The timezone fix ensures accurate continuous numbering, while the color-coded multiples provide visual cues for recurring intervals.
本指标为图表上的每根 K 线按交易日顺序连续编号,并针对传统同类指标的痛点进行了两项关键改进:
1. 时区修正,告别中午重置
使用交易所时区判断新交易日(time("D", syminfo.timezone)),而非本地时间或自然日。无论图表时区如何设置,编号仅在交易所实际开盘时重置,彻底解决因午休、时区偏移导致的中午 12:00 后序号从 1 开始的错误。
2. 彩色倍数,关键节点一目了然
支持为指定倍数的 K 线(如每 12 根、每 24 根)设置独立颜色。通过直观的色彩标记,轻松识别固定周期循环(如每 12 根 K 线)、时间窗口或重要节奏点,无需额外计算。
输入参数
适用场景
日内交易者、期货、外汇、指数等有夜盘或午休的品种,确保编号连续准确;同时通过颜色区分固定周期,辅助识别关键时间节点。
This indicator sequentially numbers each bar within a trading day, featuring two key improvements over traditional bar counters:
1. Timezone Fixed – No More Noon Reset
Uses the exchange’s timezone to detect a new trading day (time("D", syminfo.timezone)), rather than local time or calendar date. The counter resets only at the exchange’s actual session start, eliminating the common issue where numbers reset at noon due to timezone differences or lunch breaks.
2. Colorful Multiples – Highlight Key Intervals
Supports custom colors for bars at specific multiples (e.g., every 12th, 24th bar). Visual markers help you easily identify repeating cycles, important time windows, or rhythm points without manual calculation.
Input Parameters
- Label Size: Text size (Auto/Huge/Large/Normal/Small/Tiny)
- Display at every X bars: Show label every X bars (set to 1 for every bar)
- Default Color: Default label color
- every N bars: The multiple interval (e.g., 12 for every 12th bar)
- N bars Color: Color for bars at the specified multiple
Use Case
Ideal for intraday traders, especially those trading futures, forex, or indices with overnight sessions or lunch breaks. The timezone fix ensures accurate continuous numbering, while the color-coded multiples provide visual cues for recurring intervals.
本指标为图表上的每根 K 线按交易日顺序连续编号,并针对传统同类指标的痛点进行了两项关键改进:
1. 时区修正,告别中午重置
使用交易所时区判断新交易日(time("D", syminfo.timezone)),而非本地时间或自然日。无论图表时区如何设置,编号仅在交易所实际开盘时重置,彻底解决因午休、时区偏移导致的中午 12:00 后序号从 1 开始的错误。
2. 彩色倍数,关键节点一目了然
支持为指定倍数的 K 线(如每 12 根、每 24 根)设置独立颜色。通过直观的色彩标记,轻松识别固定周期循环(如每 12 根 K 线)、时间窗口或重要节奏点,无需额外计算。
输入参数
- Label Size:标签文字大小(自动/特大/大/正常/小/微小)
- Display at every X bars:每 X 根 K 线显示一次编号(设为 1 则每根显示)
- Default Color:默认标签颜色
- every N bars:倍数间隔(例如 12 表示每 12 根 K 线使用特殊颜色)
- N bars Color:倍数序号的标签颜色
适用场景
日内交易者、期货、外汇、指数等有夜盘或午休的品种,确保编号连续准确;同时通过颜色区分固定周期,辅助识别关键时间节点。
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.