OPEN-SOURCE SCRIPT
Candle Numbers (last N, no bubble)

Candle Numbers (last N, no bubble) is a lightweight utility indicator that labels candles with sequential numbers to make chart analysis and discussion easier (e.g., “candle 213”, “the breakout candle”, “the pivot”). It is designed for clarity and performance: labels are text-only (no background bubble) and are drawn only for the last N bars.
What it does
Numbers the last N candles on the chart (a sliding window near the most recent bar).
Counting starts at the left edge of that window:
the leftmost bar in the window is 1
the most recent bar in the window is N (or fewer if you use stepping / limits).
Allows numbering every Nth bar to keep the chart clean.
Places numbers below each candle, with a configurable vertical offset measured in ticks.
Inputs
Bars to number (last N) (barsWindow)
Size of the numbered window (default 200).
Number every N bars (step)
1 = every bar, 2 = every second bar, 5 = every fifth bar, etc.
Text color (txtColor)
Text size (txtSizeIn)
tiny / small / normal / large
Vertical offset (ticks) (offsetTick)
Moves the label down by offsetTick * syminfo.mintick. You can use large values if needed.
Max numbers to plot (maxMarks)
Extra safeguard to control label count and performance.
How it works (implementation notes)
Labels are drawn only when barstate.islast is true (updates on the latest bar).
Previously created labels are deleted and re-created each update to avoid clutter.
Uses max_labels_count=500 plus maxMarks to stay within TradingView label limits.
Notes
This is not a trading signal indicator. It’s a chart annotation tool for analysis and manual backtesting.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.