Model-Based Trading Strategies. Financial-Hacker.com Johann Christian Lotter / op group Germany GmbH

Similar documents
Quantitative Trading System For The E-mini S&P

Copyright , DayTradetoWin.com

FirstStrike Plus Weekly Volatility Breakout Instructions

S-Enrooter 1.0. Automatic trading strategy USER GUIDE. Version 1.0

C y c l e C a n d l e s T r a d i n g W o r k s h o p

The Simple Truth Behind Managed Futures & Chaos Cruncher. Presented by Quant Trade, LLC

- My 4 Favorite Trades - Essential Trades of a Professional Trader

Knowing When to Buy or Sell a Stock

Algorithmic Trading Session 4 Trade Signal Generation II Backtesting. Oliver Steinki, CFA, FRM

Basics of: Gap Guides

presented by Thomas Wood MicroQuant SM Divergence Trading Workshop Day One Naked Trading Part 2

Algorithmic Trading Session 12 Performance Analysis III Trade Frequency and Optimal Leverage. Oliver Steinki, CFA, FRM

Rotational Trading Systems

Naked Trading and Price Action

1 of 6 7/10/2013 8:42 AM

For general trading knowledge, please get a beginners guide or simply got to :

No-BS Trading System

AlgorithmicTrading Session 3 Trade Signal Generation I FindingTrading Ideas and Common Pitfalls. Oliver Steinki, CFA, FRM

FOREX UNKNOWN SECRET. by Karl Dittmann DISCLAIMER

The Enlightened Stock Trader Certification Program

QUESTION: What is the ONE thing every trader and investor is looking for? ANSWER: Financial Gains

11-Hour Options 2.0 The Next Evolution of Success

Becoming a Consistent Trader

Homework Assignment #1 - Based on the MTAEF Glossary of Technical Terms

Raising Investment Standards TRADING SEMINAR

Disclaimer. No Soliciting. No Recording. No Photography.

presented by Thomas Wood MicroQuant SM Divergence Trading Workshop Day One Black Gold

Everything you need to know about the trade alerts you ve been hearing about.

QF206 Week 11. Part 2 Back Testing Case Study: A TA-Based Example. 1 of 44 March 13, Christopher Ting

Learning Objectives CMT Level III

Level I Learning Objectives by chapter (2017)

Right click on chart, choose >> templates >>> template name. Here is how your chart should look like:

Go No Go Indicators: Part 2

We are not saying it s easy, we are just trying to make it simpler than before. An Online Platform for backtesting quantitative trading strategies.

Improving Returns-Based Style Analysis

CONNECING THE DOTS Candlesticks & Convergence of Clues. The Art & Science of Active Trend Trading

Adaptive Oscillator for TradeStation

Strategy when the first trigger is Missed

Part 1 Back Testing Quantitative Trading Strategies

Learning Objectives CMT Level I

ECLIPSE DAY TRADING SYSTEM USER GUIDE

20 pips are welcome. Simple GBPUSD Strategy. Reviewed and recommended by Rita Lasker & Green Forex Group

Trading Essentials Framework Money Management & Trade Sizing

Volatility-Managed Strategies

How to Fix the Top 10 Fatal Errors of Trading One Flaw at a Time. April 14: #4 Unrealistic Expectations. From the Active Trend Trader

RSI 2 System. for Shorter term SWING trading and Longer term TREND following. Dave Di Marcantonio 2016

Candlesticks What They Really Mean! March 3, 2018

Statistical Models and Methods for Financial Markets

Candlesticks Discoveries Probability of Success Aug 6, 2016

The Evaluation and Optimization of Trading Strategies

Pro Strategies Help Manual / User Guide: Last Updated March 2017

The Art & Science of Active Trend Trading

DayTrader (ES)

Strategy I: Buiding Wealth Part 1. For Active Trend Trading Dennis W. Wilborn

Lighting the Way: Using Candlestick Patterns. The Art & Science of Active Trend Trading

ValueCharts for Sierra Chart

USER GUIDE

90 Days Trading Bonds

CMT LEVEL I CURRICULUM Self-Evaluation

How to Fix the Top 10 Fatal Errors of Trading One Flaw at a Time. #1 Trying to Run Before Learning to Walk. From the Active Trend Trader

Trading Financial Market s Fractal behaviour

Buy rules: Sell rules: Strategy #2. Martingale hedging with exponential lot increase... 6

Risk Disclosure and Liability Disclaimer:

The Fundamental Law of Mismanagement

A unique trading tool designed to help traders visualize and place orders based on market depth and order flow. DepthFinder TradingApp

Trade the Open with Quantified Strategies

