Skip to content

Xor

Signals · Logic

Xor node on the canvas

True when an odd number of input signals are true.

Xor (exclusive or) outputs true when an odd number of its inputs are true — most usefully with two inputs, where it means "exactly one of these, but not both." It's the logic block for disagreement: fire when condition A or condition B holds, but specifically not when they both do.

How it works

The block accepts a multi-input of boolean signals and outputs true when an odd count of them is true on the bar. With two inputs this is the familiar "one or the other, not both"; with more, it's the parity (odd/even) of how many are true.

When to use it

Xor is a specialist — reach for it when "both at once" should cancel, not confirm. A practical case: two opposing signals where simultaneous firing means conflict/noise you'd rather skip, so you act only when exactly one side speaks. Another is detecting a change in agreement between two regime flags. It's far less common than And/Or, so if you're unsure, you probably want one of those — but when you need "exactly one," nothing else expresses it as cleanly.

Example

Act only on a clear single signal: feed a "bullish setup" and a "bearish setup" condition into Xor so the result is true only when exactly one of them fires — suppressing the ambiguous bars where both trip at once. Route the disambiguated signal onward and backtest in the Tester.

Tips & gotchas

  • "Exactly one" (two inputs) is the everyday meaning; more inputs = odd-count parity.
  • Both-true cancels — that's the defining behaviour versus Or.
  • It's a niche gate — if you're not sure you need exclusivity, use And/Or.
  • Pairs with Not/And to build more elaborate conflict-resolution logic.

Inputs

Socket Type What to wire in
Inputs signal Boolean signals to combine

Outputs

Output Type Plots as Description
Result signal Signal arrows Combined boolean signal

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