Boolean
The Boolean node applies a bitwise-style logic gate element-by-element across two aligned signal arrays. Both inputs are treated as boolean — any non-zero value is true. The second input can be replaced by a fixed numeric constant via useNumericB. Null in either input propagates null to the output.
Operations
| Operation | Output is 1 when | Typical use |
|---|---|---|
| AND | Both A and B are non-zero | Require two conditions simultaneously |
| OR | At least one of A or B is non-zero | Fire on any matching signal |
| XOR | Exactly one of A or B is non-zero | Detect disagreement between two signals |
| NAND | NOT (A AND B) — false only when both are 1 | Block when both signals are active |
| NOR | Neither A nor B is non-zero | Detect combined inactivity |
| XNOR | A and B have the same boolean value | Detect agreement between two signals |
Algorithm
- ▸Each value is cast to boolean:
val !== 0→ true,val === 0→ false - ▸The selected gate is applied to the boolean pair at each index
- ▸Result is converted back: true → 1, false → 0
- ▸If either operand is
nullorundefined, the output isnull - ▸Arrays are aligned by length — the shorter array determines the output length
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| operation | string | and | One of: and, or, xor, nand, nor, xnor |
| useNumericB | boolean | false | When true, uses numericB as a constant for Input B instead of the second port connection. Disconnects any existing Input B edge. |
| numericB | number | 0 | Constant value for Input B when useNumericB is enabled. Treated as boolean: 0 = false, non-zero = true. |
Inputs & Outputs
| Port | Type | Description |
|---|---|---|
| Inputs | ||
| input1 | (number | null)[] | Input A — primary signal array |
| input2 | (number | null)[] | Input B — secondary signal array (ignored when useNumericB is true) |
| Outputs | ||
| values | (number | null)[] | 0 or 1 at each bar — result of the selected gate. null where either input was null. |
| timestamps | number[] | Bar timestamps (UNIX ms), aligned 1-to-1 with values |
Use Cases
Multi-condition entry (AND)
Connect RSI-oversold signal and price-above-SMA signal into an AND gate. The strategy only fires when both conditions are simultaneously true, reducing false entries.
Alternative signals (OR)
Combine a MACD crossover signal and a Stochastic oversold signal with OR. The strategy triggers on whichever signal fires first, increasing opportunity frequency.
Conflict detection (XOR)
Feed a long signal and a short signal into XOR. The output is 1 only when exactly one direction is active — use it to detect clean directional bias with no conflicting signals.