Testing and Tuning Market Trading Systems - Timothy Masters

Testing and Tuning Market Trading Systems (eBook)

Algorithms in C++

(Autor)

eBook Download: PDF
2018 | 1st ed.
IX, 321 Seiten
Apress (Verlag)
978-1-4842-4173-8 (ISBN)
Systemvoraussetzungen
62,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Build, test, and tune financial, insurance or other market trading systems using C++ algorithms and statistics. You've had an idea and have done some preliminary experiments, and it looks promising. Where do you go from here?  Well, this book discusses and dissects this case study approach.  

Seemingly good backtest performance isn't enough to justify trading real money. You need to perform rigorous statistical tests of the system's validity. Then, if basic tests confirm the quality of your idea, you need to tune your system, not just for best performance, but also for robust behavior in the face of inevitable market changes. Next, you need to quantify its expected future behavior, assessing how bad its real-life performance might actually be, and whether you can live with that. Finally, you need to find its theoretical performance limits so you know if its actual trades conform to this theoretical expectation, enabling you to dump the system if it does not live up to expectations.

This book does not contain any sure-fire, guaranteed-riches trading systems. Those are a dime a dozen... But if you have a trading system, this book will provide you with a set of tools that will help you evaluate the potential value of your system, tweak it to improve its profitability, and monitor its on-going performance to detect deterioration before it fails catastrophically. Any serious market trader would do well to employ the methods described in this book.

What You Will Learn

  • See how the 'spaghetti-on-the-wall' approach to trading system development can be done legitimately
  • Detect overfitting early in development
  • Estimate the probability that your system's backtest results could have been due to just good luck
  • Regularize a predictive model so it automatically selects an optimal subset of indicator candidates
  • Rapidly find the global optimum for any type of parameterized trading system
  • Assess the ruggedness of your trading system against market changes
  • Enhance the stationarity and information content of your proprietary indicators
  • Nest one layer of walkforward analysis inside another layer to account for selection bias in complex trading systems
  • Compute a lower bound on your system's mean future performance
  • Bound expected periodic returns to detect on-going system deterioration before it becomes severe
  • Estimate the probability of catastrophic drawdown

 Who This Book Is For

Experienced C++ programmers, developers, and software engineers.  Prior experience with rigorous statistical procedures to evaluate and maximize the quality of systems is recommended as well.  




Timothy Masters received a PhD in mathematical statistics with a specialization in numerical computing. Since then he has continuously worked as an independent consultant for government and industry. His early research involved automated feature detection in high-altitude photographs while he developed applications for flood and drought prediction, detection of hidden missile silos, and identification of threatening military vehicles. Later he worked with medical researchers in the development of computer algorithms for distinguishing between benign and malignant cells in needle biopsies. For the last twenty years he has focused primarily on methods for evaluating automated financial market trading systems. He has authored five books on practical applications of predictive modeling: Practical Neural Network Recipes in C++ (Academic Press, 1993); Signal and Image Processing with Neural Networks (Wiley, 1994); Advanced Algorithms for Neural Networks (Wiley, 1995); Neural, Novel, and Hybrid Algorithms for Time Series Prediction (Wiley, 1995); Data Mining Algorithms in C++ (Apress, 2018); Assessing and Improving Prediction and Classification (Apress, 2018); Deep Belief Nets in C++ and CUDA C: Volume 1 (Apress, 2018); and Deep Belief Nets in C++ and CUDA C: Volume 2 (Apress, 2018).
Build, test, and tune financial, insurance or other market trading systems using C++ algorithms and statistics. You've had an idea and have done some preliminary experiments, and it looks promising. Where do you go from here?  Well, this book discusses and dissects this case study approach.  Seemingly good backtest performance isn't enough to justify trading real money. You need to perform rigorous statistical tests of the system's validity. Then, if basic tests confirm the quality of your idea, you need to tune your system, not just for best performance, but also for robust behavior in the face of inevitable market changes. Next, you need to quantify its expected future behavior, assessing how bad its real-life performance might actually be, and whether you can live with that. Finally, you need to find its theoretical performance limits so you know if its actual trades conform to this theoretical expectation, enabling you to dump the system if it does not live up to expectations.This book does not contain any sure-fire, guaranteed-riches trading systems. Those are a dime a dozen... But if you have a trading system, this book will provide you with a set of tools that will help you evaluate the potential value of your system, tweak it to improve its profitability, and monitor its on-going performance to detect deterioration before it fails catastrophically. Any serious market trader would do well to employ the methods described in this book.What You Will LearnSee how the 'spaghetti-on-the-wall' approach to trading system development can be done legitimatelyDetect overfitting early in developmentEstimate the probability that your system's backtest results could have been due to just good luckRegularize a predictive model so it automatically selects an optimal subset of indicator candidatesRapidly find the global optimum for any type of parameterized trading systemAssess the ruggedness of your trading system against market changesEnhance the stationarity and information content of your proprietary indicatorsNest one layer of walkforward analysis inside another layer to account for selection bias in complex trading systemsCompute a lower bound on your system's mean future performanceBound expected periodic returns to detect on-going system deterioration before it becomes severeEstimate the probability of catastrophic drawdown  Who This Book Is ForExperienced C++ programmers, developers, and software engineers.  Prior experience with rigorous statistical procedures to evaluate and maximize the quality of systems is recommended as well.  

