Tool
Logic
logic.boolean
Inputs
The first true/false signal — for example a trend filter or a crossover trigger.
The second true/false signal (ignored in ‘not’ mode) — for example a momentum or session filter.
Outputs
A true/false line carrying the result of the chosen gate, one value per bar.
Logic combines true/false signals with a single gate. It’s the glue for conditions: require both, allow either, demand exactly one, or simply flip a signal — controlled by the mode picker.
How it works
Wire one or two boolean inputs (a and b) and choose a mode. ‘and’ is true only when both are true; ‘or’ is true when at least one is; ‘xor’ is true when exactly one is; ‘not’ ignores b and inverts a. The mode picker greys out the second input when you select ‘not’.
Modes
True only when both a and b are true.
When to use: Require every condition at once, e.g. trend up AND momentum up before entering.
True when at least one of a or b is true.
When to use: Accept any of several setups, e.g. fire on a breakout OR a pullback signal.
True when exactly one of a or b is true, but not both.
When to use: Want a single side active at a time, e.g. long OR short signal but never both together.
Inverts a — true becomes false and false becomes true; input b is ignored.
When to use: Block on a condition, e.g. enter only when a ‘news window’ flag is NOT set.
Configuration
Which logic gate to apply: ‘and’ needs both inputs true, ‘or’ needs at least one, ‘xor’ needs exactly one, and ‘not’ inverts input a (ignoring b).
Connects to
Examples
- Set mode to and and wire a trend-up flag into a and a momentum-up flag into b to enter only when both agree.
- Set mode to not and feed a ‘news ceasefire’ flag into a to block entries during scheduled news.
Common mistakes
- Leaving an unwired b input in or/and mode, so the gate sees a default that quietly changes the result.
- Reaching for xor when you meant or — xor turns off when both are true, which can silently drop your strongest setups.