Rule-Based Trading
Turn a trading idea into an observable decision system with eligibility, context, triggers, invalidation, risk and no-trade rules. The goal is a playbook that can be executed consistently, tested and improved.

Rule-Based Trading: Turn Trading Ideas Into Testable Decisions
Rule-based trading replaces vague intentions with observable conditions. It does not require full automation: a discretionary trader can use rules to define when a setup is eligible, what confirms it, where it fails, and how risk is handled.
Educational information only. Futures involve substantial risk and leverage.
What makes a rule useful?
A useful rule is observable, specific, available at decision time, and testable. “Buy when the market looks strong” is not enough. A better rule defines what “strong” means and which conditions are mandatory.
Separate requirements from supporting evidence. Otherwise a long checklist can become a way to rationalize any trade.
Build a rule hierarchy
A practical hierarchy is:
- Eligibility: instrument, session, event restrictions.
- Context: trend/balance, volatility, location, market state.
- Setup: the pattern that makes a trade interesting.
- Trigger: the event that permits entry.
- Invalidation: what proves the thesis wrong.
- Risk: size, maximum loss, correlated exposure.
- Management: permitted stop/target/partial actions.
- Exit: objective termination conditions.
- Review: fields required for later evaluation.
The hierarchy prevents a trigger from overriding a failed context or risk rule.
Think in states
Many strategies are easier to express as a state machine:
inactive → eligible → armed → triggered/in trade → managed → closed/cancelled
Each transition should have explicit conditions. This matters for humans and software because it prevents contradictory states—for example, treating a cancelled pre-entry setup as pending again.
Rule Precedence and Conflict Resolution
Rules can conflict. Decide which wins before trading.
A risk stop should generally not be overridden by a weaker confirmation. An event restriction may invalidate an otherwise good setup. A stale-data condition may block automation regardless of signal quality.
Document precedence so the strategy behaves consistently.
Decide precedence before trading. Risk and safety constraints should be independent of strategy enthusiasm. If a stale-data guard says the market state is unknown, a strong setup score should not override it. Likewise, a cancellation should be terminal unless a new setup instance is explicitly created.
Rules can conflict. A long trigger may occur while a risk veto is active. A management rule may request a new order after the system has entered an exit state. Write precedence explicitly: system safety → risk veto → eligibility → trigger → management is one possible hierarchy.
For automation, represent this as a state machine rather than a pile of independent if statements. The Trading Automation Explained guide covers state transitions, idempotency and reconciliation.
Use measurable variables
Good rules reference data you can record: price relative to VWAP, a defined session high/low, volume-profile location, delta behavior, volatility state, or a precisely described reclaim.
Avoid terms such as “nice,” “clean,” or “strong” unless they are translated into observable criteria.
Discretion can still be rule-governed
A rule-based process can include human judgment. Define where discretion is allowed, what evidence may be considered, and what cannot be overridden.
This makes discretionary decisions reviewable rather than invisible.
Test one version at a time
Give strategy versions explicit identifiers. When rules change, record the effective date/version instead of mixing results from materially different logic.
Without versioning, performance statistics can describe several different strategies at once.
Exceptions are expensive
Every exception increases complexity and makes testing harder. If an exception is necessary, define it as a rule and collect enough observations to evaluate it.
Repeated “one-time” exceptions are usually a sign that the base rule is incomplete.
From rules to automation
Before automating, define:
- data freshness requirements;
- duplicate-order protection;
- idempotent event handling;
- reconnect behavior;
- broker/position reconciliation;
- maximum order size;
- kill switch;
- cancellation rules;
- logging and audit trail.
Automation should execute known logic; it should not conceal ambiguity.
Reviewing rule adherence
Tag every trade as compliant, non-compliant, or ambiguous. Then separate strategy performance from execution discipline.
A losing compliant trade can be valid evidence. A profitable rule violation should not automatically be treated as proof that the violation was correct.
Rules Versus Indicators
A rule is a decision condition; an indicator is an input. “RSI is 55” is data. “A long setup is eligible only when RSI is above a defined threshold and all higher-priority context conditions are valid” is a rule. Keeping that distinction clear makes strategies easier to test and prevents indicators from becoming unexplained signals.
Required, Supporting and Veto Conditions
Classify conditions. Required conditions must be true. Supporting evidence can strengthen context without being mandatory. Veto conditions cancel eligibility even when the setup otherwise looks attractive. This hierarchy prevents traders from counting five weak confirmations as permission to ignore one critical invalidation.
A Complete Rule Example
A hypothetical VWAP-reclaim playbook might define: session eligibility; price must first trade below VWAP; a close back above establishes the reclaim; entry requires a subsequent hold; invalidation occurs on predefined acceptance back below; size comes from the stop distance; scheduled-event rules can veto entry. The example is intentionally structural rather than a recommendation. Every term still needs a measurable definition.
State Machines
Representing a setup as inactive → eligible → armed → triggered → in trade → closed/cancelled clarifies which transitions are legal. Store the reason and timestamp for each transition. This prevents delayed retries or old observations from moving a newer state backward.
Version Control for Strategies
Assign every material rule set a version. Record the version with each trade and never rewrite historical trades to match today's logic. When a threshold changes, results before and after the change belong to different strategy versions. This is the trading equivalent of reproducible software releases.
How to Test a Rule
For every condition ask: can it be calculated using only decision-time information? Does removing it materially change unseen results? Is the effect stable across reasonable thresholds? Does it improve net outcomes after costs or merely reduce trade count? These questions connect rule design to Backtesting and Forward Testing.
External Standards for Automated Rules
The CFTC provides foundational futures-risk education. For algorithmic systems, CME Globex risk-management resources are useful starting points for understanding exchange-side mechanics and controls. Rules that eventually influence execution need operational safeguards in addition to strategy logic.
Turning Rules Into TensorAlgo Playbooks
TensorAlgo's current Playbook model is explicitly user-defined: setup, filters, invalidation, risk rules and no-trade criteria remain visible and reviewable. The Support Center documents the current workflow. That makes Playbooks a natural destination for a rule set after the research is done, while the user remains responsible for the strategy and trading decisions.
From Idea to Boolean Logic
Rewrite each sentence as a condition that can be true, false or explicitly unknown. 'Good trend' becomes a defined market-state rule; 'near VWAP' becomes a measurable distance. Unknown should not silently become false or true—missing data is its own state.
Time Windows
Rules need clocks. Define session timezone, lookback window, bar-close versus intrabar evaluation and how long an armed setup remains valid. Without time boundaries, the same written rule can produce different trades across platforms or implementations.
Cancellation Rules
Specify what cancels a setup before entry: bias flip, level failure, event window, stale data, timeout or competing position. Cancellation should record a reason and normally be terminal for that setup instance, preventing old retries from reviving it.
No-Trade Rules
A mature playbook describes absence as carefully as action. Examples include excessive spread, insufficient risk capacity, unsupported session, nearby scheduled event or incomplete context. No-trade conditions reduce the pressure to reinterpret every market state as an opportunity.
Management Rules
Define whether stops can move, when partials are permitted, whether targets are fixed or conditional and how time-based exits work. If discretion is allowed, name its boundaries. Post-entry improvisation otherwise creates a different strategy on every trade.
Risk as a Separate Layer
The strategy can propose an opportunity; risk determines whether it is allowed. Quantity, daily loss capacity, correlated exposure and operational health should be checked independently. Read Position Sizing for translating invalidation into contracts.
Testing Rule Contribution
Remove one condition and rerun the evaluation. If results barely change, the rule may be redundant. If trade count collapses, assess whether the condition is genuinely selective or simply over-specific. Ablation makes complicated playbooks easier to justify.
Ambiguous Rules
Maintain an 'ambiguous' classification during review. Forcing unclear historical examples into pass/fail labels teaches the strategy false precision. Ambiguity is a signal that the written definition needs refinement before the next version.
Rule Documentation Template
For each rule store name, purpose, exact calculation, required inputs, evaluation frequency, priority, failure behavior and examples. This makes manual training, backtesting and automation use the same vocabulary.
Governance
Material rule changes should be proposed, tested, versioned and dated. Keep a changelog explaining why each change was made and what evidence supported it. This prevents the current playbook from becoming an undocumented accumulation of exceptions.
Manual Execution Checklist
Before acting, confirm market/session, playbook version, context, trigger, invalidation, quantity, no-trade filters and remaining risk. A short checklist is valuable because it moves repeated decisions out of working memory.
Related Guides
Continue with Trading Automation Explained if rules will drive software, and Building a Professional Trading Workflow for integrating playbooks into the full session.
Rule Quality Test
A strong rule has a clear purpose, measurable inputs, defined evaluation time and predictable behavior when data is missing. If two reasonable readers implement it differently, the wording is not finished.
Hierarchy Example
Imagine context says balance, setup says breakout, trigger fires, but a scheduled-event veto is active. The veto wins because precedence was decided beforehand. Without hierarchy, traders can selectively emphasize whichever condition supports the action they already want.
Unknown States
Real systems encounter missing data. Model unknown explicitly. If VWAP is unavailable, the condition is not automatically 'VWAP filter passed.' Failing closed on required evidence prevents outages from masquerading as valid setups.
Rule Metrics
Measure eligibility count, trigger rate, cancellation reasons, trades taken, adherence and outcome. A rule that cancels 95% of setups should be investigated for both benefit and lost opportunity.
From Discretion to Data
When judgment matters, create a small controlled vocabulary and examples. Over time, compare discretionary classifications with outcomes and with other reviewers. This does not eliminate judgment; it makes judgment observable.
Playbook Review Checklist
At review time ask whether every trade used the correct version, all required conditions were present, vetoes were respected, risk matched the rule, management stayed inside permitted discretion and any ambiguity was documented.
Write Rules as Observable Conditions
A rule should tell two competent reviewers whether the same condition occurred. “Momentum looks strong” is ambiguous; “the defined fast average is above the slow average and both have risen for the specified observation window” is observable. This does not make the rule profitable—it makes it testable.
Separate rules into required conditions, supporting evidence and vetoes. Required conditions must all be true. Supporting evidence can affect ranking or confidence without silently becoming mandatory. Vetoes override eligibility, such as stale data, a prohibited event window or exhausted risk capacity.
The Trading Playbook guide is the natural starting point for named setups, while Technical Analysis vs Price Action shows how to turn visual market observations into less ambiguous language.
Version Every Material Change
If entry, stop, target, feature set, session or veto logic changes, create a new strategy version. Preserve results from the old version rather than combining them indiscriminately. This prevents “the strategy” from becoming a moving target that can never be evaluated cleanly.
The Backtesting Guide explains historical validation, and the Forward Testing Guide shows how to evaluate a frozen version on live-arriving data.
Include the No-Trade State
A complete rule set must describe when not to act. No-trade conditions can include missing data, abnormal spreads, event restrictions, insufficient risk capacity, ambiguous state or mutually conflicting signals. A system that only defines entries is incomplete.
Measure Rule Quality, Not Just Outcomes
Track how often each rule is evaluated, how often it blocks or enables a setup, and whether rules are redundant. Ablation testing—removing one condition and measuring the effect—can reveal whether a “confirmation” contributes independent information or simply reduces sample size.
The What Makes a Trading Strategy Profitable? guide provides the expectancy framework for evaluating those changes, and the Trading Journal Guide helps record adherence separately from outcome.
A Rule Template
For each playbook, document: purpose, eligible markets/sessions, required context, trigger, invalidation, initial risk, management, exit, vetoes, data dependencies and examples/non-examples. The result should be precise enough to test while still stating where human judgment remains.
Rule-based trading is not the absence of discretion. It is the decision to make important assumptions visible enough to inspect, challenge and improve.
Test Rules Individually
Unit-test deterministic rules with positive, negative and boundary cases. If a time filter ends at a specific minute, test the minute before, at and after the boundary. If a reclaim requires a close above a level, test touches that do not close above it. Boundary tests catch ambiguity before it becomes a live disagreement.
For combinations of rules, test precedence and missing-data behavior. A required feature that is unavailable should not silently become false, true or zero unless that behavior is explicitly intended.
These tests do not establish market edge. They establish that the implementation matches the written specification, which is a prerequisite for any historical or forward evidence to mean what you think it means.
Frequently Asked Questions
What is rule-based trading?
Rule-based trading defines observable conditions for eligibility, context, entry, invalidation, risk, management and no-trade states so decisions can be executed and reviewed consistently.
Does rule-based trading have to be automated?
No. A discretionary trader can use explicit rules while retaining judgment in clearly defined areas. Automation is only one possible implementation.
What makes a trading rule testable?
Its inputs must be measurable, available at decision time and precise enough that two reviewers can determine whether the condition occurred.
How often should trading rules change?
Change material rules through a versioned process supported by research or forward evidence, not because of one vivid win, loss or short streak.
Final Takeaway
Rule-based trading is not about eliminating judgment. It is about making the important assumptions, vetoes, triggers, risk limits and exceptions visible enough to execute consistently, test fairly and improve without rewriting history.