Timothy Masters received a PhD in mathematical statistics with a specialization in numerical computing. Since then he has continuously worked as an independent consultant for government and industry. His early research involved automated feature detection in high-altitude photographs while he developed applications for flood and drought prediction, detection of hidden missile silos, and identification of threatening military vehicles. Later he worked with medical researchers in the development of computer algorithms for distinguishing between benign and malignant cells in needle biopsies. For the last twenty years he has focused primarily on methods for evaluating automated financial market trading systems. He has authored five books on practical applications of predictive modeling: Practical Neural Network Recipes in C++ (Academic Press, 1993); Signal and Image Processing with Neural Networks (Wiley, 1994); Advanced Algorithms for Neural Networks (Wiley, 1995); Neural, Novel, and Hybrid Algorithms for Time Series Prediction (Wiley, 1995); Data Mining Algorithms in C++ (Apress, 2018); Assessing and Improving Prediction and Classification (Apress, 2018); Deep Belief Nets in C++ and CUDA C: Volume 1 (Apress, 2018); and Deep Belief Nets in C++ and CUDA C: Volume 2 (Apress, 2018).

Table of Contents 4
About the Author 8
About the Technical Reviewer 9
Chapter 1: Introduction 10
The Target Audience, and Overview of Contents 10
What’s in This Book 10
What’s Not in This Book 12
About Trading Systems 13
Market Prices and Returns 14
Two Types of Automated Trading Systems 15
The Agony of Believing the Computer 16
Future Leak Is More Dangerous Than You May Think 16
The Percent Wins Fallacy 17
Chapter 2: Pre-optimization Issues 19
Assessing and Improving Stationarity 19
The STATN Program 21
Improving Location Stationarity by Oscillating 25
Extreme Stationarity Induction 27
Measuring Indicator Information with Entropy 28
Computing the Relative Entropy of an Indicator 30
Entropy Impacts Predictive Model Quality 32
Improving the Entropy of an Indicator 33
Monotonic Tail-Only Cleaning 37
The ENTROPY Program 39
Chapter 3: Optimization Issues 42
Regularizing a Linear Model 42
Overview of the Regularized Model 43
Beta Adjustment with Guaranteed Convergence 47
Differential Case Weighting 48
Rapid Computation with Covariance Updates 49
Preparatory Code 50
Outline of the Beta Optimization Process 53
Code for Beta Optimization 55
Descending a Lambda Path 62
Optimizing Lambda with Cross Validation 66
The CD_MA Program 70
Making a Linear Model Nonlinear 74
Differential Evolution: A Universal Nonlinear Optimizer 76
The DIFF_EV.CPP Routine for Differential Evolution 82
Chapter 4: Post-optimization Issues 97
Cheap Bias Estimates 97
The StocBias Class 98
Cheap Parameter Relationships 102
Parameter Sensitivity Curves 114
Putting It All Together Trading OEX 118
The Trading System 118
Linking Criterion Routines 121
Application to Trading OEX 123
Chapter 5: Estimating Future Performance I: Unbiased Trade Simulation 127
In-Sample and Out-of-Sample Performance 127
The TrnBias Program to Demonstrate Training Bias 129
Selection Bias 130
Interlude: What Does Unbiased Really Mean? 131
Selection Bias, Continued 132
The SelBias Program 133
Walkforward Analysis 135
Future Leak by Unobvious IS/OOS Overlap 137
Error Variance Inflation with Multiple-Bar Lookaheads 138
The General Walkforward Algorithm 140
C++ Code for the Algorithm 141
Date-Dependent Walkforward 143
Exploring Walkforward Blunders 143
Testing Robustness Against Nonstationarity 148
Cross-Validation Analysis 149
Unobvious IS/OOS Overlap 149
The Fully General Cross-Validation Algorithm 150
C++ Code for the General Algorithm 152
Cross Validation Can Have Pessimistic Bias 156
Cross Validation Can Have Optimistic Bias 156
Cross Validation Does Not Reflect Real Life 156
Special Precautions for Algorithmic Trading 157
Converting Unknown-Lookahead Systems to Single-Bar 161
Unbounded Lookback Can Subtly Happen 162
Comparing Cross Validation with Walkforward: XVW 162
Computationally Symmetric Cross Validation 164
The CSCV Algorithm: Intuition and General Statement 166
What Does This Test Actually Measure? 169
C++ Code for the CSCV Superiority Test 170
An Example with SPX 175
Nested Walkforward Analysis 178
The Nested Walkforward Algorithm 180
A Practical Application of Nested Walkforward 185
An Example Using S& P 100 Components
Cross Validation Nested Inside Walkforward 194
Chapter 6: Estimating Future Performance II: Trade Analysis 198
Handling Dynamic Trading Systems 198
Unknown Lookahead to Single Bars, Revisited 199
Profit per Bar? Per Trade? Per Time? 200
Analyzing Completed Trade Returns Is Problematic 201
The PER_WHAT Program 203
A Lower Bound for Mean Future Returns 214
Brief Digression: Hypothesis Tests 215
So, How Do We Use This Probability? 217
Parametric P-Values 221
Parametric Confidence Intervals 223
Lower Confidence Bounds and Hypothesis Tests 227
Bootstrap Confidence Intervals 227
The Pivot and Percentile Methods 228
The BCa Bootstrap Algorithm 230
The BOOT_CONF.CPP Subroutines 232
The BOUND_MEAN Program and Results with SPX 237
Beware of Bootstrapping Ratios 243
Bounding Future Returns 246
Deriving a Lower Bound from Empirical Quantiles 247
Confidence in the Computed Lower Bound 249
What About an Upper Bound on Future Returns? 252
The CONFTEST Program: Overview 253
The CONFTEST Program: Code 256
The BND_RET Program 262
Bounding Drawdown 267
Intuition Gone Wrong 268
Bootstrapping Drawdown Bounds 270
The DRAWDOWN Program 272
Experiments with the DRAWDOWN Program 282
The CHOOSER_DD Program 284
Chapter 7: Permutation Tests 287
Overview of Permutation Testing 287
Testing a Fully Specified Trading System 289
Testing the Training Process 290
Walkforward Testing a Trading System Factory 291
Permutation Testing of Predictive Models 293
The Permutation Testing Algorithm 295
Extending the Algorithm for Selection Bias 296
Partitioning Total Return of a Trading System 298
Essential Permutation Algorithms and Code 302
Simple Permutation 302
Permuting Simple Market Prices 303
Permuting Multiple Markets with an Offset 305
Permuting Price Bars 309
Example: P-Value and Partitioning 314
Example: Training with Next Bar Returns 316
Example: Permuting Multiple Markets 320
Index 323

Erscheint lt. Verlag 26.10.2018
Zusatzinfo IX, 321 p. 29 illus.
Verlagsort Berkeley
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
Mathematik / Informatik Informatik Software Entwicklung
Informatik Theorie / Studium Algorithmen
Recht / Steuern Wirtschaftsrecht
Wirtschaft Betriebswirtschaft / Management Finanzierung
Schlagworte Algorithm analysis and problem complexity • algorithms • C++ • Code • Engineering • Financial • FinTech • platform • programming • Software • Trade • Trading
ISBN-10 1-4842-4173-8 / 1484241738
ISBN-13 978-1-4842-4173-8 / 9781484241738
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 4,1 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Build memory-efficient cross-platform applications using .NET Core

von Trevoir Williams

eBook Download (2024)
Packt Publishing (Verlag)
29,99
Learn asynchronous programming by building working examples of …

von Carl Fredrik Samson

eBook Download (2024)
Packt Publishing (Verlag)
34,79