Skip to content

Fix ICT indicator drawing-object churn for smoother real-time perf - #73

Draft
keag00 wants to merge 5 commits into
LewisWJackson:mainfrom
keag00:worktree-ict-perf-fixes
Draft

Fix ICT indicator drawing-object churn for smoother real-time perf#73
keag00 wants to merge 5 commits into
LewisWJackson:mainfrom
keag00:worktree-ict-perf-fixes

Conversation

@keag00

@keag00 keag00 commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • The ICT Concepts + Doji Scanner indicator was deleting and recreating (line.delete/box.delete + .new()) its Equilibrium line/premium-discount boxes, PDH/PDL/PWH/PWL lines+labels, and Asia/London/NY session H/L lines+labels on every single bar instead of only when their values actually changed — a classic Pine Script anti-pattern that churns drawing objects across the whole chart history on load and on every realtime tick. This is the most likely cause of any sluggishness/flicker on the indicator.
  • Rewired all three to create objects once and move them in place with line.set_xy1/xy2, box.set_lefttop/rightbottom, label.set_x/set_y, only actually recreating on real day/week/session rollovers (a handful of times per day instead of every bar).
  • Order Block search loops now break as soon as the nearest opposite-colour candle is found instead of scanning the full obLookback range every time, and dropped the now-unnecessary var bool obFound* flags.
  • Visual behavior is unchanged — same lines, values, and freeze-on-mitigation semantics.

Test plan

  • tv pine analyze — 0 static-analysis issues
  • tv pine check — server-side compile via TradingView, 0 errors / 0 warnings
  • Live in-app visual re-check in the Pine Editor (blocked this pass by a known Monaco-fiber-tree fragility with pine_push/pine_pull, documented in CLAUDE.md and noted in the spec doc — not caused by this change)

🤖 Generated with Claude Code

Keagan Wheaton and others added 5 commits July 14, 2026 23:18
… expand CLAUDE.md

- New Pine Script indicator (ICT Concepts + Doji Scanner) implementing swing-based
  trend bias, BOS, liquidity sweeps, FVGs, order blocks, equilibrium zones, and the
  8 requested doji pattern variants, with a living spec in ICT_STRATEGY_SPEC.md
- Fix pine_push.js/pine_pull.js picking a stale hidden Monaco editor instance
  instead of the live one, which caused silent "Could not inject" failures
- Expand CLAUDE.md with a Development section (test commands, core/tools/cli
  architecture, known fragility) alongside the existing tool-usage decision tree
- Update rules.json to the current 4H EMA-ribbon crypto strategy

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
for j = array.size(x) - 1 to 0 iterates ascending (not descending) when
the array is empty, since -1 <= 0 — causing array.get(x, -1) on a
size-0 array. Guard each of the 4 mitigation loops with
array.size(x) > 0 before entering. Was silently killing all indicator
output (bias table, BOS/FVG/OB/doji markers) whenever any of the four
box arrays emptied out.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…repaint fix

Confirmed swing/BOS/FVG detection is structurally lagged (pivots need
swingLen bars of confirmation) or had a latent bug where live intrabar
price could fire a one-shot line/box-creation condition more than once
per bar, stacking duplicates. Added bar_index one-shot guards and a
lag-free live (unconfirmed) swing high/low + live BOS layer that reacts
every tick.
Non-repainting previous day/week high-low via request.security with a
[1]-lagged D/W series, plus running session highs/lows that freeze and
extend right once each session ends until its next occurrence resets
them. All toggleable, all on by default per Keagan's "always on chart"
ask.
…ormance

EQ line/boxes, PDH/PDL/PWH/PWL, and session H/L lines/labels were being
deleted and recreated from scratch on every single bar instead of moved
in place, causing unnecessary object churn across chart history and on
every realtime tick. Switched to set_xy/set_lefttop/set_rightbottom/set_x/
set_y updates, only recreating objects on actual day/week/session
rollovers. Also added early break to the Order Block search loops.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant