IT training building winning algorithmic trading systems a traders journey from data mining to monte carlo simulation to live trading davey 2014 07 21

284 216 0
IT training building winning algorithmic trading systems  a traders journey from data mining to monte carlo simulation to live trading davey 2014 07 21

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

BUILDING WINNING ALGORITHMIC TRADING SYSTEMS The Wiley Trading series features books by traders who have survived the market’s ever changing temperament and have prospered—some by reinventing systems, others by getting back to basics Whether a novice trader, professional, or somewhere in between, these books will provide the advice and strategies needed to prosper today and well into the future For more on this series, visit our Web site at www.WileyTrading.com Founded in 1807, John Wiley & Sons is the oldest independent publishing company in the United States With offices in North America, Europe, Australia, and Asia, Wiley is globally committed to developing and marketing print and electronic products and services for our customers’ professional and personal knowledge and understanding BUILDING WINNING ALGORITHMIC TRADING SYSTEMS A Trader’s Journey from Data Mining to Monte Carlo Simulation to Live Trading Kevin J Davey Cover Design: Wiley Cover Image: © iStockphoto/Emilia_Szymanek Copyright © 2014 by Kevin J Davey All rights reserved Published by John Wiley & Sons, Inc., Hoboken, New Jersey Published simultaneously in Canada No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600, or on the Web at www.copyright.com Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts in preparing this book, they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability or fitness for a particular purpose No warranty may be created or extended by sales representatives or written sales materials The advice and strategies contained herein may not be suitable for your situation.You should consult with a professional where appropriate Neither the publisher nor author shall be liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages For general information on our other products and services or for technical support, please contact our Customer Care Department within the United States at (800) 762-2974, outside the United States at (317) 572-3993, or fax (317) 572-4002 Wiley publishes in a variety of print and electronic formats and by print-on-demand Some material included with standard print versions of this book may not be included in e-books or in print-on-demand If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com For more information about Wiley products, visit www.wiley.com Davey, Kevin, 1966Building algorithmic trading systems, + website : a trader’s journey from data mining to Monte Carlo simulation to live trading / Kevin Davey online resource — (Wiley trading) Includes index ISBN 978-1-118-77891-3 (pdf) — ISBN 978-1-118-77888-3 (epub) — ISBN 978-1-118-77898-2 (pbk.) Futures Portfolio management Investment analysis Monte Carlo method Electronic trading of securities I Title HG6024.A3 332.64′2028567 — dc23 2014014899 Printed in the United States of America 10 To Amy, Owen, Kathryn, Andrew, and Guardian Angel Anthony— My love, my children, my life CONTENTS Acknowledgments About the Author Introduction ix xi PART I A TRADER’S JOURNEY CHAPTER The Birth of a Trader CHAPTER Enough Is Enough 15 CHAPTER World Cup Championship of Futures Trading® Triumph 23 CHAPTER Making the Leap—Transitioning to Full Time 33 PART II YOUR TRADING SYSTEM 41 CHAPTER Testing and Evaluating a Trading System 43 CHAPTER Preliminary Analysis 53 CHAPTER Detailed Analysis 61 CHAPTER Designing and Developing Systems 71 PART III DEVELOPING A STRATEGY 77 CHAPTER Strategy Development—Goals and Objectives 79 CHAPTER 10 Trading Idea 83 vii CHAPTER 11 Let’s Talk about Data 93 CHAPTER 12 Limited Testing 103 CHAPTER 13 In-Depth Testing/Walk-Forward Analysis 115 CHAPTER 14 Monte Carlo Analysis and Incubation 129 CHAPTER 15 Diversification 133 CHAPTER 16 Position Sizing and Money Management 139 CHAPTER 17 Documenting the Process 147 PART IV 153 CREATING A SYSTEM CHAPTER 18 Goals, Initial and Walk-Forward Testing 155 CHAPTER 19 Monte Carlo Testing and Incubation 163 PART V 175 CHAPTER 20 Account and Position Sizing 177 CHAPTER 21 Trading Psychology 187 viii CHAPTER 22 Other Considerations before Going Live 195 CONTENTS CONSIDERATIONS BEFORE GOING LIVE PART VI 203 MONITORING A LIVE STRATEGY CHAPTER 23 The Ins and Outs of Monitoring a Live Strategy 205 CHAPTER 24 Real Time 219 PART VII 233 CAUTIONARY TALES CHAPTER 25 Delusions of Grandeur Conclusion 235 243 APPENDIX A Monkey Trading Example, TradeStation Easy Language Code 247 APPENDIX B Euro Night Strategy, TradeStation Easy Language Format 255 APPENDIX C Euro Day Strategy, TradeStation Easy Language Format 259 About the Companion Web Site 263 Index 265 NATR = 93 ; ATRmult = 2.55 ; TRmult = 0.66 ; Stoplo= 375 ; end ; if date >= 1100617 and date < 1101129 then begin Nb = 14 ; NATR = 83 ; ATRmult = 2.75 ; TRmult = 0.71 ; Stoplo= 425 ; end ; if date >= 1101129 and date < 1110515 then begin Nb = 14 ; NATR = 83 ; ATRmult = 2.75 ; TRmult = 0.66 ; Stoplo= 425 ; end ; EURO NIGHT STRATEGY, TRADESTATION EASY LANGUAGE FORMAT 256 if date >= 1110515 and date < 1111026 then begin Nb = 19 ; NATR = 93 ; ATRmult = 3.15 ; TRmult = 0.56 ; Stoplo= 425 ; end ; if date >= 1111026 and date < 1120412 then begin Nb = 14 ; NATR = 83 ; ATRmult = 2.95 ; TRmult = 0.61 ; Stoplo= 425 ; end ; if date >= 1120412 and date < 1120924 then begin Nb = 14 ; NATR = 93 ; ATRmult = 2.95 ; TRmult = 0.61 ; Stoplo= 425 ; end ; if date >= 1120924 and date < 1130310 then begin Nb = 19 ; NATR = 73 ; ATRmult = 3.15 ; TRmult = 0.71 ; Stoplo= 425 ; end ; if date >= 1130310 and date < 1130826 then begin Nb = 14 ; NATR = 93 ; ATRmult = 2.95 ; TRmult = 0.51 ; Stoplo= 425 ; end ; if date >= 1130826 and date < 1140101 then begin Nb = 14 ; NATR = 93 ; ATRmult = 2.55 ; 257 TRmult = 0.71 ; EURO NIGHT STRATEGY, TRADESTATION EASY LANGUAGE FORMAT Stoplo= 425 ; end ; Var:       LongPrice(0), ShortPrice(0), LongTarget(0), ShortTarget(0); //limit entry prices ShortPrice = Average(Low, Nb) + ATRmult * AvgTrueRange(NATR); LongPrice = Average(High, Nb) - ATRmult * AvgTrueRange(NATR);     {code to ensure only order is entered at each bar - order closest to price} var:diff1(0),diff2(0),EntrytoPick(0); EntrytoPick=0; diff1=absvalue(close-LongPrice); diff2=absvalue(close-ShortPrice); If diff1diff2 then EntryToPick=2;     if date >= 1090721 and MarketPosition = and EntriesToday(Date) < Time >= FirstTime and Time < LastTime then begin and If EntryToPick=1 then begin Buy(“Long Entry”) next bar at LongPrice limit; end;   If EntryToPick=2 then begin Sell short(“Short Entry”) next bar at ShortPrice limit; end;     end;     If MarketPosition=-1 then begin ShortTarget = EntryPrice - TRmult * TrueRange; Buy to cover(“Short Exit”) next bar at ShortTarget limit; end;   If MarketPosition =1 then begin LongTarget = EntryPrice + TRmult * TrueRange; Sell(“Long Exit”) next bar at LongTarget limit; end; EURO NIGHT STRATEGY, TRADESTATION EASY LANGUAGE FORMAT 258         Setstopposition; setstoploss(stoplo);   SetExitOnClose; APPENDIX C Euro Dayy Strategy, gy TradeStation Easy Language Format 259 var:xb(2),xb2(50),pipadd(1),Stopl(400),proft(5000); if date >= 1091118 and date < 1101025 then begin xb = ; xb2 = 70 ; pipadd = ; Stopl = 275 ; end ; if date >= 1101025 and date < 1110929 then begin xb = ; xb2 = 72 ; pipadd = ; Stopl = 225 ; end ; if date >= 1110929 and date < 1120904 then begin xb = ; xb2 = 74 ; pipadd = ; Stopl = 425 ; end ; if date >= 1120904 and date < 1130812 then begin xb = ; xb2 = 74 ; pipadd = 11 ; Stopl = 425 ; end ; if date >= 1130812 and date < 11400101 then begin xb = ; xb2 = 80 ; pipadd = ; Stopl = 425 ; end ;   var:cs(0),tradestoday(0),startprof(0),starttrades(0),stoplo(0);   cs=currentsession(0);   If cscs[1] then begin EURO DAY STRATEGY, TRADESTATION EASY LANGUAGE FORMAT 260 tradestoday=0; startprof=NetProfit + OpenPositionProfit; starttrades=TotalTrades; Stoplo=stopl; end;   If totaltradesstarttrades or marketposition0 or startprofNetProfit + OpenPositionProfit then tradestoday=1;         If tradestoday=0 and time= 1091118 then begin     //entry rules   If (high>=highest(high,xb) and close

