Logic Node

The Logic node joins conditions with AND or OR, two to five at a time. How the two read in a strategy, why an Entry takes a single condition, and the combinations that can never fire.

NodeBy AlgoLiftUpdated 4 min read
On this page 6How it worksExample: buy dips in an uptrend, mornings onlySettingsUse something else whenWhen it doesn't behaveGoing further

A real entry rule is rarely one condition. It's a signal, plus a trend filter, plus the right time of day. The Logic node turns several conditions into one: AND is true when all of them are, OR when any of them is.

Takes
Two to five conditions, a to e
Gives
One true or false
Reach for it
Several conditions have to become one signal

How it works

In trading terms, AND is a checklist and OR is a list of reasons. "RSI under 30 AND price above the 200 EMA" buys a dip only inside an uptrend, because both have to hold at the same moment. "RSI over 70 OR price under the 20 EMA", wired into an exit, closes the trade for whichever reason turns up first.

You choose AND or OR when you add the node; the palette has one of each. It starts with two inputs, and the + and − on the node take it up to five. Wire them in order (a, b, c) with no gaps, because the builder refuses a skipped input.

The node exists for a plain reason: an Entry's condition takes exactly one wire. Drag a second condition onto it and the new wire replaces the old one, which is easy to miss on a busy canvas. So combining conditions always goes through Logic, or through a Tally when you'd rather count them.

A condition that can't be judged yet, like a comparison against an indicator that's still warming up, counts as false. An AND waits for it. An OR carries on without it.

To mix the two, nest them: "(A AND B) OR C" is an AND wired into one input of an OR. For more than five conditions, chain two ANDs, or use a Tally set to At Least N with N equal to the number of conditions. A Tally takes up to twenty.

Example: buy dips in an uptrend, mornings only

You trade ES 5m, and the idea is three conditions long: RSI(14) under 30, price above the 200-period EMA, and only between 09:30 and 11:30.

Build each condition first. A Comparison of RSI against a Constant of 30, set to Less Than. A second Comparison of Current Price against an EMA with Period 200, set to Greater Than. A Time Window, Between 09:30 and 11:30. Then add an AND, press + once for a third input, wire the three into a, b and c, and wire the AND into the Entry's condition.

Exits work the same way with OR. Wire "RSI above 70" and "price under the 20 EMA" into an OR, the OR into a Set Exit Condition, and the trade closes on whichever happens first.

Settings

Operation
Default AND
AND (every input true) or OR (any input true). It's set when you add the node: pick AND or OR from the palette.
Inputs
Default 2
From 2 to 5, wired a, b, c and so on, in order.

Use something else when

Enough of the conditions should hold, not all or one
"Any 3 of these 5" is a Tally with At Least 3. It can also weight the conditions you trust more.
A condition should be false
NOT flips one condition. Often a Comparison facing the other way reads more clearly.
NOT
One event should follow another
Two one-bar events in an AND only fire when both land on the same bar. A Since turns the first into "within the last N bars".

When it doesn't behave

My second condition disappeared

You wired it straight into the Entry, which already had a condition, and the new wire replaced the old one. Every input in AlgoLift takes one wire. Put an AND between the two conditions and the Entry.

An AND of two crossovers almost never fires

A Crossover is true on the one bar it happens, so an AND of two crossovers needs both on exactly the same bar. If you meant "EMA 20 crosses above EMA 50, then RSI crosses above 50 within a few bars", read the first one through a Since and compare its bars-since with a number. The Inspector's checks point this out when they see it.

The Inspector says it never enters

Two conditions in the AND can't both be true, like RSI under 30 and RSI over 50, or a Time Window that never overlaps the run's trading hours. The Inspector's checks name the pair. Fix whichever one you didn't mean.

Going further

The Inspector's meters count how many bars each condition of an AND holds on by itself, then how often they all hold together, and the line where the count runs out turns amber. It's the fastest way to find the condition doing all the filtering, or none of it.

Stacking is cheap on the canvas and expensive in the results. Five conditions that each pass half the bars, if they were unrelated, would leave about one bar in thirty, and a backtest with a few dozen trades can't tell an edge from luck. Every condition you add should be one you'd defend before seeing what it does to the equity curve.

Or ask the copilot