Flow¶
Route and gate logic — branch, latch, and control when conditions fire.
- Bar Count — Count bars since the start, or since the optional
resetsignal last fired. Output is a SERIES of integer counts (0-based — bar of reset is 0, the next bar is 1, etc.). Useful for 'bars since entry', 'bars since session start', anything time-since-event. - Cooldown — Allow the input signal to fire, then suppress it for N bars before allowing another fire. Prevents revenge entries — 'don't take another long for 20 bars after the last entry/stop-out'.
- If / Then / Else — Per-bar branching: when
conditionis true, emitif_true's value; otherwise emitif_false's. The visual equivalent ofcondition ? a : b. Bars whereconditionis missing emit NaN — engine treats as 'no value'. - Latch — SR-flip-flop: once
setfires true, output stays true untilresetfires. If both fire on the same bar, reset wins (safe default — 'reset has priority' avoids stuck-on bugs). Useful for 'arm a trade after structural break, hold the green light until the break is invalidated'. - Persistence — True at bar i only if the input signal has been true for ALL of the last N bars. Filters out flickering signals — 'RSI > 70 for 3 consecutive bars' instead of any single bar's spike.
- Pulse — Emit
trueonly on bars where the input transitions fromfalsetotrue— fires once per crossing instead of every bar the condition stays true. Essential for entry signals (otherwise 'RSI > 70' fires N times in a row and the engine tries to open N positions).