FREE FINANCIAL EDUCATION
Algorithmic trading basics
Separate data, signal, risk, order and reconciliation responsibilities.
What you will learn
Prerequisites: Order types, timestamps, strategy rules and basic programming logic.
- Separate data, signal, risk, order and reconciliation responsibilities.
- Express an entry rule as a deterministic state transition.
- Explain why automation reproduces rule errors faster rather than correcting them.
Mechanism and decision rules
An algorithmic trading system converts observations into instructions under explicit rules. Its minimum components are data ingestion, feature calculation, signal generation, risk checks, order handling and reconciliation. Keeping these responsibilities separate makes failures easier to diagnose. A signal is a desired action; an order is a request; a fill is an execution. Treating all three as the same event creates incorrect positions and P&L.
The system must track state across time. “Buy when price exceeds the moving average” could submit a new order on every update unless the rule also checks that the strategy is flat and has no pending entry. Define transitions for partial fills, rejects, reconnects and shutdown. A deterministic research rule is reproducible, but live input timing and execution remain uncertain.
Worked example · synthetic data
A synthetic rule evaluates one-minute closes. It requests 100 shares when a completed close crosses above a ten-bar average, provided position = 0 and pending entry quantity = 0. The broker fills 40 shares and leaves 60 pending. The next data update must not submit another 100-share entry, because both the 40-share position and pending quantity are recorded.
If the remaining 60 are canceled and cancellation is confirmed, the strategy now holds 40. Its protective exit quantity must reflect 40, not the original requested 100. Otherwise an exit can oversell and create an unintended short.
Failure modes and limits
Automation cannot turn an untested rule into a profitable one. Network retries can duplicate orders unless requests are idempotent or reconciled. A process restart needs persistent state and broker verification. Research, paper and live environments differ in latency, order priority and rejection behavior.
Practice case
A system requests 80 shares, receives a 30-share fill and then loses the connection. What is known, what is uncertain, and what must happen before a new entry?
Reveal the worked answer
At least 30 shares were filled. The remaining 50 may be pending, canceled or filled during the outage. Reconnect and reconcile broker positions, fills and open orders before issuing a new entry. Assuming the local snapshot is complete can duplicate exposure.
Check your understanding
Sources and next steps
The lesson, calculations and synthetic cases are original educational material. References explain underlying contract or chart conventions; none validates the profitability of a trading rule. Actual contract specifications, settlement obligations and charges must be checked before trading.
Explore OHLCV data in the chart lab · Explore volume-at-price and TPO data · Practice library
