Trade Filter
The Trade Filter rule selects specific trades from a larger list based on a wide range of configurable criteria. It acts as a powerful search and selection tool, allowing your strategy to isolate and act upon trades with particular characteristics such as direction, order type, profitability, or price levels.
How It Works
The Trade Filter rule takes a list of trade IDs as input and applies a series of filters to identify which trades meet your specified conditions. At the most basic level, you can filter trades based on whether they are open positions or pending orders, their direction (buy or sell), and for pending orders, the specific order type (limit, stop, market, stop limit, or limit stop).
For more advanced filtering, enable the criteria option to apply conditions to specific trade attributes. For open positions, you can filter based on profit (in currency or pips), entry price, or the current stop loss or take profit price. For pending orders, you can filter based on the target entry price or the distance of the order from the current market price. The rule can find the single trade with the highest or lowest value for a given criterion, or find all trades that meet a condition using comparison operators.
The execution mode controls how many trades are output. "Single Or None" proceeds only if exactly one trade matches. "Single" outputs the first matching trade. "All Matches" outputs every trade that meets the criteria. The match type setting further controls whether a trade can be matched multiple times or only up to a specified count, preventing the same trade from being processed repeatedly.
Inputs
| Parameter | Description | Required | Default |
|---|---|---|---|
| Trade Id(s) | The initial list of trade IDs to be filtered. All subsequent filter criteria are applied to this list. | Yes | — |
| Execute On | Determines how many of the matching trades should be output. Options: Single Or None (proceeds only if exactly one trade matches), Single (outputs the first matching trade), All Matches (outputs every matching trade). | Yes | — |
| Match Type | Controls whether the filter is applied to all trades every time or limited. Options: Every time (applies to all trades on every run), Up to count (a trade will only be matched a specified number of times). | Yes | — |
| Match Count | The maximum number of times a trade can be matched when Match Type is set to "Up to count". | No | — |
| Filter | The primary category for filtering. Options: Order (filters only pending orders), Position (filters only open positions). | Yes | — |
| Side | The direction of the trade to filter by. Options: Sell, Buy, Any. | Yes | — |
| Order Type | The type of pending order to filter by. Options: Stop, Limit, Market, Stop Limit, Limit Stop, Any. Only applicable when filtering orders. | No | — |
| With Criteria | Enables or disables advanced filtering criteria. When enabled, additional fields for Filter By, Filter On, Operator, and target values become available. | Yes | false |
| Filter By | The method for applying the advanced filter criteria. Options: Highest (finds the single trade with the highest value), Lowest (finds the single trade with the lowest value), Condition (finds all trades that meet a specific condition). Shown when With Criteria is enabled. | No | — |
| Filter On | The specific trade attribute to evaluate. For positions: Profit, Entry Price, Stop Loss Price, Take Profit Price, Profit Pips, Risk Amount, Risk Pips. For orders: Distance, Target Entry Price, Stop Loss Price, Take Profit Price. Shown when With Criteria is enabled. | No | — |
| Operator | The comparison operator for the filter condition. Options: Greater Than, Greater Than or Equal, Less Than, Less Than or Equal, Equal, Not Equal. Shown when Filter By is set to Condition. | No | — |
| Target Amount | The monetary value to compare against when filtering by profit or risk amount. | No | — |
| Target Pips | The pip value to compare against when filtering by profit pips, risk pips, or distance. | No | — |
| Target Price | The price level to compare against when filtering by entry price, stop loss price, or take profit price. | No | — |
Outputs
| Output | Description |
|---|---|
| Filtered Trade Id(s) | The list of trade IDs that matched all of the filter criteria. The number of IDs returned depends on the Execute On setting. |
| Filtered Trade Id Count | The total number of trades that matched the filter criteria. Useful for conditional logic or verifying expected results downstream. |
Tips
Use "Single Or None" when you need to ensure that exactly one trade matches before proceeding — this prevents unintended actions when multiple trades qualify. If you want to find the most or least profitable trade, enable criteria and use the Highest or Lowest filter mode on the Profit attribute rather than manually comparing values with other rules.
Was this helpful? Let us know