Custom Expressions
Build complex logic beyond preset conditions
Expressions Editor
The expressions editor lets you create complex trading conditions that go beyond simple preset rules. Use it when you need custom logic that combines multiple factors or calculations.

When to Use Expressions
- "(profit >= $50 AND time >= 60 minutes) OR loss >= $200"
- "Close when position delta is within 10% of being neutral"
- "Exit if current P&L drops more than 50% from the peak"
How the Editor Works
The expressions editor uses building blocks that you combine to create your condition:
Main Components
Condition Groups: Combine multiple conditions with AND/OR logic
- Click the "+ condition" button to add more conditions
- Click the "+ group" button to add a new condition group
- Clicking on condition group badge toggles between AND/OR logic
- Choose "All of is true" when all conditions must be true
- Choose "Any of is true" when any condition can trigger the rule
- You can nest condition groups
Individual Conditions: Basic comparisons like "profit >= $100"
- Left side and right side: Choose a variable, a constant or a function.
- Operator: Choose comparison (>=, <=, ==, !=, >, <) to compare left to right expressions.
Variables: References to your strategy data
- Position P&L, Greeks, time in trade
- Market data like VIX levels
- Custom calculations you create
Functions: Built-in calculations
ABS
: Absolute valueMIN
,MAX
: Minimum/maximum values- Math operations:
SUM
,DIFF
,PROD
,DIV
NEG
to make the expression negative
You can nest functions.
Constants: Numbers or logical

Expression Preview: See your condition in plain English as you build it
Tips for Using Expressions
Start Simple
Begin with basic conditions and add complexity gradually:
- Create a simple profit target first
- Test it to make sure it works
- Add additional conditions using AND/OR logic
Validation and Errors
The expressions editor validates your condition and shows helpful error messages:
- Empty groups: All condition groups must have at least one condition
- Placeholder variables: Replace all "Choose..." dropdowns before saving
- Type mismatches: Make sure you're comparing numbers to numbers, booleans to booleans
- Invalid numbers: Values must be reasonable (not infinity or extremely large)
When to Use Simple Rules vs Expressions
Use Simple Rules When:
- Basic profit/loss targets
- Standard time-based exits
- Simple Greek thresholds
- Market hour restrictions
Use Expressions When:
- Combining multiple conditions with AND/OR logic
- Using mathematical functions (abs, min, max)
- Creating custom calculations
- Building complex trailing stops or dynamic targets
Need Help?
If you're struggling with expressions:
- Start with simple rules first to learn the basics
- Use the tutorial to understand each component
- Check the expression preview to verify your logic
Using Expressions Examples
Basic Variable Usage



Advanced Calculations



Multi-Leg Analysis


Market Context Integration


Next Steps
Ready to dive deeper? Explore these related topics:
- Rules Overview - Use expressions in entry and management rules
- Expression Variables - Complete reference of all available variables
- Roll Leg Action - Use expressions for advanced position rolling
- Conditions List - Compare expressions with preset conditions