Turning chart patterns into tested rules
- Type
- In-house R&D
- What it is
- Chart-pattern recognition and execution engine
- Patterns
- Six classic families
- Stack
- Python, C# (.NET)
- Broker
- Interactive Brokers
- Status
- Research, backtesting and paper trading
- Shown here
- The engineering only; rules and results stay private
What this is
Our own research, not client work. Traders have read chart patterns by eye for a century, and two problems come with that. Nobody can watch hundreds of stocks across several timeframes at once, and two people looking at the same chart will often draw the same pattern differently. This project turns six classic patterns into exact rules a computer can check, so they can be tested honestly on past data and watched across many stocks at the same time.
It shows how we turn a pattern idea into reliable software. It is not a strategy we sell, and the rules themselves stay private.
The six pattern families
- Head and shoulders, and the inverse
- Cup and handle
- Double top and double bottom
- Bull and bear flags
- Ascending triangle
- Rising and falling wedges
Each one is defined by exact measurements of swing highs and lows, trendlines, volume and volatility, all in one shared engine rather than six separate scripts. The measurements and thresholds are not published.
The shape of the system
The engine is split into layers, so that scanning, risk checks and the broker connection never hold each other up:
- The pattern scanner finds confirmed swing highs and lows, fits the trendlines and checks volume and volatility, across several timeframes.
- The risk checks work out the size for each account, apply limits on open positions and exposure, and stop the same signal being acted on twice.
- The order layer sends orders to Interactive Brokers with a protective stop attached, recovers from dropped connections, reconciles orders and fills, and logs every decision.
What made it hard
- Turning a drawing into exact rules. A person forgives a slightly untidy shoulder or a brief poke through a trendline. Code cannot. Rules that are too strict miss real patterns, and rules that are too loose fire on noise. The engine measures shapes in ATR units, so one rule works across cheap and expensive stocks, and it allows a brief wick through a line while being strict about where candles close.
- No look-ahead, anywhere. A swing high only exists once later bars have failed to break it. The research code and the trading code share the same point-in-time logic: no pattern is judged until its last turning point and its breakout bar have closed.
- Interactive Brokers’ own rules. IBKR limits how fast market data can be requested and restarts its gateway every day. The system paces its requests, handles the restarts, and reconciles orders, fills and positions after any restart or dropped connection.
Where it fits
Many trading ideas start as a chart pattern that has only ever lived on a chart. This research shows what it takes to turn one into rules that can be tested honestly and run safely. When we build for a client, we build their own logic. For a client example, see how we coded an investment firm’s own pattern strategy on Interactive Brokers. Our linear-regression support research is another in-house example of the same discipline.
This is our own research, shown for its engineering. The rules, thresholds and any test results are not published, and nothing here is a claim about how any pattern performs. We do not sell, license or recommend trading strategies, patterns or signals, and we do not provide investment advice.