Title: Designing Trading Systems
1Designing Trading Systems
- A systematic approach to trading by
- Todd Kellenbenz
- toddk63_at_yahoo.com
2Designing Trading SystemsTopics Covered
- What is Mechanical Trading ?
- Benefits of Mechanical Trading
- Buy or Build the System ?
- Tools Needed
- First Step The Design Criteria
- Backtesting and Optimization
- Pitfalls Traps
- Resources Books
3What is Mechanical Trading ?
- Trading based on a set of rules that completely
defines the life of the trade. - Entry, exit, stop loss, position sizing are all
clearly pre-defined. - A complete mechanical system leaves no room for
discretionary decisions. - Rules are developed by rigorous research and
testing of historical data. - Each individual trade has a random outcome.
- Extensive backtesting can demonstrate a positive
outcome over the long term.
4Benefits of Mechanical Trading
- Takes the emotion out of it.
- Dont have to question the signals.
- System can be evaluated on probabilities.
- Expected performance (profits, drawdowns,
win/loss ratio) is roughly known.
5Benefits of Mechanical Trading
- Some of the best trades are the ones that your
emotions tell you not to take. - Allows going against the herd.
- Analogous to a casino. Not as the player
(gambler), but as the owner, who knows that over
time the odds are in his favor. - Brings some certainty in an uncertain environment.
6Buy or Build ? - Buy
- Only option if you lack time or computer
programming skills. - Beware of black box red light / green light
systems. - If you do not intimately know what makes it work,
you may not trust it completely and may hesitate
to act on signals. Emotions then take over. - I personally do not recommend this option.
7Buy or Build ? - Build
- Requires strong computer programming skills and
LOTS of time. - Having designed, built and tested it yourself,
you will have complete faith in it and will not
hesitate to take its signals. - No trading system works forever. Having built it
yourself, it may be easily fixed with only a
minor tweak.
8Tools Needed
- Charting / backtesting software
- Amibroker (this is what I use)
- Tradestation
- Esignal
- Others?
- Good historical data. Avoid free data such as
Yahoo. You get what you pay for. - Futures data must be continuously backadjusted.
I use Norgate Premium Data for this.
9Tools Needed - Amibroker
- Very powerful and comprehensive.
- Inexpensive
- Portfolio level testing
- Easy to customize
- Optimization engines include simple brute force
as well as genetic algorithms. - Good metrics report (Fig.1)
- Vibrant online community
- Open source. Develop your own add-ins (dlls) with
C, Excel VBA or similar. Many available online. - Steep learning curve
10First Step The Design Basis
- Define what you want from the system.
- How much time dedicated to trading it. Do you
already have a full time job? - Time frame to trade. Intraday, daily, weekly
charts ? - Which markets to trade. Stocks, futures, others ?
11First Step The Design Basis
- Desired return (CAR)
- Expected maximum drawdown (MDD)
- Win / Loss ratio. A system with a low of
winning trades can be psychologically difficult
to trade. - Optimization metric. Use something more than
just CAR (Compounded Annual Return) - CAR / MDD (Calmar Ratio) is a good one. K-ratio,
Ulcer Index, others ?
12First Step The Design Basis
- From David Buffalo Blog
- 60 Win / Loss ratio
- 1.60 profit factor (gross profits / gross losses)
- 1.00 payoff ratio (avg trade profit / avg trade
loss) - Use of Calmar Ratio (CAR / MDD). Once this is
defined, it is simply a matter of position sizing
(leverage from futures !) up to your max pain
threshold (MDD)
13Backtesting and Optimization
- Steps Choose concept, program it, measure
results, modify or choose different concept,
repeat. - Generate ideas from reading books, trading
magazines, online blogs, etc. - About 30 trades needed to be statistically
significant. Much more is better. - Make sure profits are not from just one or two
trades.
14Backtesting and Optimization
- Watch Portfolio Equity line (Fig. 2). Nice smooth
slope. - Watch drawdown line (Fig. 2)
- Reverse the sign of a rule for confirmation or to
possibly make an unprofitable rule a profitable
one. - Be suspicious of rules that work but that just
dont make logical sense. - Solid ideas rise to the top. Valid across many
different markets. i.e. Rising MA (trending)
15Backtesting and Optimization
- In-sample / Out-of-sample testing
- Optimize with in-sample data. Verify system with
out-of-sample data. - More important for single market systems.
- Portfolio systems have inherent randomness making
them more forgiving to curve fitting. - Walk-forward testing periodically re-optimizes
with new in-sample data. Risk of curve fitting?
16Backtesting and Optimization
- Initially test without slippage and commissions.
No compounding. - Later, tighten up and add slippage and
commissions. - Compound results only as a final check of overall
system performance.
17Pitfalls Traps
- Optimization is a double edged sword. Need some,
but not too much. - The more rules that constrain the system, the
more likely it is curve fit to the data. - Pick optimized parameters around clusters, not a
single optimum point (Fig. 3). - Add random noise to data set to test for system
robustness (Howard Bandy Quantitative Trading
Systems). - A robust system should handle small amounts of
noise without greatly impacting profitability
18Pitfalls Traps
- Too frequent of walk-forward testing could lead
to over optimization. - Future Leaks. Coding error where tomorrows price
is known today. Example ref(Close,1) instead
of ref(Close,-1) - Survivor bias of stock indexes (http//home.comcas
t.net/toddk63/) - Successful trading systems can become
unprofitable unless new and innovative methods
are constantly applied.
19Resources Books
- Books
- Alexander Elder Trading for a Living.
Triple Screen 1) go with a trend 2) look for
pull backs 3) Enter on confirmation i.e. breakout
of previous high - Mark Douglas Trading in the Zone. View
every individual trade as a random event. System
testing gives confidence that over a large
population of trades, outcome should be positive. - Howard Bandy Quantitative Trading Systems,
Modeling Trading System Performance .The nuts
and bolts guide to developing a trading system.
I cannot recommend Howard enough!
20Resources Books
- Web Resources
- The Gary Stone Journal Designing Trading
Systems - The Buffalo Trader David Buffalos Blog
- My homepage http//home.comcast.net/toddk63/
21Figure 2 Portfolio Equity Drawdown
22Figure 3 - 3D Optimization