Proficient Equities Pvt. Ltd. 23 R.N Mukherjee Road, BNCCI House,4 th Floor, Kolkata , Phone: , Mob:

Of Option Trading PRESENTED BY: DENNIS W. WILBORN

Resistance to support

Money clearly flows into

ACCELERATOR- ES HYPOTHETICAL PERFORMANCE CAPSULE - Trading One Lot. Jul- 09. Jul- 10. Jan- 10. Jan- 11

Advance Certificate in Trading : A PROGRAM FOR SELF-INVESTORS

McDowell s Special Market Report Using the TradersCoach.com Software Tools

Strategy I: Buiding Wealth Part 1. For Active Trend Trading Dennis W. Wilborn

Technical Analysis. Used alone won't make you rich. Here is why

Assicurazioni Generali: An Option Pricing Case with NAGARCH

CFA Level I - LOS Changes

Free Forex Midnight Setup Strategy

CFA Level I - LOS Changes

VOLATILITY EFFECTS AND VIRTUAL ASSETS: HOW TO PRICE AND HEDGE AN ENERGY PORTFOLIO

Divergence and Momentum Trading

The truth behind commonly used indicators

The Art & Science of Active Trend Trading

Binary Options FREE Trading System

Market Reactivity. Automated Trade Signals. Stocks & Commodities V. 28:8 (32-37): Market Reactivity by Al Gietzen

How to Fix the Top 10 Fatal Errors of Trading One Flaw at a Time. #8 Spread too Thin #10 Trading too Much or too Little. From the Active Trend Trader

The Double in a Day Forex trading Technique

TradeOptionsWithMe.com

RISK DISCLOSURE STATEMENT / DISCLAIMER AGREEMENT

First Steps To Become a Self-Directed Quantitative Investor. Course for New Portfolio123 Users. Fred Piard. version: May 2018

Instruction (Manual) Document

How to Fix the Top 10 Fatal Errors of Trading One Flaw at a Time. #2 Trading Strategies before Knowing Systems. From the Active Trend Trader

The Art & Science of Active Trend Trading

HYPOTHETICAL BLEND FULLY FUNDED

presented by Thomas Wood MicroQuant SM Divergence Trading Workshop Day One Bond Trading Success

Bollinger Band Breakout System

The Assumption(s) of Normality

Part 1. ForEx Easy Mode

Forex Pulse Detector. User Guide

Copyright PriceAction5.com

Transcription:

Model-Based Trading Strategies Financial-Hacker.com Johann Christian Lotter / jcl@opgroup.de op group Germany GmbH

All trading systems herein are for education only. No profits are guaranteed. Don t blame me for losses. Disclaimer U.S. Government Required Disclaimer - Commodity Futures, Trading Commission Futures, Derivatives and Options trading has large potential rewards, but also large potential risk. You must be aware of the risks and be willing to accept them in order to invest in the futures and options markets. Don't trade with money you can't afford to lose. This website is neither a solicitation nor an offer to Buy/Sell futures or options. The past performance of any trading system or methodology is not necessarily indicative of future results. CFTC rule 4.41 - Hypothetical or simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

Modelling the Market Agenda Model based vs. data mining strategies The order book model The random walk model What we can learn from the random walk The general price curve model

Model vs. Data Modelling the Market Two general approaches to strategy building: model based - data mining Model based system development starts with a market theory and attempts to find it reflected in the data. Data mining system development starts with the price data and attempts to find predictive patterns or rules.

Model = Simplified image of the reality Modelling the Market We describe the trader behavior with a market model. Problem: A model is NOT the reality. The reality is unknown. The same reality can be described with many different models. The best model must be selected by experiment.

The order book model Modelling the Market Order book: Ask 10k @ 1.03 Ask 20k @ 1.02 Ask 10k @ 1.01 Bid 20k @ 0.99 Bid 10k @ 0.98 Bid 10k @ 0.97 Broker: Price = 1.01, Spread = 0.02

You buy 10k at market Modelling the Market Ask 10k @ 1.03 Ask 20k @ 1.02 (Ask 10k @ 1.01 <- order filled at 1.01) Bid 20k @ 0.99 Bid 10k @ 0.98 Bid 10k @ 0.97 Broker: New price = 1.02, Spread = 0.03 -> A buy order pushes the price up, a sell order pushes it down

You buy 10k at market Someone sells 10k at market Modelling the Market Ask 10k @ 1.03 Ask 20k @ 1.02 Ask 10k @ 1.01 (your order filled at 1.01) Bid 20k @ 0.99 (other order filled at 0.99) Bid 10k @ 0.98 Bid 10k @ 0.97 Broker: New price = 1.01, Spread = 0.02 -> buy and sell orders cancel each other

