Options & F&O · Module 35

    Building a Mechanical Trading System

    Writing your trading down until there is nothing left to decide in the moment.

    Rohit Singh
    Rohit SinghMr. Chartist
    June 7, 2026
    8 min read
    Lesson
    35
    Advanced level
    Reading time
    8 min
    3 chapters
    Practice
    2
    quiz questions and 4 FAQs

    A pilot does not decide in mid-air whether to check the fuel. There is a checklist, and it is followed every flight. The checklist exists because judgment is weakest when you are tired, excited or frightened.

    A mechanical trading system is a checklist for the market. It is a set of written rules that says when to trade, how big to trade, where to exit, and what to record. If a rule cannot be written as a clear yes or no, it is left to judgment, and judgment is where mood enters.

    This module explains how such a system is built and tested in simple steps, and what it cannot do. A written system removes some emotional mistakes, but it does not remove market risk, and it can fail when conditions change. Nothing here recommends any particular system.

    Chapter

    Discretionary or rule-based: what is the difference?

    A discretionary trader decides each trade by judgment: "the chart looks strong today". A rule-based (systematic) trader decides by a written rule: "buy only if the price closes above yesterday's high and the risk is within budget". The rule is the same every day, whatever the mood.

    Rules have a clear benefit. After three losses in a row, a person may hesitate on a valid setup or force a poor one. A written rule does not care. Rules can also be tested on past data, which judgment cannot.

    They also have costs. Rules cannot read a surprise that no rule anticipated, such as a sudden policy announcement. A system needs upkeep: someone has to notice when the market no longer behaves as the rules assume. Neither style is better for everyone. Many traders use rules for the parts where mood does the most damage, such as size and exits, and keep judgment for the rest.

    • Decision made by

      Discretionary

      Your judgment on the day

      Rule-based

      A written rule
    • Effect of mood

      Discretionary

      High

      Rule-based

      Lower, because rules are fixed
    • Can be tested on old data

      Discretionary

      Hard

      Rule-based

      Yes, with limits
    • Handles surprises

      Discretionary

      Can adapt

      Rule-based

      Only if a rule covers it
    • Main weakness

      Discretionary

      Inconsistent, emotional

      Rule-based

      Rigid; can decay when the market changes

    Discretionary compared with Rule-based. Rules are revised from time to time.

    Warning

    What this does not tell you: that rules will make money. A rule-based approach with no edge simply loses money consistently.

    Chapter

    What goes into a written rule set?

    A useful rule set is like a recipe with quantities. Vague steps ("cook until done") give different results each time. The parts are these: a filter that decides if the day is tradable; an entry trigger; a position size calculated from your risk budget; a stop and target set at entry; an exit or roll rule; and a record of every trade.

    Use price action for the triggers, that is, what price itself does: a close above a marked level, a break and retest of a range, a rejection from a level. Keep the trigger simple enough that two people reading it would mark the same trade. Add time rules too. For example, close single-stock option positions before the expiry week, because stock derivatives end in delivery and margin rises through the final sessions.

    The flow below shows how the pieces link. The last steps matter as much as the first: the log, the weekly review and the rule-change step. Rules are edited only in the review, never in the middle of a live trade.

    A rule-based trade: every step is written before the market opens

    If a step cannot be written as a yes-or-no rule, it is judgment, and judgment is where mood enters.

    A rule-based trade: every step is written before the market opensFlow: market filter, entry trigger, position size from risk budget, stop and target, exit or roll rule, then log the result. An override is allowed only through a written rule change after review.1 FILTERTradable today?Event day? Trend?If no: no trade2 ENTRYTriggerPrice action rule,for example a closeabove a level3 SIZELots from budgetRisk % / loss perlot, rounded down4 PROTECTStop and targetBoth set at entry,written down5 EXITExit or rollTime exit beforeexpiry; close stockoptions early6 LOGRecord itResult, rule kept?Mood note7 REVIEWWeekly reviewDo rules still workover enough trades?8 CHANGEEdit the rulesOnly here, nevermid-tradeOverride rule: to break a rule mid-trade, you must first write why, then wait.Most overrides made in the moment are recorded, then reviewed, and not repeated.Price action only. No indicator is needed for the structure of this flow.

    What this does not tell you: A mechanical system removes in-the-moment mood, not market risk. Rules that worked in past data can stop working when conditions change, and too many rules can be over-fitted. Someone still has to review the rules on a fixed schedule, not in the middle of a trade.

    A rule-based trade as a flow, from the day filter to the record and review.

    Step by step

    1. 01

      Define what you trade

      For example, Nifty options only. A narrow list keeps you in liquid contracts.

    2. 02

      Write the day filter

      Conditions under which you do not trade, such as major event days.

    3. 03

      Write the entry trigger

      One or two price-action conditions that are clearly true or false.

    4. 04

      Calculate size from risk

      Use your risk budget and the loss per lot, rounded down.

    5. 05

      Write the exits

      Stop, target and a time exit, all fixed at entry.

    6. 06

      Log every trade

      Including whether you followed the rules.

    Warning

    When this goes wrong: adding rule after rule until the system only fits the past. More rules can make a test look better while making the live result worse.

    Chapter

    How do I test rules without fooling myself?

    A backtest applies your rules to old price data to see what would have happened. It gives figures such as number of trades, average win and loss, and the largest drawdown. It is useful for rejecting weak ideas. It is not proof that a good one will work.

    The main danger is curve fitting. If you keep changing numbers until the past looks perfect, you have fitted the rules to that one history, and they will likely fail on new data. One protection is to split the data. You design and tune on the first block, then lock the rules and test once on a block you have not touched. If it fails there, you rethink the idea instead of tuning it to pass.

    The last step is live testing with very small size. Live trading shows what data cannot: bid-ask spreads, slippage, brokerage, STT (raised for F&O from 1 April 2026) and your own behaviour. A system that looks good before costs can be a loser after them, and options with wide spreads suffer most.

    Testing a rule set without fooling yourself

    One common way to split history. The percentages are illustrations, not a standard.

    Testing a rule set without fooling yourselfA bar split into three parts: about 60 percent of history to design the rules, 20 percent locked away as an out-of-sample test, and then live forward testing with tiny size.Design and tune (about 60%)Locked test (20%)Live, tiny size (20%)Rules are frozen after the first blockOpen the locked block once. If it fails, rethink the idea; do not re-tune to pass.Three traps to check every time1. Costs: brokerage, STT (raised for F&O from 1 April 2026), slippage, spreads.2. Too many parameters: each extra knob makes a pretty past more likely.3. One regime: a test only in a calm, rising market says little about a crash.Length of each block depends on how many trades the system makes; more trades, more weight.

    What this does not tell you: A good backtest is not proof. Past data cannot include costs you did not model, slippage, changed rules, or a market that behaves differently next year. If you keep adjusting rules until the test looks good, you have fitted the past, not found an edge. Even a clean out-of-sample result can fail live.

    One way to split history: design, locked test, and small live trade. The percentages are illustrations.

    Key points

    • A backtest can reject a weak idea, but it cannot prove a good one.
    • Lock the rules before the out-of-sample test, and look at that block once.
    • Include real costs and spreads in every test.
    • Start live with very small size and compare to the backtest.

    Warning

    What this does not tell you: whether the market will keep behaving as it did in the test period. A system that fits only one type of market can stop working when the type changes.

    FAQ

    Common questions

    Mechanical trading follows written rules for entries, size and exits. Discretionary trading relies on your judgment on the day. Each has strengths and weaknesses; many traders mix them.

    Knowledge Check

    Question 1 of 2Score: 0

    Which is a good sign that a rule is clear enough for a system?