ebook img

The Ultimate Algorithmic Trading System Toolbox PDF

368 Pages·2016·9.77 MB·english
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview The Ultimate Algorithmic Trading System Toolbox

TrimSize:7inx10in Pruitt ffirs.tex V2-05/05/2016 12:29A.M. Pagei T U HE LTIMATE A LGORITHMIC T S RADING YSTEM T OOLBOX TrimSize:7inx10in Pruitt ffirs.tex V2-05/05/2016 12:29A.M. Pageii TheWileyTradingseriesfeaturesbooksbytraderswhohavesurvivedthemarket’s ever changing temperament and have prospered—some by reinventing systems, others by getting back to basics. Whether a novice trader, professional, or somewhereinbetween,thesebookswillprovidetheadviceandstrategiesneeded toprospertodayandwellintothefuture.Formoreonthisseries,visitourwebsite atwww.WileyTrading.com. Founded in 1807, John Wiley & Sons is the oldest independent publishing companyintheUnitedStates.WithofficesinNorthAmerica,Europe,Australia,and Asia,Wileyisgloballycommittedtodevelopingandmarketingprintandelectronic productsandservicesforourcustomers’professionalandpersonalknowledgeand understanding. TrimSize:7inx10in Pruitt ffirs.tex V2-05/05/2016 12:29A.M. Pageiii T U HE LTIMATE A LGORITHMIC T S RADING YSTEM T OOLBOX + Website Using Today’s Technology to Help You Become a Better Trader George Pruitt TrimSize:7inx10in Pruitt ffirs.tex V2-05/05/2016 12:29A.M. Pageiv CopyrightC2016byGeorgePruitt.Allrightsreserved. PublishedbyJohnWiley&Sons,Inc.,Hoboken,NewJersey. PublishedsimultaneouslyinCanada. Nopartofthispublicationmaybereproduced,storedinaretrievalsystem,ortransmittedinanyformorby anymeans,electronic,mechanical,photocopying,recording,scanning,orotherwise,exceptaspermitted underSection107or108ofthe1976UnitedStatesCopyrightAct,withouteitherthepriorwrittenpermission ofthePublisher,orauthorizationthroughpaymentoftheappropriateper-copyfeetotheCopyrightClearance Center,Inc.,222RosewoodDrive,Danvers,MA01923,(978)750-8400,fax(978)646-8600,orontheWeb atwww.copyright.com.RequeststothePublisherforpermissionshouldbeaddressedtothePermissions Department,JohnWiley&Sons,Inc.,111RiverStreet,Hoboken,NJ07030,(201)748-6011,fax(201) 748-6008,oronlineathttp://www.wiley.com/go/permissions. LimitofLiability/DisclaimerofWarranty:Whilethepublisherandauthorhaveusedtheirbesteffortsin preparingthisbook,theymakenorepresentationsorwarrantieswithrespecttotheaccuracyorcompleteness ofthecontentsofthisbookandspecificallydisclaimanyimpliedwarrantiesofmerchantabilityorfitnessfora particularpurpose.Nowarrantymaybecreatedorextendedbysalesrepresentativesorwrittensalesmaterials. Theadviceandstrategiescontainedhereinmaynotbesuitableforyoursituation.Youshouldconsultwitha professionalwhereappropriate.Neitherthepublishernorauthorshallbeliableforanylossofprofitorany othercommercialdamages,includingbutnotlimitedtospecial,incidental,consequential,orotherdamages. Forgeneralinformationonourotherproductsandservicesorfortechnicalsupport,pleasecontactour CustomerCareDepartmentwithintheUnitedStatesat(800)762-2974,outsidetheUnitedStatesat(317) 572-3993orfax(317)572-4002. Wileypublishesinavarietyofprintandelectronicformatsandbyprint-on-demand.Somematerialincluded withstandardprintversionsofthisbookmaynotbeincludedine-booksorinprint-on-demand.Ifthisbook referstomediasuchasaCDorDVDthatisnotincludedintheversionyoupurchased,youmaydownloadthis materialathttp://booksupport.wiley.com.FormoreinformationaboutWileyproducts,visit www.wiley.com. LibraryofCongressCataloging-in-PublicationData: Names:Pruitt,George,1967-author. Title:Theultimatealgorithmictradingsystemtoolbox+website:usingtoday’s technologytohelpyoubecomeabettertrader/GeorgePruitt. Description:Hoboken:Wiley,2016.|Series:Wileytrading|Includesindex. Identifiers:LCCN2016010889(print)|LCCN2016011196(ebook)|ISBN9781119096573(hardback)| ISBN9781119262961(pdf)|ISBN9781119262978(epub) Subjects:LCSH:Electronictradingofsecurities.|Investmentanalysis.|Futures.|BISAC: BUSINESS&ECONOMICS/Finance. Classification:LCCHG4515.95.P7882016(print)|LCCHG4515.95(ebook)| DDC332.640285/4678—dc23 LCrecordavailableathttp://lccn.loc.gov/2016010889 CoverDesign:Wiley CoverImages:Cagsandrew/Shutterstock PrintedintheUnitedStatesofAmerica. 10 9 8 7 6 5 4 3 2 1 TrimSize:7inx10in Pruitt ftoc.tex V3-05/05/2016 3:52P.M. Pagev CONTENTS Abouttheauthor ix IntroductiontotheUltimateAlgorithmicTrading SystemsToolbox xiii CHAPTER1 IntroductiontoTrading:Algorithm v Development 1 WhatIsanAlgorithm? 1 HowtoGetMyTradingIdeaintoPseudocode 12 Summary 23 CHAPTER2 StochasticsandAveragesandRSI!Oh,My! 25 Oscillators 26 Price-BasedIndicators 58 Summary 75 CHAPTER3 CompleteTradingAlgorithms 77 Trend-TradingBattleRoyale 86 PortfolioComposition 100 Multi-AlgorithmStrategy(MAS) 108 Summary 112 CHAPTER4 IntroductiontoAmiBroker’sAFL 113 QuickStart 113 PriceBarInterface 118 TrimSize:7inx10in Pruitt ftoc.tex V3-05/05/2016 3:52P.M. Pagevi AFLArrayProgramming 120 Syntax 129 AFLWizard 133 AmiBrokerLoopProgramming 139 Summary 140 CHAPTER5 UsingMicrosoftExceltoBacktestYour Algorithm 145 VBAFunctionsandSubroutines 147 Data 148 SoftwareStructure 149 ProgrammingEnvironment 154 Summary 163 CHAPTER6 UsingPythontoBacktestYourAlgorithm 167 WhyPython? 167 PythonInstallation 169 PSBInstallation 169 vi PSBStructure 171 S T GettingDowntoBusiness 193 N E T Summary 202 N O C CHAPTER7 AnIntroductiontoEasyLanguage 203 TradeStationIDE 204 Syntax 209 SamplesofEasyLanguage 221 Summary 224 CHAPTER8 GeneticOptimization,WalkForward,and MonteCarloStartTradeAnalysis 227 UtilizingTradeStationandAmiBroker 227 Computers,Evolution,andProblemSolving 230 Population 231 InitialPopulationSetupUsingVBAExcel 232 TestingFitnessofChromosomesUsingVBAExcel 232 Selection 233 TrimSize:7inx10in Pruitt ftoc.tex V3-05/05/2016 3:52P.M. Pagevii Reproduction 238 Mutation 240 UsingGeneticAlgorithmsinTradingSystem Development 243 PreventingOver-Curve-Fitting 247 Walk-ForwardOptimizer:IsItWorththeExtra WorkandTime? 249 MonteCarloAnalysis 258 StartTradeDrawdown 264 Summary 269 CHAPTER9 AnIntroductiontoPortfolioMaestro, MoneyManagement,andPortfolioAnalysis 271 FixedFractional 272 PortfolioMaestro 272 Summary 290 APPENDIXA AmiBroker 293 Keywords 293 vii FlowControlStructures 294 C O Functions 295 N T E N UtilizingExplorationforDebugging 295 T S PositionSizinginFuturesMode 298 APPENDIXB ExcelSystemBacktester 301 DataArrays 301 Keywords 302 FunctionsandSubroutines 302 APPENDIXC PythonSystemBacktester 309 DataArraysorLists 309 KeywordsandIdentifiers 310 Classes 310 IndicatorClassesandFunctions 315 Python-SpecificKeywords 320 TrimSize:7inx10in Pruitt ftoc.tex V3-05/05/2016 3:52P.M. Pageviii APPENDIXD TradeStationandEasyLanguage 323 ImportingELDfilefromBookWebsite 323 KeywordsandFunctions 324 SampleAlgorithmCodes 325 APPENDIXE 335 AbouttheCompanionWebsite 337 Index 339 viii S T N E T N O C TrimSize:7inx10in Pruitt flast.tex V3-05/05/2016 3:52P.M. Pageix ABOUT THE AUTHOR ItwasMarchof1989asIdrovemybeat-upDodgeupHillsideRd.inHendersonville, NC. In an attempt to pay for my last semesters of college I was answering a classifiedadthatwaslookingtohireacomputerprogrammer.AsIdroveupthethin drive I passed several houses and then through a gate attached to two large stone pillars. I stopped the car and looked down at the ad again to make sure I was at ix the right place. I proceeded down the country lane and the view opened up into a largemeadow.Attheendofthelanewasacirculardriveandlargefarmhouse.As I circled and went back down the road I thought to myself I must have the wrong address or directions. So I followed the small road back down the main highway andthentoasmallconvenientstore.OncethereIaskedmyselfagainwhattypeof businesswasthisFuturesTruthandifIshouldcallandgetdirectionsorjustsimply forget about it. Curiosity and the need for money were too much so I used the store’spayphoneandcalledthenumberonceagain. ‘‘Hello—FuturesTruth,mayIhelpyou?’’alady’svoiceanswered. ‘‘Yes, this is George Pruitt and I made an appointment for an interview but I can’tseemtofindyouroffice.’’ ‘‘DoyoudrivearedDodge?’’sheasked. ‘‘YesIdo.Howdidyouknow?’’ ‘‘We saw you drive right by the office. When you come through the two stone pillarsturnimmediatelytotheleft.Don’tgoallthewaydownthedrive—that’sthe owner’shouse.’’ TrimSize:7inx10in Pruitt flast.tex V3-05/05/2016 3:52P.M. Pagex So I follow the directions and find myself in front of a small house. I knock on the door and John Fisher opens and invites me in. We go through the normal Q and A for a job interview and he finally asks if Iknew FORTRAN. My first college programmingclasswasFORTRANsoIconfidentlyanswered,‘‘Sure!’’ He then asked me if I knew anything about the Futures market. I vaguely remembered the term from one of my economics classes and of course from the Eddie Murphy movie and answer him with the question, ‘‘You mean like Trading PlaceswithEddieMurphy?’’ JohnFishersaid‘‘Sortoflikethat—yes.’’ He went on to explain how Futures Truth tried to determine market direction in the most widely traded futures contracts by using trading systems. The trading systemswereprogrammedinFORTRANandtheyneededhelpwiththeprogram- ming. Inadditiontotrading theyalsopublishedanewsletterinwhichtheytracked publiclyofferedtradingsystems. Iasked,‘‘Dopeoplereallybuytheseprograms?’’ JohnFishersaidyesandbythattimeanoldergentlemenwalkedintotheofficeand stated that he had spent thousands of dollars on these programs and was ultimately ripped off. John Hill stated this was the main reason he started Futures Truth. He wantedtobringtruthtothetradingsystemindustry.BothJohnstoldmethatmost traders couldn’t afford to validate the trading systems because of the cost of the x computer equipment, data, and software. John Fisher pointed to the computer he wasworkingonandasked,‘‘HowmuchdoyouthinkthisMacintoshIIcost?’’ R O Iansweredhim,‘‘IamnotthatfamiliarwithMacsbutIknowtheyaren’tcheap.’’ H T U My mouth fell open when he said ‘‘$4,000 and we have three of them.’’ A E Rememberthiswaswaybackin1989whencomputerswerenotcheap. H T I was thinking to myself that they got ripped off because they could have got T U O a much cheaper and better computer with the IBM PS/2. And what was up with B A using FORTRAN? Did they not know ‘‘C’’ was the new programming language of the 1990s? John Fisher chose the Apple Macintosh because of its easy-to-use graphical user interface (GUI) and FORTRAN because many traders and hobbyist programmershadknowledgeofthislanguage. John Fisher also said that he and John Hill had developed what they considered the best testing platform, ‘‘Excalibur.’’ This platform could load decades of daily and intraday data and test any trading idea that could be defined in an algorithmic form. He also said the only thing that was missing was a charting application and thatwaswheretheyalsoneededhelp. IexplainedthatIwouldbewrappingupmydegreeaftersummerandbothJohns agreed that I could work part time in the evening until I graduated and then we couldgofromthere.

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.