The Random Walk model Modelling the Market Buyers Sellers Price = PreviousPrice + Buyers - Sellers

Modelling the Market Which price curve is real?

Two rules from the random walk model Modelling the Market Rule 1: A pure random walk curve can not be traded (Rule of No Roulette System) Rule 2: The volatility of a random walk curve is proportional to the square root of its duration (Rule of Square Root Volatility).

Forces, pulling at the price curve Modelling the Market Previous price (~ 99%) Random buyers and sellers Fundamental buyers and sellers Technical buyers and sellers Inefficiency = systematic deviation from the Random Walk

General price curve model Modelling the Market y t = y t 1 + f(y t 1, y t n ) + ε f + ε r

Exploiting Market Inefficiencies Agenda Momentum Mean Reversion Cycles Stat Arb Constraints Clusters Patterns Gaps Seasonality Heteroskedasticity

Momentum Exploiting Market Inefficiencies y t = y t 1 + a 1 (y t 1 y t 2 ) + a 2 (y t 2 y t 3 ) + + ε f + ε r

A simple momentum strategy Exploiting Market Inefficiencies Detect the market regime: trend or mean reversion? Get a trend line with a lowpass filter When market regime is trending: Enter long on a trend line valley Enter short on a trend line peak

Mean Reversion Exploiting Market Inefficiencies y t = y t 1 1 λ (y t 1 y) + ε f + ε r

A simple mean reversion strategy Exploiting Market Inefficiencies Detect the market regime: trend or mean reversion? Remove trend with a highpass filter When market regime is mean reverting: Enter short when the price exceeds a high threshold Enter long when the price falls below a low threshold

Cycles y t = y t 1 Exploiting Market Inefficiencies + a 1 sin( 2π c 1 t + d 1 ) + a 2 sin( 2π c 2 t + d 2 ) + + ε f + ε r a 1 = Amplitude of the first cycle c 1 = Bar period of the first cycle

Exploiting Market Inefficiencies Frequency spectrum of a price curve

A simple cycle strategy Exploiting Market Inefficiencies Detect the dominant cycle c 1 and phase d 1. Get the current amplitude of the dominant cycle. When amplitude is above a threshold: Enter short when the phase d 1 is approaching a sine peak. Enter long when the phase d 1 is approaching a sine valley.

Statistical Arbitrage Exploiting Market Inefficiencies y t = h 1 y 1 h 2 y 2 y t = price difference (mean reverting) h 1, h 2 = hedge factors Typically h 1 = 1, h 2 by linear regression of y 1, y 2

Price constraints Exploiting Market Inefficiencies Price is restriced by an upper or lower hard boundary Or price is strongly mean reverting outside a soft boundary Classical example: The Swiss Franc cap 2011-2015 But distant price constraints exist for most assets

A simple price constraint strategy ( Grid Trader ) Exploiting Market Inefficiencies Place lines at equal or increasing distances from a mid price. Whenever the price crosses a line: Close all open trades that are in profit. Open a new long and short trade if there isn t already one open at that line. Use a hedging method for avoiding open long and short positions at the same time. Possible problems: Low short-term volatility Trading costs especially rollover Exceeding boundaries -> margin call

Exploiting Market Inefficiencies Price clusters Where do prices concentrate? Support and Resistance -> two clusters Fair price -> one cluster

Curve patterns Exploiting Market Inefficiencies Not to be confused with Candle Patterns Some famous patterns such as Head and Shoulders have no significance in real price curves and are probably myths. Other patterns such as Cups and Half-Cups really exist and can be explained by a behavior model ( breakout ). Several algorithms for detecting curve patterns, f.i. the Frechèt algorithm.

Gaps Exploiting Market Inefficiencies Overnight and weekend gaps can amplify and synchronize trader behavior patterns Trend and mean reversion before the gap reappears with a revenge

A simple gap trading strategy Exploiting Market Inefficiencies On an upwards trend, buy long on Friday when a 10-days high is reached. On a downwards trend, buy short on Friday when a 10-days low is reached. Close the position on Monday morning. Live trading can be followed on the Zorro forum.

Seasonality Exploiting Market Inefficiencies Trader behavior depends on time of day, day of week, day of month, month of year Seasonal effects in a price curve can be detected by simple statistical methods

Heterosketasticity Exploiting Market Inefficiencies y t = y t 1 + ε t a + b(y t 1 y t 2 ) 2 GARCH model (Generalised Autoregressive Conditional Heteroskedasticity)

The Development Process Agenda 1) Selecting the model. Confirming it with price data 2) Developing the trade algorithm 3) Developing the filter algorithm 4) Parameter adaption ( optimizing ) 5) Test 6) Reality check 7) Implementing risk and money management

