Predicta V4: AI-Confluence Indicator from a Visual Clone
A client's screenshot replica turned into a working Pine v6 confluence indicator, verified on BTC and Nifty, with two silent Pine state traps documented.
Seven-part modular source assembled by concatenation, indicator-only by my order, warm-up gating with nz() to kill phantom first-bar signals, setup expiry and cooldown to stop one setup monopolising the engine, 33 and 6 signals verified without runtime errors.

- Modular seven-part source with offline compile gate
- na-boolean and latching-state traps found and fixed
- Verified on two markets with per-bar data-window readback
- Scope deliberately kept to an indicator, not a strategy
The brief was a static "visual clone" of a commercial confluence indicator; the job was to make it real. The source is split into seven numbered parts and concatenated at build time, compiled with an offline checker before every push. Scope was deliberately limited to an indicator: no strategy calls and no equity-curve dashboard, only a current-bias and active-settings overview.
Two bugs that the compiler cannot catch cost a full debugging cycle each and are now reusable knowledge. First, na booleans are not false: during warm-up a gate built on an unseeded indicator is na, and a ternary on it resolves to the else branch, which fired a phantom short on bar zero. The fix is nz() inside the scoring helper, an explicit data-ready gate, and resolving direction into an integer before any branch. Second, a latching one-setup-at-a-time state machine held its direction flag for 1,809 bars and silently suppressed every later signal; the gate opened 71 times and produced nothing. Any such machine needs a bar-based expiry, a cooldown and an allow-reversal flag.
The diagnostic method (plot internals to the data window and read them back per bar) was used to verify the final build on BTC hourly and Nifty 15-minute with no runtime errors.
How it works
- Edit numbered parts and concatenate into one script
- Offline compile check before pushing to the chart
- Scoring helper computes confluence with warm-up gating
- Setup state machine applies expiry, cooldown and reversal rules
- Internals plotted to the data window for per-bar verification
Software and automation are infrastructure, not financial advice. No performance guarantees. Every live system needs staged testing, risk limits, and owner approval.