AND
AND in ProBuilder is a logical operator that combines conditions and returns true only when every operand is true. Syntax, precedence and examples.
Syntax
condition1 AND condition2How it works
AND evaluates the conditions on either side and returns true only if both are true. Chaining more conditions with further AND operators tightens the test further, since every linked condition must hold for the result to be true.
Operator precedence matters when AND, OR, and NOT appear in the same expression. NOT binds tightest, then AND, then OR. So a OR b AND c is read as a OR (b AND c). When the intended grouping is not obvious, wrap the parts in parentheses. It makes the logic explicit and removes any doubt about how the expression is parsed.
AND works the same way across ProBuilder indicators, ProScreener, ProBacktest, and ProOrder, because all four evaluate boolean expressions with the same rules.
Examples
Example 1, Two conditions in an indicator (Indicator)
// RSI crossing above 50 from below on this bar
myRSIvalue = RSI[14](close)
myValueCondition = 50
IF (myRSIvalue > myValueCondition AND myRSIvalue[1] < myValueCondition) THEN
signal = 1
ELSE
signal = 0
ENDIF
RETURN signalThis is the pattern from the official reference. The signal fires only when the current RSI is above 50 and the previous RSI was below it, so both parts of the AND must be true on the same bar.
Example 2, Filtering with several criteria (ProScreener)
// Uptrend with volume confirmation
trendUp = close > Average[200](close)
volumeUp = Volume > Average[20](Volume)
cond = trendUp AND volumeUp
SCREENER[cond]The screener returns only instruments where price sits above its 200-period average and volume is above its 20-period average. Both conditions are required.
Example 3, Guarding an entry (ProOrder)
DEFPARAM CumulateOrders = false
// Enter long only when flat and the setup holds
IF NOT LongOnMarket AND close CROSSES OVER Average[50](close) THEN
BUY 1 CONTRACT AT MARKET
ENDIFThe entry is allowed only when there is no open long position and price crosses above the 50-period average. Combining a position guard with a signal is one of the most common uses of AND.
Common errors and gotchas
- Precedence with OR.
a AND b OR cis parsed as(a AND b) OR c, which is often not what was meant. Add parentheses to state the grouping you want. - AND is not bitwise. ProBuilder has no separate bitwise operator.
ANDalways works on boolean conditions, not on numbers treated as bit patterns. - Comparing before combining. Each side of
ANDmust itself be a condition.close AND high > lowis invalid becausecloseon its own is a value, not a boolean. Write a full comparison such asclose > open AND high > low. - Over-tightening a filter. Every added
ANDcondition can only reduce the number of matches. A screener that returns nothing often has one condition too many.
