22
Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz [email protected]

Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz [email protected]

Embed Size (px)

Citation preview

Page 1: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Designing Trading Systems

A systematic approach to trading by:

Todd [email protected]

Page 2: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Designing 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

Page 3: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

What 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.

Page 4: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Benefits of Mechanical Trading

Takes the emotion out of it. Don’t have to question the signals. System can be evaluated on probabilities. Expected performance (profits, drawdowns,

win/loss ratio) is roughly known.

Page 5: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Benefits 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.

Page 6: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Buy 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.

Page 7: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Buy 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.

Page 8: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Tools 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.

Page 9: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Tools 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

Page 10: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

First 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 ?

Page 11: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

First 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 ?

Page 12: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

First 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)

Page 13: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Backtesting 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.

Page 14: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Backtesting 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 don’t make logical sense.

Solid ideas rise to the top. Valid across many different markets. i.e. Rising MA (trending)

Page 15: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Backtesting 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?

Page 16: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Backtesting 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.

Page 17: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Pitfalls & 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

Page 18: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Pitfalls & 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.comcast.net/~toddk63/)

Successful trading systems can become unprofitable unless new and innovative methods are constantly applied.

Page 19: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Resources & 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!

Page 20: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Resources & Books

Web Resources The Gary Stone Journal – Designing Trading

Systems The Buffalo Trader – David Buffalo’s Blog My “homepage”

http://home.comcast.net/~toddk63/

Page 21: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Figure 2 – Portfolio Equity & Drawdown

Page 22: Designing Trading Systems A systematic approach to trading by: Todd Kellenbenz toddk63@yahoo.com

Figure 3 - 3D Optimization