Step 1: Model selection The Development Process The three prerequisites for a financial model: 1) Has a rational basis in market structure / trader behavior 2) Can be expressed in a program flow or formula 3) Has statistical significance in real price curves

Confirming the model The Development Process Find an algorithm that detects the inefficiency in price curves. Do a statistic. Plot a histogram. Compare with random walk curves or shuffled price curves. Difference should be significant. Do NOT rely on other people s research! Scam is ubiquitous (-> Elliott Waves, Rich Swannell)

The Development Process Example: Frequency spectrum of a price curve

Step 2: Determining the algorithm The Development Process Example: Cycle strategy Detect the dominant cycle and phase. Generate a forerunning sine curve. Enter short at a sine peak. Enter long at a sine valley. Exit on reversal or after a half-period.

Step 3: The filter The Development Process A market inefficiency normally does not exist all the time. Therefore, we need a filter for determining if the inefficiency is present or not. In most cases the filter is more important than the algorithm. Example: Cycle strategy Measure the amplitude of the dominant cycle. Trade only when the amplitude is above a threshold.

Step 4: Parameter adaption ( Training ) The Development Process If the model has free parameters : Find out how the strategy reacts on parameter changes. Find the most robust parameter range ( sweet spot ). Adapt the strategy to different assets. Adapt it to different market situations (even while live trading). Bad ideas: - Optimizing too many parameters. - Optimizing for peaks (= brute force or genetic optimization).

Example (Cycles system) The Development Process Adapted parameters: sine phase and threshold Training results:

Step 5: Test The Development Process Test should cover all significant market periods (5-10 years) Any parameter adaption introduce bias to the test result. The bias renders backtests completely useless. The solution: Testing the system with data not used for the adaption.

Walk-Forward Analysis The Development Process Roll a window over the simulation period Separate the window in a training and test section. Good: The test is out-of-sample and still covers most of the data. Bad: The system depends on two more parameters.

Analyzing test results The Development Process Main performance parameters: Wins divided by losses (Profit Factor) Annual profit in relation to drawdown (Calmar ratio) (Drawdown must be normalized -> square root rule!) Annual return in relation to sigma (Sharpe ratio) Linearity of returns (R2 coefficient)

Monte Carlo method The Development Process For eliminating randomness from the test results: Split the equity curve in small sections Randomize the curve by shuffling without replacement Repeat 1000 times. Calculate test results from every shuffled curve. Sort test results by confidence intervals.

Step 6: Reality check Even with walk forward and Monte Carlo analysis, test results still suffer from bias. Bias is introduced by the mere development process. Several methods to detect bias: The Development Process 1) White s Reality Check: gives a quantitative measure of bias 2) Monte Carlo Reality Check: run the system with price curves randomized by shuffling with replacement. Plot a result distribution 3) Variants: run the system with inverted, detrended, or oversampled price curves 4) Real-out-of-sample test: Set aside a part of the data and only use it for this test.

White s Reality check The Development Process Details under: http://www.financial-hacker.com/whites-reality-check/

Step 7: Risk and Money Management The Development Process Use a stop loss for eliminating negative outliers. Do not use profit targets. (If you really want to, use a profit-lock mechanism instead). Use an algorithm for calculating the optimal investment per portfolio component (Kelly, OptimalF, Markowitz). Re-invest only the square root of your profits. Supervise your system permanently and compare live results with backtest results (-> Cold Blood Index ).

No Reinvestment The Development Process CAGR: 15%

1% Reinvestment The Development Process CAGR: 16%

0.5 OptimalF Reinvestment The Development Process CAGR: 48%

Sqrt(P) OptimalF Reinvestment The Development Process CAGR: 43%

So far the theory Here s the real development process The Development Process Step 1. Visit trader forums. Look for the thread with new fabulous indicator. Step 2. Implement the indicator with a long coding session. Ugh, the backtest does not look this good. Some coding mistake? Debug. Debug some more. Step 3. Still no good result, but you have more tricks up your sleeve. Add a trailing stop. Run a week analysis. Tuesday is a bad day for this indicator? Add a filter for not trading on Tuesday. Add more filters for not trading between 12:00 and 14:00 and on any full moon except on Thursday. Wow, now we see some backtest profit!! Step 4. Of course you re not fooled by in-sample results. After optimizing all 23 parameters, run a walk forward analysis. Ugh, the result does not look this good. Try different WFA cycles. Try different bar periods. Optimize more parameters. Finally, a sensational test result! And this completely out of sample! Step 5. Trade the system live. Step 6. Ugh, the result does not look this good. Step 7. Hold many trading seminars for recovering your bank account.