Skip to content

Sequence (A then B)

Flow · Counter

Sequence (A then B) node on the canvas

True on a bar where B is true AND A was true within the last N bars — 'A happened, THEN B within N'. The ordered-confluence primitive for setups like break→retest, cross→pullback, sweep→confirmation.

Sequence enforces order: it fires on a bar where B is true and A was true within the last N bars — "A happened, then B soon after." It's the ordered-confluence primitive for multi-step setups where the sequence matters, not just that both things eventually occurred.

How it works

Two signal inputs, A and B, and a window. Each bar it checks whether B is true now and A was true on any of the previous window bars (inclusive). Only then does it output True. Order is enforced — A must precede B; B firing without a recent A does nothing. Lookahead-free.

When to use it

Use it for staged patterns: break → retest (A = break, B = retest touch), cross → pullback, liquidity sweep → confirmation, signal → trigger. Plain And only asks "are both true on this bar," which misses setups that unfold over several bars; Sequence captures the "first this, then that, within a window" shape those setups actually have.

Example

Break-and-retest: wire a "broke resistance" signal into A and a "closed back above the level" signal into B, with window = 5. Sequence fires when the retest confirmation lands within five bars of the break — feed it into the Tester as the entry.

Tips & gotchas

  • Order matters — A must come first; swapping A and B changes the meaning.
  • Window is the patience — how many bars B has to show up after A.
  • A within the window includes the current bar, so simultaneous A+B also fires.
  • Both inputs must be signals.

Inputs

Socket Type What to wire in
A (first) signal The condition that must happen FIRST.
B (then) signal The condition that confirms, within N bars after A.

Outputs

Output Type Plots as Description
A→B signal Signal arrows B true with A within the last N bars.

Parameters

Parameter Type Default What it does
Within (bars) number · 1–500 5 How many bars after A that B still counts.

Reference auto-generated from the block catalog · category Flow.