Conditions
Boolean logic that determines when a strategy executes.
Conditions
A condition is a boolean expression that evaluates to either true or false. Conditions determine when a strategy's action should execute.
Base Conditions
The simplest condition is a BaseCondition. It compares two indicators using a comparator:
[Left Indicator] [Comparator] [Right Indicator]
RSI(AAPL, 14) < 30
Available Comparators
| Comparator |
Symbol |
Example |
| Greater than |
> |
Price > SMA(50) |
| Less than |
< |
RSI(14) < 30 |
| Greater than or equal |
>= |
Volume >= 1,000,000 |
| Less than or equal |
<= |
Price <= $100 |
| Equal to |
= |
Day = 1 (Monday) |
| Not equal to |
≠ |
Asset Type ≠ ETF |
Additional comparators: NexusTrade also supports Crosses above (triggers only at the moment of crossover), Crosses below, Percent above, and Percent below comparators for specialized use cases.
"Crosses" Conditions
The crosses above and crosses below comparators are special. They only evaluate to true at the exact moment the crossover occurs, not while one indicator remains above/below the other. This is useful for detecting trend changes.
Compound Conditions
A CompoundCondition combines two or more conditions using boolean logic:
AND Conditions
All sub-conditions must be true for the compound condition to be true.
AND
├── RSI(AAPL, 14) < 30 ← Must be true
└── SMA(AAPL, 50) > Price ← Must also be true
OR Conditions
At least one sub-condition must be true.
OR
├── RSI(AAPL, 14) < 20 ← If this is true, OR is true
└── Price < SMA(AAPL, 200) ← OR if this is true, OR is true
Nesting
Compound conditions can be nested to express complex logic:
AND
├── OR
│ ├── RSI(AAPL, 14) < 30
│ └── RSI(AAPL, 14) crosses below 35
└── SMA(AAPL, 50) > SMA(AAPL, 200)
This means: "Buy when RSI is below 30 OR RSI just crossed below 35, AND the 50-day SMA is above the 200-day SMA."
Always True / Always False
The simplest conditions are Always True and Always False:
- Always True: The strategy action executes on every evaluation (e.g., a dollar-cost averaging strategy that buys every day).
- Always False: The strategy never executes. Useful for temporarily disabling a strategy without deleting it.