Ngày đăng: 05/11/2019, 14:33

Từ khóa liên quan

Mục lục

  • BUILDING WINNING ALGORITHMIC TRADING SYSTEMS

  • CONTENTS

  • ACKNOWLEDGMENTS

  • ABOUT THE AUTHOR

  • INTRODUCTION

    • Who Can Benefit from This Book?

  • PART I A Trader’s Journey

    • CHAPTER 1 The Birth of a Trader

      • My Moving Average Debacle

    • CHAPTER 2 Enough Is Enough

      • Research

      • You Can’t Lose—Or Can You?

      • Averaging Down—Adding to Losers

      • The Wild Man Emerges

      • Time to Evaluate

    • CHAPTER 3 World Cup Championship of Futures Trading® Triumph

      • 2005

      • 2006

      • 2007

      • Reflections on the Contest

    • CHAPTER 4 Making the Leap—Transitioning to Full Time

      • Confidence

        • What I Did Right

        • What I Did Wrong

      • Capital

        • What I Did Right

        • What I Did Wrong

      • Living Expenses

        • What I Did Right

        • What I Did Wrong

      • Family Support

        • What I Did Right

        • What I Did Wrong

      • Home Office Setup

        • What I Did Right

        • What I Did Wrong

      • Trading Strategies

        • What I Did Right

        • What I Did Wrong

      • Brokers

        • What I Did Right

        • What I Did Wrong

      • Free Time

        • What I Did Right

        • What I Did Wrong

      • Taking the Plunge

  • PART II Your Trading System

    • CHAPTER 5 Testing and Evaluating a Trading System

      • Historical Back Testing

      • Out-of-Sample Testing

      • Walk-Forward Analysis

      • Real-Time Analysis

    • CHAPTER 6 Preliminary Analysis

    • CHAPTER 7 Detailed Analysis

      • What Is Monte Carlo Analysis?

      • Inputs to Monte Carlo Simulator

      • Limitations of the Simulator

      • Simulator Output

        • Starting Equity

        • Risk of Ruin

        • Median Drawdown

        • Median $ Profit, Median Return

        • Return/Drawdown

        • Prob > 0

      • Summary

    • CHAPTER 8 Designing and Developing Systems

      • Isn’t It All Just Optimizing?

  • PART III Developing a Strategy

    • CHAPTER 9 Strategy Development–Goals and Objectives

    • CHAPTER 10 Trading Idea

      • How Will You Enter a Market?

      • How Will You Exit a Market?

      • What Markets Will You Trade?

      • What Type of System Do You Want?

      • What Time Frame/Bar Size Will You Trade?

      • How Will You Program the Strategy?

    • CHAPTER 11 Let’s Talk about Data

      • How Much?

      • Pit or Electronic Data?

      • Continuous Contracts

      • The Impact of Electronic Markets

      • Testing with Forex Data

      • Summary

    • CHAPTER 12 Limited Testing

      • Entry Testing

        • Fixed-Stop and Target Exit

        • Fixed-Bar Exit

        • Random Exit

        • Entry Evaluation Criteria

      • Exit Testing

        • Similar-Approach Entry

        • Random Entry

      • Exit Evaluation Criteria

      • Core System Testing

      • Monkey See, Monkey Do

        • Test 1: “Monkey Entry”

        • Test 2: “Monkey Exit”

        • Test 3: “Monkey Entry, Monkey Exit”

        • Time Frames

        • Monkey Testing—Example

    • CHAPTER 13 In-Depth Testing/Walk-Forward Analysis

      • No Parameters

      • A Walk-Forward Primer

      • Walk-Forward Inputs

        • In Period

        • Out Period

      • Fitness Function

        • Net Profit

        • Linearity of Equity Curve

        • Return on Account

      • Anchored/Unanchored

      • Running the Analysis

      • Put the Walk-Forward Strategy Together

    • CHAPTER 14 Monte Carlo Analysis and Incubation

      • Incubation

      • Evaluating Incubation

    • CHAPTER 15 Diversification

      • Designing with Diversification in Mind

      • Measuring Diversification

        • Daily Return Correlation

        • Linearity of Equity Curve

        • Maximum Drawdown

        • Monte Carlo, Return/Drawdown

    • CHAPTER 16 Position Sizing and Money Management

      • No Optimum Position Sizing

      • Risk and Reward Are a Team

      • Position Sizing Can Be Optimized

      • Losing Systems Cannot Become Winners

      • Winning Systems Can Become Losers

      • The Fantasy of Size

      • Short Term—Go for Broke

      • No Position Sizing = No Good!

      • Strategy, Then Position Size, or Strategy and Position Size Together?

      • Positioning Size—Single System

      • Positioning Size—Multiple Systems

    • CHAPTER 17 Documenting the Process

      • Trading Goals

      • Trading Idea

      • Limited Testing

      • Walk-Forward Testing

      • Monte Carlo Testing

      • Incubation Testing

      • Diversification Check

      • Position-Sizing Check

      • Final Notes

      • One Final List

  • PART IV Creating a System

    • CHAPTER 18 Goals, Initial and Walk-Forward Testing

      • Developing a New Strategy

      • Limited Testing

      • Walk-Forward Testing

    • CHAPTER 19 Monte Carlo Testing and Incubation

      • Euro Day Strategy

      • Euro Night Strategy

      • Euro Day and Night Strategy

      • Incubation

      • Are Results Similar?

      • Final Information

      • Position Sizing

      • Correlation with Other Strategies

      • Monte Carlo—Consistency

      • Eliminating Big Days

      • Outlier Days

  • PART V Considerations before Going Live

    • CHAPTER 20 Account and Position Sizing

      • When to Quit

      • Minimum Funding Size

      • Position Sizing

      • Unequal Position Sizing

    • CHAPTER 21 Trading Psychology

      • When to Begin Trading

      • When to Quit

    • CHAPTER 22 Other Considerations before Going Live

      • Accounting, Trading Brokers

      • Automation, Unattended, VPS, Where Are Orders Kept?

        • Backup Plans

        • To Automate or Not to Automate?

        • Attended, Unattended?

        • VPS

        • Where Orders Are Kept

      • Rollover Considerations

        • Real World—What Your Actual Trading Account Sees

        • Strategy World—What Your Strategy, Acting on a Back-Adjusted Continuous Contract, Thinks Is Happening

        • Method 1: Quick Roll (Most Expensive Typically)

        • Method 2: Leg in Roll (Cheapest Method Typically if Done Correctly)

        • Method 3: Exchange Supported Spread Roll (Cost Usually between Methods 1 and 2)

  • PART VI Monitoring a Live Strategy

    • CHAPTER 23 The Ins and Outs of Monitoring a Live Strategy

      • How to Build an Equity Curve (and a Drawdown Curve, Too!)

        • Equity Curve

        • Drawdown Curve

      • Monthly Summary Chart

      • How to Use This Graph

      • Tracking Expected and Actual Performance

    • CHAPTER 24 Real Time

      • Four-Week Review—September 13, 2013, End Date

      • Update after Week 7

      • Week 8 Review

      • Week 9—Automated Trading Issues

      • Week 9—Limit Order Fills (October 28, 2013)

      • Week 12 Review

      • Week 13—Time Limit Review

      • Week 15 Review

      • Future Reviews

  • PART VII Cautionary Tales

    • CHAPTER 25 Delusions of Grandeur

      • Don Demo

      • Gus the Guru

      • Paul the Predictor

      • Cal the Complication King

      • Pay Me Peter

      • Frank Five Hundred

      • Billy the Boaster

      • Connie the Compounder

      • Ian versus the Illuminati

      • Suki the Spinner

      • Paolo the Plagiarizer

      • Slick Sam

      • The Delusion Conclusion

  • CONCLUSION

  • APPENDIX A Monkey Trading Example, TradeStation Easy Language Code

    • Strategy 1: Baseline Strategy (No Randomness)

    • Strategy 2: Random Entry, Baseline Exit Strategy

    • Strategy 3: Baseline Entry, Random Exit Strategy

    • Strategy 4: Random Entry, Random Exit Strategy

  • APPENDIX B Euro Night Strategy, TradeStation Easy Language Format

  • APPENDIX C Euro Day Strategy, TradeStation Easy Language Format

  • ABOUT THE COMPANION WEBSITE

  • INDEX

  • EULA

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan