automated option trading: create, optimize, and test automated trading systems

342

Upload: others

Post on 11-Sep-2021

22 views

Category:

Documents


10 download

TRANSCRIPT

Page 1: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems
Page 2: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

AutomatedOptionTradingCreate,Optimize,andTestAutomatedTradingSystems

SergeyIzraylevich,Ph.D.,andVadimTsudikman

Page 3: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

VicePresident,Publisher:TimMooreAssociatePublisherandDirectorofMarketing:AmyNeidlingerExecutiveEditor:JimBoydEditorialAssistant:PamelaBolandOperationsSpecialist:JodiKemperSeniorMarketingManager:JuliePhiferAssistantMarketingManager:MeganGraueCoverDesigner:AlanClementsManagingEditor:KristyHartProjectEditor:BetsyHarrisCopyEditor:CheriClarkProofreader:DebbieWilliamsSeniorIndexer:CherylLenserSeniorCompositor:GloriaSchurickManufacturingBuyer:DanUhrig©2012byPearsonEducation,Inc.PublishingasFTPressUpperSaddleRiver,NewJersey07458

Thisbookissoldwiththeunderstandingthatneithertheauthornorthepublisher is engaged in rendering legal, accounting, or other professionalservices or advice by publishing this book. Each individual situation isunique. Thus, if legal or financial advice or other expert assistance isrequired in a specific situation, the services of a competent professionalshouldbe sought to ensure that the situationhasbeenevaluated carefullyandappropriately.Theauthorandthepublisherdisclaimanyliability,loss,orriskresultingdirectlyorindirectly,fromtheuseorapplicationofanyofthecontentsofthisbook.

FTPressoffersexcellentdiscountsonthisbookwhenorderedinquantityforbulk purchases or special sales. For more information, please contact U.S.Corporate and Government Sales, 1-800-382-3419,[email protected]. For sales outside the U.S., please [email protected] and product names mentioned herein are the trademarks or

registeredtrademarksoftheirrespectiveowners.Allrightsreserved.Nopartofthisbookmaybereproduced,inanyformorby

anymeans,withoutpermissioninwritingfromthepublisher.PrintedintheUnitedStatesofAmerica

Page 4: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

FirstPrintingMarch2012ISBN-10:0-13-247866-8

ISBN-13:978-0-13-247866-3PearsonEducationLTD.

PearsonEducationAustraliaPTY,LimitedPearsonEducationSingapore,Pte.Ltd.PearsonEducationAsia,Ltd.PearsonEducationCanada,Ltd.PearsonEducatióndeMexico,S.A.deC.V.PearsonEducation—JapanPearsonEducationMalaysia,Pte.Ltd.LibraryofCongressCataloging-in-PublicationDataIzraylevich,Sergey,1966- Automated option trading : create, optimize, and test automated trading

systems/SergeyIzraylevich,VadimTsudikman.p.cm.Includesbibliographicalreferencesandindex.ISBN978-0-13-247866-3(hardcover:alk.paper) 1. Stock options. 2. Options (Finance) 3. Electronic trading of securities. 4.Investmentanalysis.5.Portfoliomanagement.I.Tsudikman,Vadim,1965-II.Title.HG6042.I9682012332.64’53—dc232011048038

Page 5: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Thisbookisdedicatedtoourparents,IzraylevichOlga,IzraylevichVladimir,TsudikmanRachel,TsudikmanJacob.

Page 6: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Contents

Introduction

Chapter1.DevelopmentofTradingStrategies1.1.DistinctiveFeaturesofOptionTradingStrategies

1.1.1.NonlinearityandOptionsEvaluation1.1.2.LimitedPeriodofOptionsLife1.1.3.DiversityofOptions

1.2.Market-NeutralOptionTradingStrategies1.2.1.BasicMarket-NeutralStrategy1.2.2. Points and Boundaries of Delta-

Neutrality1.2.3.AnalysisofDelta-NeutralityBoundaries1.2.4. Quantitative Characteristics of Delta-

NeutralityBoundaries1.2.5.AnalysisofthePortfolioStructure

1.3.PartiallyDirectionalStrategies1.3.1.SpecificFeaturesofPartiallyDirectional

Strategies1.3.2.EmbeddingtheForecastintotheStrategy

Structure1.3.3. The Call-to-Put Ratio at the Portfolio

Level1.3.4.BasicPartiallyDirectionalStrategy1.3.5.FactorsInfluencingtheCall-to-PutRatio

inanOptionsPortfolio1.3.6. The Concept of Delta-Neutrality as

AppliedtoaPartiallyDirectionalStrategy1.3.7.AnalysisofthePortfolioStructure

1.4.Delta-NeutralPortfolioasaBasisfortheOptionTradingStrategy

1.4.1. Structure and Properties of Portfolios

Page 7: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

SituatedatDelta-NeutralityBoundaries1.4.2. Selection of an Optimal Delta-Neutral

Portfolio

Chapter2.Optimization2.1.GeneralOverview

2.1.1.ParametricOptimization2.1.2.OptimizationSpace2.1.3.ObjectiveFunction

2.2. Optimization Space of the Delta-NeutralStrategy

2.2.1.DimensionalityofOptimization2.2.2.AcceptableRangeofParameterValues2.2.3.OptimizationStep

2.3.ObjectiveFunctionsandTheirApplication2.3.1. Optimization Spaces of Different

ObjectiveFunctions2.3.2.InterrelationshipsofObjectiveFunctions

2.4.MulticriteriaOptimization2.4.1.Convolution2.4.2.OptimizationUsingtheParetoMethod

2.5.SelectionoftheOptimalSolutionontheBasisofRobustness

2.5.1.AveragingtheAdjacentCells2.5.2.RatioofMeantoStandardError2.5.3.SurfaceGeometry

2.6.SteadinessofOptimizationSpace2.6.1.SteadinessRelativetoFixedParameters2.6.2.SteadinessRelativetoStructuralChanges2.6.3. Steadiness Relative to the Optimization

Period2.7.OptimizationMethods

2.7.1. A Review of the Key Direct Search

Page 8: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Methods2.7.2.ComparisonoftheEffectivenessofDirect

SearchMethods2.7.3.RandomSearch

2.8. Establishing the Optimization Framework:ChallengesandCompromises

Chapter3.RiskManagement3.1. Payoff Function and Specifics of Risk

Evaluation3.1.1.LinearFinancialInstruments3.1.2. Options as Nonlinear Financial

Instruments3.2.RiskIndicators

3.2.1.ValueatRisk(VaR)3.2.2.IndexDelta3.2.3.AsymmetryCoefficient3.2.4.LossProbability

3.3.InterrelationshipsBetweenRiskIndicators3.3.1.MethodforTestingtheInterrelationships3.3.2.CorrelationAnalysis

3.4. Establishing the Risk Management System:ChallengesandCompromises

Chapter4.CapitalAllocationandPortfolioConstruction4.1.ClassicalPortfolioTheoryand ItsApplicability

toOptions4.1.1. Classical Approach to Portfolio

Construction4.1.2.SpecificFeaturesofOptionPortfolios

4.2.PrinciplesofOptionPortfolioConstruction4.2.1.DimensionalityoftheEvaluationSystem4.2.2.EvaluationLevel

4.3.IndicatorsUsedforCapitalAllocation

Page 9: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

4.3.1. IndicatorsUnrelated to Return and RiskEvaluation4.3.2. Indicators Related to Return and Risk

Evaluation4.4.One-DimensionalSystemofCapitalAllocation

4.4.1.FactorsInfluencingCapitalAllocation4.4.2. Measuring the Capital Concentration in

thePortfolio4.4.3.TransformationoftheWeightFunction

4.5.MultidimensionalCapitalAllocationSystem4.5.1. Method of Multidimensional System

Application4.5.2. Comparison of Multidimensional and

One-DimensionalSystems4.6.PortfolioSystemofCapitalAllocation

4.6.1.SpecificFeaturesofthePortfolioSystem4.6.2. Comparison of Portfolio and Elemental

Systems4.7. Establishing the Capital Allocation System:

ChallengesandCompromises

Chapter5.BacktestingofOptionTradingStrategies5.1.Database

5.1.1.DataVendors5.1.2.DatabaseStructure5.1.3.DataAccess5.1.4.RecurrentCalculations5.1.5.CheckingDataReliabilityandValidity

5.2.PositionOpeningandClosingSignals5.2.1.SignalsGenerationPrinciples5.2.2. Development and Evaluation of

Functionals5.2.3.FiltrationofSignals

5.3.ModelingofOrderExecution

Page 10: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

5.3.1.VolumeModeling5.3.2.PriceModeling5.3.3.Commissions

5.4.BacktestingFramework5.4.1. In-Sample Optimization and Out-of-

SampleTesting5.4.2.AdaptiveOptimization5.4.3.OverfittingProblem

5.5.EvaluationofPerformance5.5.1.SingleEventandUnitofTimeFrame5.5.2. Review of Strategy Performance

Indicators5.5.3. The Example of Option Strategy

Backtesting5.6.EstablishingtheBacktestingSystem:Challenges

andCompromises

Bibliography

AppendixBasicNotionsPayoffFunctions

SeparateOptionsOptionCombinations

Index

Page 11: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Acknowledgments

The authors would like to express their gratitude to the team of HighTechnologyInvestInc.SpecialthanksareduetoArsenBalishyan,Ph.D.,CFA,andVladislavLeonov, Ph.D., andEugenMasherov, Ph.D., for their continuedhelpatallstagesofthisproject.

Page 12: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

AbouttheAuthors

SergeyIzraylevich,Ph.D.,ChairmanoftheBoardofHighTechnologyInvestInc.,hastradedoptionsforwelloveradecadeandcurrentlycreatesautomatedsystems for algorithmic option trading.AFuturesmagazine columnist, he hasauthored numerous articles for highly rated, peer-reviewed scientific journals.He began his career as a lecturer at TheHebrewUniversity of Jerusalem andTel-Hay Academic College, receiving numerous awards for academicexcellence,includingGoldaMeir’sPrizeandtheMaxShlomiokhonorawardofdistinction.VadimTsudikman,PresidentofHighTechnology Invest Inc., isa financial

consultantandinvestmentadvisorspecializinginderivativesvaluation,hedging,andcapitalallocationinextrememarketenvironments.Withmorethan15yearsof option trading experience, he develops complex trading systems based onmulticriteriaanalysisandgeneticoptimizationalgorithms.IzraylevichandTsudikmancoauthoredSystematicOptionsTrading(FTPress)

andregularlycoauthorFuturesmagazinearticlesoncutting-edgeissuesrelatedtooptionpricing,volatility,andriskmanagement.

Page 13: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Introduction

This book presents a concept of developing an automated system tailoredspecifically for options trading. It was written to provide a framework fortransforming investment ideas intoproperlydefinedand formalizedalgorithmsallowingconsistentanddisciplinedrealizationoftestabletradingstrategies.Extensive literature has been published in the past decades regarding

systematic,algorithmic,automated,andmechanicaltrading.IntheBibliographyof this book, we list some of the comprehensive works that deserve specialattention. However, all books dedicated to the creation of automated tradingsystems deal with traditional investment tools, such as stocks, futures, orcurrencies. Although the development of options-oriented systems requiresaccounting for numerous specific features peculiar to these instruments,automatedtradingofoptionsremainsbeyondthescopeofprofessionalliterature.The philosophy, logic, and quantitative procedures used in the creation ofautomatedsystemsforoptionstradingarecompletelydifferentfromthoseusedin conventional trading algorithms. In fact, all the components of a systemintended forautomated tradingofoptions (strategydevelopment,optimization,capital allocation, risk management, backtesting, performance measurement)differsignificantlyfromtheiranalogsinthesystemsintendedfortradingofplainassets.Thisbookdescribesconsecutively thekeystagesofcreatingautomatedsystemsintendedspecificallyforoptionstrading.Automated trading of options represents a continuous process of valuation,

structuring, and long-term management of investment portfolios (rather thanindividualinstruments).Duetothenonlinearityofoptions,theexpectedreturnsandrisksoftheircomplexportfolioscannotbeestimatedbysimplesummationof characteristics corresponding to individual options. Special approaches arerequired to evaluate portfolios containing options (and their combinations)relatedtodifferentunderlyingassets.In thisbookwediscusssuchapproaches,describesystematicallythecorepropertiesofoptionportfolios,andconsiderthespecificfeaturesofautomatedoptionstradingattheportfoliolevel.

TheBookStructureAn automated trading system represents a package of software modules

performing the functions of developing, formalizing, setting up, and testing

Page 14: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

tradingstrategies.Chapter1,“Development ofTradingStrategies,” discusses the development

andformalizationofoptionstrategies.Sincethereisahugemultitudeoftradingstrategiessomehowrelatedtooptions,welimitourdiscussiontomarket-neutralstrategies.Thereasonforselectingthisparticulartypeofoptionstrategiesrelatestoitswidepopularityamongprivateandinstitutionalinvestors.Strategy setup includes optimization of its parameters, capital allocation

between portfolio elements, and riskmanagement. Chapter 2, “Optimization,”deals with various optimization aspects. In this chapter we discuss variouspropertiesofoptimizationspaces,differenttypesofobjectivefunctionsandtheirinterrelationships,severalmethodsofmulticriteriaoptimization,andproblemsofoptimizationsteadinessrelativetosmallchangesintheparametersandstrategystructure.Specialattention isgivento theapplicationof traditionalmethodsofparametricoptimizationtocomplexoptionportfolios.In Chapter 3, “RiskManagement,” we discuss a set of option-specific risk

indicators that can be used for developing a multicriteria risk managementsystem.Weinvestigatetheinfluenceofdifferentfactorsontheeffectivenessofthe risk indicator and on the number of indicators needed for effective riskmeasuring.InChapter 4, “Capital Allocation and Portfolio Construction,” we consider

variousaspectsofcapitalallocationamongtheelementsofanoptionportfolio.Capital can be allocated on the basis of different indicators not necessarilyexpressing return and risk. This chapter describes the step-by-step process ofconstructingacomplexportfoliooutofseparateoptioncombinations.ThetestingofoptionstrategiesusinghistoricaldataisdiscussedinChapter5,

“Backtesting of Option Trading Strategies.” In this chapter we stress theparticularitiesofcreatingandmaintainingoptiondatabasesandprovidemethodstoverifydataaccuracyandreliability.Theproblemofoverfittingandthemainapproaches to solving it are also discussed. Performance evaluation of optionstrategiesisalsothetopicofthischapter.

StrategiesConsideredinThisBookThe nature of optionsmakes it possible to create a considerable number of

speculative trading strategies. Those can be based on different approachesencompassingthevarietyofprinciplesandvaluationtechniques.Inmany strategies options are used as auxiliary instruments to hedgemain

positions. In this book we are not going to delve into this field of options

Page 15: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

application since hedging represents only one constituent part of such tradingstrategies,butnottheirbackbone.Optionsmaybeusedtocreatesyntheticunderlyingpositions.Inthiscasethe

investoraimsforthepayoffprofilesofanoptioncombinationanditsunderlyingasset to coincide. This can increase trading leverage significantly. However,apart from leverage, automated tradingof synthetic assets is nodifferent fromtradinginunderlyingassets(besides thecertainspecificityregardingexecutionoftradingorders,higherbrokeragecommissions,andthenecessity torolloverpositions).Thus,wewillnotdwellonsuchstrategieseither.Mosttradingstrategiesdealingwithplainassets(notoptions)arebasedonthe

forecastof thedirectionof theirpricemovement (wewillcall themdirectionalstrategies).Optionscanalsobeused in such strategies.For example,differentkindsofoptioncombinations,commonlyreferredtoasspreads,benefitfromtheincreaseintheunderlyingprice(bullspreads),orfromitsdecline(bearspread).Despite the fact that trading strategies based on such option combinationspossessmanyfeaturesdistinguishingthemfromplainassetsstrategies,themaindeterminantoftheirperformanceistheaccuracyofpriceforecasts.Thisqualitymakes such strategies quite similar to common directional strategies, andthereforewewillnotconsidertheminthisbook.The focus of this book is on strategies that exploit the specific features of

options.Oneofthekeydifferencesofoptionsfromotherinvestmentassetsisthenonlinearity of their payoff functions. In the trading of stocks, commodities,currencies,andotherlinearassets,allprofitsandlossesaredirectlyproportionaltotheirprices.Inthecaseofoptions,however,positionprofitabilitydependsnotonlyonthedirectionofthepricemovement,butonmanyotherfactorsaswell.Combining different options on the same underlying asset can bring aboutalmostanyformofthepayofffunction.Thisfeatureofoptionspermitsthecreationofpositionsthatdependnotonly

onthedirectionandtheamplitudeofpricefluctuations,butalsoonmanyotherparameters, includingvolatility, timeleftuntil theexpiration,andsoforth.Themainsubjectofourconsiderationisaspecial typeof tradingstrategiessharingonecommonproperty referred to asmarket-neutrality.With regard to options,market-neutralitymeans that (1) small changes in the underlying price do notlead to a significant change in the position value, and (2) given larger pricemovements, the position value changes by approximately the same amountregardless of the direction of the underlying pricemovement. In reality theserules do not always hold, but they serve as a general guideline for a trader

Page 16: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

striving for market-neutrality. The main analytical instrument used to createmarket-neutralpositionsisdelta.Thepositionismarket-neutralifthesumofthedeltasofallitscomponents(optionsandunderlyingassets)isequaltoorclosetozero.Suchpositionsarereferredtoasdelta-neutral.Anothertypeoftradingstrategythatwillbeconsideredinthisbookisasetof

market-neutralstrategieswhosealgorithmscontaincertaindirectionalelements.Although in this case positions are createdwhile taking into consideration thevalueofdelta,itsreductiontozeroisnotanobligatoryrequirement.Forecastsofthe directions of future price movements represent an integral part of such astrategy. These forecasts can be incorporated into the strategy structure in theformofbiasedprobabilitydistributionsorasymmetricaloptioncombinations,orby application of technical and fundamental indicators. We will call suchstrategiespartiallydirectional.Generally, automated strategies are designed to trade one or just a few

financial instruments (mainly futures on a given underlying asset). Even ifseveral instruments are traded simultaneously, in most cases positions areopened, closed, and analyzed independently. Options are no exception. Mosttraders develop systems oriented solely at trading OEX (options on S&P 100futures) or options on oil futures. In this book we will consider strategiesintended to trade anunlimited number of options relating tomany underlyingassets.All positions createdwithin one trading strategywill beevaluated andanalyzedjointlyasawholeportfolio.

Scientific and Empirical Approaches to Developing AutomatedTradingStrategiesThere are two main approaches to the development of automated trading

strategies.Thefirstapproachisbasedontheprinciplesandconceptsdefinedbyastrategydeveloper.Alltheelementscomposingsuchastrategyoriginatefromeconomic knowledge, fundamental estimates, expert opinions, and so forth.Formalization of such knowledge, estimates, and assumptions in the form ofalgorithmic rules provides a basis for creating an automated trading strategy.FollowingtheexampleofRobertPardo,wewillcallthisascientificapproach.At its extreme, the scientific approach provides for a total rejection of

optimization procedures.All the rules and parameters of a trading system aredetermined solely on the basis of knowledge and forecasts of the developer.Apparently, the likelihood of creating a profitable strategy, while avoidingengagementinoptimizationprocedures,isextremelylow.Scientificapproachin

Page 17: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

itspureformishardlyapplicableinrealtrading.The alternative approach is based on the complete denial of any a priori

establishedtheories,models,andprincipleswhiledevelopingautomatedtradingstrategies. This approach requires extensive use of computer technologies tosearchforprofitabletradingrules.Allalgorithmscanbetestedforthistask(withno concern for any economically sound reasons standing behind theirapplication).Candidatealgorithmscanbeselectedfromanumberofready-madealternatives available or actually constructed by the system developer. Themethodofalgorithmcreationisnotdeterminedbypreliminaryassumptionsandisnotlimitedbyanyexogenousreasoning.Tradingrulesareselectedsolelyonthebasisoftheirtestingusinghistoricaldata.Theresultingstrategyisdevoidofanybehaviorallogicoreconomicsense.FollowingRobertPardo,wewillcallitanempiricalapproach.Atitsextreme,theempiricalapproachisapurposefulquestforalgorithmsand

parameters thatmaximize simulated profit (minimize loss or satisfy any otherutilityfunction).Thisapproachisbasedexclusivelyonoptimization.Nowadaysthere is a wide choice of high-technology software that facilitates fastdevelopmentof effectivealgorithmsandprovides for establishmentofoptimalparameter sets. For example, neuron networks and genetic methods representpowerfultoolsthatenablerelativelyfastfindingofoptimalsolutionsthroughthecreationofself-learningsystems.Usually tradingstrategiesconstructedon thebasisof theempiricalapproach

showremarkable resultswhen testedonhistorical timeseries,butdemonstratefailure in real trading. The reason for this is overfitting. Even walk-forwardanalysisdoesnoteliminatethisthreatbecausethesignificantnumberofdegreesoffreedom(whichisnotunusualundertheempiricalapproach)allowschoosingsuchasetoftradingrulesandparametersthatwouldgeneratesatisfactoryresultsnotonlyduringtheoptimizationperiod,butinthewalk-forwardanalysisaswell(wewillexaminethisindetailinChapter5).Thus,practicaluseoftheempiricalapproachexclusivelyisriskyandhardlyapplicableinrealtrading.

RationalApproachtoDevelopingAutomatedTradingStrategiesMost developers of automated trading strategies combine scientificmethods

and empirical approaches. On the one hand, strategies resulting from suchcombining are based on strong economic grounds. On the other hand, theybenefitfromthenumerousadvantagesofoptimizationandfromtheimpressiveprogressincomputerintelligence.Wewillcallthistherationalapproach.

Page 18: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Undertherationalapproachasetofrules,determiningthegeneralstructureofatradingstrategy,isformedattheinitialstageofstrategycreation.Theserulesarebasedon thepriorknowledgeandassumptionsaboutmarketbehavior.Theresults of statistical research, either received by the strategy developer orobtained from scientific publications and private sources, can also be used toshape the general framework. Obviously, patterns established during suchresearchintroducecertainlogicintothestrategyunderdevelopment.Atthesametime,statisticalresearchmayresultinthediscoveryofinexplicablerelationshipslackinganyeconomic sensebehind them.Such relationships shouldbe treatedwithspecialcaresincetheymayeitherberandominnatureorresultfromdatamining.The initial stage of strategy creation is based mainly on the elements of

scientificapproach.Atthisstagethefollowingmustbedetermined:•Principlesofgenerating thesignals foropeningandclosing tradingpositions•Indicatorsusedtogenerateopenandclosesignals•Auniverseof investmentassets thatarebothavailableandsuitablefortrading•Requirementstotheportfolioandrestrictionsimposedonit•Capitalallocationamongdifferentportfolioelements•Methodsandinstrumentsofriskmanagement

Atthenextstageofdevelopingatradingstrategy,theruleslaiddownonthebasisofscientificapproachareformalizedintheformofcomputablealgorithms.Thisstageiscongestedwithelementsof theempiricalapproach.Theseare theessentialsteps:

•Definingspecificparameters.Allrulesformulatedonthebasisofthescientific approach should be formalized using a certain number ofparameters.• Specifying the algorithms for parameter calculation. Differentalgorithmsmaybeinventedforcalculatingthesameparameter.• Establishing the procedures for the selection of parameter values.Thisrequiresadoptingacertainoptimizationtechnique.

Usually thedecisionon thenumberof parameters and selectionofmethodsfor their optimization does not depend on the economic considerations of thedeveloper,butfollowsfromthespecificrequirementstothestrategyandfromitstechnical constraints. These requirements and constraints are developed with

Page 19: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

regard to the reliability, stability, andother strategy features, amongwhich thecapabilitytoavoidtheoverfittingisoneofthemostimportantproperties.Inthisbookwewillfollowtheprinciplesofrationalapproachtothecreation

of trading strategies. The main task of the developer is to combine methodsattributed to the scientific and the empirical approaches in a reasonable andbalanced manner. In order to accomplish this task successfully, all basiccomponentsofatradingstrategyshouldbeclearlyidentifiedasbelongingeitherto components that are set on the basis of well-founded reasoning or to analternative category of components that are formed primarily by applyingvariousoptimizationmethods.

Page 20: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Chapter1.DevelopmentofTradingStrategies

1.1.DistinctiveFeaturesofOptionTradingStrategiesDeveloping option trading strategies requires taking into account numerous

specificitiespeculiartotheseinstruments.Inthissectionweconsiderthreemaincharacteristics that distinguish option-based strategies from other tradingsystems.

1.1.1. Nonlinearity and Options Evaluation Options, in contrast to otherassets,havenonlinearpayofffunctions.Thisshouldbetakenintoaccountwhileevaluating their investment potential and generating trading signals. Mostautomated strategies oriented toward linear assets trading generate open andclose signals using specially designed indicators. Technical gauges assessingpricetrends,dynamicsoftradingvolume,andoverbought/oversoldpatternsareamong themost frequently used tools.Automated trading of linear assets canalsobebasedonfundamentalcharacteristics.Whatevervariablesareutilized,thequality of trading signals depends on the effectiveness of indicators used toforecastthefuturepricemovements.Optionstrategiesconsideredinthisbookdonotexplicitlyrequireforecastsof

pricemovementdirection(althoughtheymaybeusedasauxiliaryinstruments).Thatiswhytradingsignalsinautomatedstrategiesdesignedforoptionstradingaregenerated through theapplicationof special criteria (rather than traditionalindicators) evaluating potential profitability and risk on the basis of otherprinciples. The major task of the criteria is to identify undervalued andovervaluedinvestmentassets.Fairvalueof anoption isdeterminedby theextentofuncertainty regarding

futurefluctuationsinitsunderlyingassetprice.Thehighertheuncertaintyis,thehigher the option price is. Strictly speaking, the option price depends on theprobabilitydistributionofunderlyingassetpriceoutcomes.Themarketestimateofthedegreeofuncertaintyisimpliedinoptionprices.Anyparticularinvestorcan develop his own estimate (by applying the probability theory, or differentmathematicalandstatisticalmethods,orbasedonhispersonalreasoning).Ifthemagnitudeofuncertaintyestimatedbytheinvestorisdifferentfromthemarket’sestimate, the investor may assume that the option under consideration isoverpricedorunderpriced.Theinterrelationshipbetweenthesetwouncertaintiesis the main philosophic principle underlying criteria creation. This

Page 21: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

interrelationship may be expressed either directly or indirectly, but it alwaysformsthemaincomponentofthealgorithmofcriteriacalculation.Criteriabasedontheinterrelationshipbetweentwouncertaintiesevaluatethe

fairness of the option market price. The calculation algorithm of a particularcriterionmustexpressvaluesofbothuncertaintiesnumerically, reduce themtothe samedimension, andcomparewith eachother. If their values are equalorclose,thentheoptionisfairlyvaluedbythemarket.Iftheuncertaintyestimatedbythedeveloperissignificantlyhigher(lower)thanthatofthemarket,optionsare underpriced (overpriced). The criterion effectiveness depends on itscapability to express the relationship between the divergence of twouncertaintiesandthemagnitudeofoptionover-orunderpricing.Inourpreviousbook(IzraylevichandTsudikman,2010)wedescribedalgorithmsforcalculationof many options-specific criteria. We also discussed the main principles ofcriteria creation, optimization of their parameters, and different approaches totheevaluationofcriteriaeffectiveness.

1.1.2.LimitedPeriodofOptionsLifeAnotherdistinctivefeatureofoptionsisthat,unlikeotherfinancialinstruments,derivativeshavealimitedlifespan.Thisimposescertainlimitationsonthedurationofthepositionholdingperiodandinsome cases requires the execution of the rollover procedures (which leads toadditionalexpensesduetoslippageandtransactioncosts).Inplainassetstradingeachsignalforthepositionopeningisfollowedbythe

correspondingsignalforclosingthesameposition.Inthecaseofoptionstheremaybenoclosesignals if the tradingstrategyholdspositionsuntilexpiration.Whenoptionsexpireout-of-the-money,theopensignalshavenocorrespondingclosesignals.Ifoptionsarein-the-moneyatexpiration, thesignalsforopeningoption positions will correspond to close signals relating to their underlyingassets.Furthermore,openandclosesignalscanhavethesamedirection(thatis,bothcanbeeither“buy”or“sell”).Generation of an open signal for any financial instrument implies that the

tradingsystemhasdetectedthedivergenceofanalyticallyestimatedfairvalueoftheinstrumentfromitsmarketprice.However,thisdivergencemaypersistatthemarketforaninfinitelylongtime.Evenif thecalculuswasexecutedcorrectly,themarketpriceoftheinstrumentwithanindefinitelifetimemaynotconvergewith its estimate during thewhole life span of the strategy.Consequently, thedeveloper of the trading strategywill not be able to judge the accuracyof hisvaluation algorithms.On the other hand, options have a fixed expiration date.After this date, the developer can draw a definitive conclusion about the

Page 22: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

accuracyofthefairvalueestimate.Thisfeaturedistinguishesoptionsfromotherassets for which the period of estimates verification cannot be determinedobjectively.

1.1.3.DiversityofOptionsForeachunderlyingassetthereisamultitudeofoptionswithdifferentstrike

pricesandexpirationdates.Atanymomentintime,someofthemcanbeover-orundervalued.This allowscreatingagreatnumberofoptioncombinationswithlongpositionsforundervaluedoptionsandshortpositionsforovervaluedones.The number of different option contracts that are potentially available for

tradingcanbeestimatedaswheren is thenumberofunderlyingassets,si is thenumberofstrikeprices

forunderlyingasseti,andeiisthenumberofexpirationseriesexistingforthisunderlying.Foreachunderlyingassetitispossibletocreate3si×eicombinations(assumingthateachoptionmaybeincludedinthecombinationasashortorlongposition,ormaynotbeincludedatall).Accordingly,fornunderlyingassetsthe

numberofconstructibleoptioncombinationsisSuppose that the scope of a particular trading system is limited to 100

underlyingassets.(Infact,thenumberofassetswithexchange-tradedoptionsismuchhigher;theU.S.stockmarketalonehasseveralthousandstockswithmoreor less actively traded options.) Assume also that each underlying asset hasabouttenoptioncontracts(inreality,theirnumberismuchhigher).Thenateachmomentthesystemconstructsandevaluatesmorethansixmillioncombinations(even assuming that all options are included in combinations in equalproportions). If an unequal ratio for different options within the samecombination is allowed (as is the case in partially directional strategies; seesection1.3),thesystemcreatesareallyhugenumberofcombinations.Ofcourse,thereisnoreasontoconsiderallrandomlygeneratedcombinations.

The developer usually limits his system to those combinations whose payofffunctions correspond to the trading strategy. These potentially appropriatecombinations will be further filtered by liquidity, spread, pending corporateevents, fundamental characteristics, and many other parameters. Nevertheless,afterallfiltrations,theinitialsetofsuitablecombinationswillcompriseaboutamillion variants. Such variety is unattainable for stocks, commodities,currencies,oranyothernonderivativeassets.

Page 23: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

1.2.Market-NeutralOptionTradingStrategiesMarket-neutral positions are relatively insensitive to the direction of price

fluctuations.Withregardtooptions,thismeansthatasmallchangeinthepriceoftheunderlyingassethasnosignificanteffectonpositionvalue.Ifalargepricemovementdoesaffecttheposition,itsvaluechangesbyapproximatelythesameamount regardless of the direction of pricemovement. Themain tool used increatingmarket-neutralstrategiesistheindexdelta.Thepositionisconsideredtobemarket-neutralifthecumulativedeltaofallitscomponentsequalszero.Suchapositioniscalled“delta-neutral.”Wewillusebothterms(“market-neutrality”and“delta-neutrality”)interchangeably.

1.2.1.BasicMarket-NeutralStrategy In this sectionwedescribe the generaland, in many respects, the simplest form of a market-neutral strategy.Considering the basic form of this strategy is useful for understanding itsspecific properties, for analysis of its main structural elements, and forcomparisonwithotherclassesofoptiontradingstrategies.Signals for positions opening. Position opening signals are generated

according to a single indicator. For the basic strategy, we have chosen the“expectedprofitonthebasisoflognormaldistribution”criterionasanindicator.The opening signal is generated if the criterion value calculated for a givenoption combination exceeds the predetermined threshold value. The range ofallowablevaluesforthethresholdparameterstretchesfromzerotoinfinity.Theexact threshold value is determined by optimization. Opening signals arecalculateddailyandpositionsareopenedforallcombinationsreceivingtradingsignals.Signals for positions closing. All positions that have been opened are held

untilexpiration.Aftertheexpiration,allpositionsinunderlyingassets,resultingfromexecutionofoptionsthathaveexpiredin-the-money,areclosedatthenexttradingday.Indicators used to generate signals. The algorithm for calculating the

“expectedprofitonthebasisoflognormaldistribution”criterionisdescribedinour previous book (Izraylevich and Tsudikman, 2010). Computation of thiscriterion requires two parameters: the expected value of the underlying assetprice and the variance of the normal distribution of the stock price logarithm.Theformerparameterisusuallysetaprioribythestrategydeveloperaccordingtotheprinciplesofscientificapproach.Asappliedtoamarket-neutralstrategy,itwould be reasonable to assume that the expected price is equal to the currentunderlying asset price as of the criterion calculation date.Thismeans that the

Page 24: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

currentpriceisconsideredtobethemostaccurateestimateofthefutureprice.(The alternative approach is to set this parameter by applying some expertforecasts or different instruments of fundamental and technical analyses.) Thevalueofthesecondparameterisgenerallycalculatedasthesquareofhistoricalvolatility of the underlying asset price. This parameter includes an additionalsubparameter: the lengthof thehistoricalperiodused tocalculatevolatility. Inmostcasesthehistoricalhorizonissetempiricallythroughoptimization(forthebasicstrategywefixitfor120days).Theuniverseofinvestmentassets.Theinitialsetofinvestmentassetsthatare

bothallowableandavailableforthebasictradingstrategyincludesalloptionsonstocks in the S&P 500 index. As a unit of the investment object, we set acombination of options (rather than a separate option) relating to a specificunderlying asset. The acceptable types of option combinations are limited tolongandshortstranglesandstraddles.Requirementsandrestrictions.Takingintoaccounttheliquidityandslippage

risks,thebasicstrategyislimitedtousingthestrikepricesthatdonotgobeyond50% from the current underlying asset price (that is, themaximum allowablevaluefortheparameter“strikesrange”is50%).Forthesamereason,wesetthemaximumallowablevalueforthetimelefttooptionsexpirationat120workingdays. These restrictions on the ranges of permissible values follow from ourprior experience (that is, the scientific approach is used).The exact values forthese parameters have to be determined through optimization (that is, byapplyingtheempiricalapproachmethods).Moneymanagement.Withregardtothebasicstrategy,theproblemofmoney

management is reduced to distributing funds between risk-freemoneymarketassets and the investment portfolio (see Chapter 4, “Capital Allocation andPortfolioConstruction,” for details). At eachmoment in time, after new opensignalshavebeengenerated,thesystemdetermineswhichpartofunusedcapitalshould be invested in these new positions. For the basic form of themarket-neutral strategy, we adopt the simplest rule. The capital is distributed equallyamong all trading days within the operating cycle of the strategy (operatingcyclesaredeterminedbytheexpirationdates).Withineachtradingdayallfundsavailableatthatdayareinvested.Capital allocation within the investment portfolio. Distribution of capital

between different option combinations is based on the principle of stockequivalency(seeChapter4fordetails).Accordingtothisprinciple,thepositionvolumeisdeterminedinsuchamannerthatshouldtheoptionsbeexercised,the

Page 25: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

funds required to fulfill the obligation (that is, to take either a longor a shortposition in the underlying asset) will be approximately equal for eachcombination.Riskmanagement.Asitfollowsfromthenatureofamarket-neutralstrategy,

themain guideline of riskmanagement is adherence to the principle of delta-neutrality. Consequently, the main instrument of the risk management for thebasicstrategyistheindexdelta(foradescriptionofindexdelta,seeChapter3,“Risk Management”). When setting values for different parameters, thedevelopershouldwatchthattheindexdeltaoftheportfolioisequalorclosetozero.Otherriskmeasures,includingValueatRisk(VaR),asymmetrycoefficient,andlossprobability,areusedasadditionalriskmanagementtools(thesegaugeswillbediscussedindetailinChapter3).

1.2.2.PointsandBoundariesofDelta-NeutralityIntheprecedingsectionwedescribedthemainelementsofdelta-neutralstrategies.Onecaneasilysee thateven the simple basic version of this strategy has a fairly large number ofparameters forwhichdefinitevalueshave tobesetandfixed.Thepresenceofjustseveralparametersmeansthatthereisahugenumberofdifferentvariantstocombinetheirvalues(itincreasesaccordingtothepowerlaw).Thesituationisfurthercomplicatedbythefactthatformostcombinationsofparametervalues,delta-neutralityisnotattainable.In the basic delta-neutral strategy there are three parameters that directly

influencethestructureandthemainpropertiesoftheportfolio:•The thresholdvalueof thecriterion that isused togenerate signalsforpositionsopening•Therangeofstrikepricesthatareusedtocreateoptioncombinations•Optionseriesusedtocreatecombinations(thisparameterdeterminesthetimelefttotheoptionexpirationdate)

When setting these parameters, the developer of the trading strategy mustconsidertheirinfluenceonsuchimportantportfoliocharacteristicsastherelativefrequency of long and short positions, diversification, and risk indicators.However,therelationshipsbetweentheportfoliodeltaandthevalueofeachofthese threeparameters (and theirvariouscombinations)mustbeestablished inthe first place.After all, if formost acceptable parameter values the portfolioindexdeltadeviatesfromzerosignificantly,thedelta-neutralstrategycanhardlybecreated.Each combination of parameter values for which the delta-neutrality

Page 26: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

conditionisfulfilled(theportfoliodeltaiszero)willbecalledthepointofdelta-neutrality. The whole set of such points composes the boundary of delta-neutrality.Letusconsiderseveralexamplesofdeterminingthepointsofdelta-neutrality.

Suppose that inorder togenerate tradingsignalsweevaluate the setofoptioncombinations created for all stocks of the S&P 500 index. The valuation isperformed using the “expected profit on the basis of lognormal distribution”criterion (according to the procedure described in the preceding section).Assumethatthe“strikesrange”parameterisfixedat10%(optioncombinationsareconstructedusingstrikessituatedintherangeof10%oftheunderlyingassetprice). Several values of the “time left to options expiration” parameter areexamined: one week and one, two, and three months until expiration. Todetermine the points of delta-neutrality on January 11, 2010, we generatedtradingsignalsforthefollowingexpirationdates:January15,2010(oneweektoexpiration),February19,2010(onemonthtoexpiration),March19,2010(twomonthstoexpiration),andApril16,2010(threemonthstoexpiration).The points of delta-neutrality have to be determined for thewhole range of

criterion thresholdvalues.Toperform thisprocedure,weneed to establish therelationship between the index delta and the criterion threshold. Figure 1.2.1shows these relationships for four expiration dates. Points that lie at theintersectionof the chart line and thehorizontal axis are delta-neutral (in thesepoints the indexdeltaequalszero).Accordingly,each intersectionpoint showsthe threshold value for which the condition of delta-neutrality is met (thecriterionthresholdisequaltothecoordinateatthehorizontalaxis).

Page 27: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.1.Relationshipsbetweentheindexdeltaandthecriterionthresholdparameter.The“strikesrange”parameterisfixedat10%.Each

chartshowstherelationshipforoneoffourvaluesofthe“timetoexpiration”parameter.Eachintersectionofthechartlineandthe

horizontalaxisrepresentsthepointofdelta-neutrality.

In four particular cases shown in Figure 1.2.1, delta-neutrality is achievedwith the threshold values ranging from 2% to 10% (criterion values areexpressedasapercentageoftheinvestmentamount).Inthecasewhenonlyoneweek is leftuntilexpiration(theupper-leftchartofFigure1.2.1), there isonlyone delta-neutrality point (situated at the threshold value equal to 9%). Thismeans that if we build option combinations using this time series and usingstrikepriceslocatedinsidetherange{underlyingassetprice±10%},andifwe

Page 28: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

selectcombinationsforwhichthecriterionvalueisequaltoorgreaterthan9%,theportfoliowillbedelta-neutral.Agreatnumberofdelta-neutralitypoints existwhen theportfolio is created

usingoptionswithonemonthlefttoexpiration(sincethedeltalinecrossesthehorizontalaxismanytimes).Intersectionsarelocatedinarathernarrowrangeofcriterionthresholdvalues.Figure1.2.2showsthisrangeonalargerscale,whichenablesustodistinguisheachseparatepointofdelta-neutrality.Altogetherthereare16 suchpoints situatedwithin the interval 5% to8%. (Inotherwords, thecriterion threshold values for which delta-neutrality condition is fulfilled arelocatedinsidetherangeof5%to8%.)Inthecasewhenthevalueofthe“timeleft to options expiration” parameter was set at twomonths, there were threepointsofdelta-neutrality(thebottom-leftchartinFigure1.2.1).Whenitwassetat three months, five delta-neutrality points were observed (the bottom-rightchartinFigure1.2.1).

Figure1.2.2.Relationshipbetweentheindexdeltaandthecriterionthresholdparameterwhentheportfolioiscreatedusingoptionswithonemonthleftuntilexpiration.Onlytherangeofcriterionthresholdvalues

withpointsofdelta-neutralityisshown.

Itisimportanttonotethatasthevalueofthe“criterionthreshold”parameterincreases, the index delta of the portfolio consisting of options with closeexpirationdateschangesinaverywiderange.Atthesametime,thedeltaofthe

Page 29: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

portfolioconsistingofdistantoptionserieschangesinamuchnarrowerinterval(comparethetop-leftandbottom-rightchartsinFigure1.2.1).Thereasonisthat,all other things being equal, the option delta increases as the expiration dateapproaches (if the option is in-the-money and there is little time left toexpiration,itsdeltavergestoward+1forcalloptionsor–1forputoptions).Thisbringsustoanimportantconclusion:Whenaportfolioiscreatedusingoptionswith a close expiration date, a small deviation from a given combination ofparametervalues (forwhichaportfolio isexpected tobedelta-neutral)bringsabout greater deviation fromdelta-neutrality thanwhen long-termoptions areused.Nowwe turn to the procedure of finding the boundaries of delta-neutrality.

First we fix one parameter, time to expiration, and examine all possiblecombinationsofvaluesfortwootherparameters,criterionthresholdandrangeofstrikeprices.Toperformthisprocedure,weneedtocalculatetheindexdeltaforall {criterion threshold × strikes range} variants at the whole range of theiracceptable values. Then this data should be presented in the form of atopographicmapwherehorizontalandverticalaxescorrespondtothevaluesofparametersunder investigationandeachpointon themapexpresses theheightmarkcorrespondingtotheindexdeltavalue.Pointswiththesameheightmarkson thismap represent isolines.The isolinegoing throughzero level isadelta-neutralityboundary.Figure1.2.3showsanexampleofsuchatopographicmap.Inthisexamplethe

“timetoexpiration”parameterissetatoneweek.(Weusedthesamedataasforthetop-leftchartinFigure1.2.1;theportfoliocreationdateisJanuary11,2010,and the expiration date is January 15, 2010.) The delta-neutrality boundarytraversesthemapdiagonallyfromthetop-leftcornertothebottom-rightcorner.Portfolios with positive values of index delta are situated to the right of theboundary;portfolioswithnegativedeltaarelocatedtoitsleft.Whenthecriterionthresholdvalue isvery low(left edgeof themap), theportfoliosdelta reacheshighlynegativevalues.

Page 30: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.3.Anexampleofthetopographicmapshowingtheboundaryofdelta-neutrality.

Notethat the top-leftchart inFigure1.2.1corresponds to thehorizontal lineonthemap(inFigure1.2.3)passingthroughthestrikesrangeof10%.Thatis,ifwemakeanincisionatthislineanddepictitssideview,wewillobtainaprofilematchingtheindexdeltalineshowninFigure1.2.1.Thus,thewholesetofdelta-neutralitypointscanbeconsolidatedtoformtheboundariesofdelta-neutrality.ItfollowsfromthetopographicmappresentedinFigure1.2.3 that thedelta-

neutralportfoliocanbecreatedwitharatherlargenumberof{criterionthreshold× strikes range} alternatives. For example, we can build the portfolio usingoption combinations for which the criterion value is higher than 5%, and therangeof strikeprices is fairlywide (price±20%).At the same time,wemayprefer another delta-neutral portfolio consisting of combinations with highcriterion values (e.g., higher than 15%). In this case, however, wemust limitourselvestoarathernarrowrangeofstrikeprices(price±6%).This method of finding delta-neutrality boundaries is based on the visual

analysis. Itwas selected tomake the description simple and clear. In practice,however, we do not need to visualize boundaries; they can be determinedanalytically using computer algorithms. At the same time, building suchtopographicmapsmaybeusefulinperceivingparameters’interrelationshipsandselectingtheiracceptablevaluesranges.Undoubtedly, neither trading strategy can be grounded on a single instance

analysis similar to the one depicted in Figure 1.2.3. The main quality ofautomated trading is that all decision-making algorithms are based on broadstatistical material. It should be considered whether the location of delta-neutrality boundaries depends on market conditions. It would be logical to

Page 31: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

supposethatinperiodsofhighvolatilitytheboundariesaredifferentfromthoseinperiodsofacalmmarket.Forthatveryreasonwenowpassontoanalyzingdelta-neutrality boundaries on the basis of broader statistical data, includingcalmaswellasextremeperiods.

1.2.3.AnalysisofDelta-NeutralityBoundariesInthissectionweanalyzetheeffectoftimelefttooptionsexpirationandthatofmarketconditionsprevailingatthemomentofportfoliocreationonthedelta-neutralityboundaries.Twotimeperiods and two states of underlying assets market will be studied. Timeintervalswillbefixedatoneweekandtwomonthsbetweenthepositionopeningand the expiration date. For each of these time intervals, delta-neutralityboundarieswillbeexaminedduringacalmmarketwithlowvolatilityaswellasduringextremelyvolatileperiods.Foreachofthesefour{timeperiod×stateofmarket} variants, we will build 12 delta-neutrality boundaries (relating todifferent expiration dates). For the calmmarketwewill use data fromMarch2009 to February 2010. For the volatile market the data referring to the lastfinancialcrisis(January2008toDecember2008)willbeused.The top chart in Figure 1.2.4 shows 12 delta-neutrality boundaries for

portfolios created during the calm period using options with the nearestexpiration date. Although boundaries do not coincide (which is quite naturalsince theyallcorrespond todifferentexpirationmonths), thegeneralpattern isclear enough and allows making several important conclusions. Firstly, allboundaries are situated approximately in the same area. Secondly, mostboundaries have a similar shape,which ismore or less stretched toward highcriterionthresholdvalues.Thirdly,mostboundariesarelocatedintheareaoftherather narrow strikes range (although in some cases they have “appendices”extending toward wider ranges). Such a form of boundaries indicates that inperiods of calm market, the fulfillment of a delta-neutrality condition forportfoliosconsistingofoptionswithacloseexpirationdateispossibleinquiteawiderangeofcriterionthresholdvalues,butthisrequiresusinganarrowrangeofstrikeprice.

Page 32: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.4.Delta-neutralityboundariesofportfolioscreatedduringacalmmarketperiod.Thetopchartshowsportfoliosconstructedofoptionswithoneweeklefttoexpiration.Thebottomchartshowsportfolioscreatedusingoptionswithtwomonthstoexpiration.Eachboundaryreferstoa

separateexpirationdate.

Delta-neutrality boundaries relating to portfolios created in a calm periodusing options with a relatively distant expiration date have a fundamentallydifferentappearance(thebottomchartinFigure1.2.4).First,itshouldbenoted

Page 33: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

thatdelta-neutralityboundarieswereobtained inonly8outof12cases. In theother 4 cases delta-neutrality appeared to be unattainable at any of the points.Second, boundaries related to different expirationmonths overlap to a smallerextent as compared to the boundaries observed for portfolios consisting ofoptionswith thenearestexpirationdate (compare thebottomand topcharts inFigure 1.2.4). This means that as the time period until options expirationincreases, the variability of delta-neutrality boundaries also increases.Nonetheless, it ispossible todistinguishanareawheremostof theboundariesare situated. It represents a ratherwide band passing diagonally from the lowcriterionthresholdvalueandnarrowstrikesrangetothehighthresholdvalueandwide strikes range. This pattern differs widely from the case of portfoliosconstructedofoptionswiththenearestexpirationdatewherethedelta-neutralityareawasnearlyparallel to the criterion threshold axis (the top chart inFigure1.2.4).Thesepropertiesofdelta-neutralityboundariessuggestthattheselectionofahighercriterionthresholdforcreationofadelta-neutralportfolio(incalmmarketsandusingoptionswithdistantexpirationdates) requireswidening thestrikesrange.Nowweturntotheperiodofhighvolatility.Whentheportfolioconsistedof

optionswiththenearestexpirationdate,delta-neutralitywasachievedin7outof12cases (the topchart inFigure1.2.5).Forportfolios constructedusing long-termoptions, thedelta-neutralitywas even less attainable (inonly5outof12cases; see the bottom chart in Figure 1.2.5). In one of these five cases, theboundary is very short. During high-volatility periods, the shape of delta-neutralityboundariesdependsonthetimeuntilexpirationtoalesserextentthanduringcalmmarkets.ThisconclusionfollowsfromthesimilarityofthetopandbottomchartsinFigure1.2.5(thechartsinFigure1.2.4differtoamuchgreaterextent). The only difference between the time-to-expiration periods is higherpositioningofboundariesalong theverticalaxisobservedforportfolioswithamore distant expiration date (the bottom chart in Figure 1.2.5). This indicatesthatusing awider strikes range is required to achieve delta-neutrality duringvolatilemarketsifportfoliosaretobeconstructedofmoredistantoptions.

Page 34: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.5.Delta-neutralityboundariesofportfolioscreatedduringavolatilemarketperiod.Thetopchartshowsportfoliosconstructedof

optionswithoneweeklefttoexpiration.Thebottomchartshowsportfolioscreatedusingoptionswithtwomonthstoexpiration.Eachboundary

correspondstoaseparateexpirationdate.

Duringextrememarket fluctuations, theshapeofdelta-neutralityboundarieslookssimilartotheshapeofboundariesobtainedintheperiodofcalmmarkets.However, theseboundariesdonot stretch that far along the criterion threshold

Page 35: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

axis(compareFigures1.2.4and1.2.5).Thismeans thatduringvolatilemarketperiods, building delta-neutral portfolios using option combinations withexclusivelyhighcriterionvaluesisimpossible.

1.2.4. Quantitative Characteristics of Delta-Neutrality Boundaries VisualanalysisofboundariessimilartothoseshowninFigures1.2.4and1.2.5isvivid,but is inevitably prone to the influence of subjective factors dependingon theindividual perception of the researcher. Besides, visual analysis is limited byhuman abilities and cannot cover big datasets.To create an automated tradingsystem, thedeveloper shouldbe able to analyzedelta-neutralityboundariesonthebasisofquantifiablenumericalcharacteristics.We developed a methodology for describing delta-neutral boundaries by

meansoffourquantitativecharacteristics:1.Thecriterion threshold index determines thepositionof thedelta-neutrality boundary relative to the criterion threshold axis. Thischaracteristic is calculated by averaging the coordinates on thehorizontal axis of the topographic map for all points of the delta-neutralityboundary.2. The strikes range index determines the position of the delta-neutralityboundaryrelativetothestrikesrangeaxis.Thisindicatoriscalculated by averaging the coordinates on the vertical axis of thetopographicmapforallpointsofthedelta-neutralityboundary.3.Thelengthof thedelta-neutralityboundarydescribes the lengthofthe boundary. The value of this indicator is equal to the number ofpointscomposingthedelta-neutralityboundary.4. The delta-neutrality attainability characterizes the possibility ofcreating delta-neutral portfolios. This indicator expresses thepercentageofcasesforwhichdelta-neutralityisachievable.

Let us apply this methodology to the delta-neutrality boundaries shown inFigures1.2.4and1.2.5.CriterionthresholdandstrikesrangeindexesareshowninFigure1.2.6.Here, each boundary thatwas presented earlier as isoline (seeFigures1.2.4and1.2.5)isreducedtoasinglepoint.Eachofthesepointscanbeviewed as a kind of a center of the area bounded by the delta-neutralityboundary.Ofcourse,reducingtheboundarytoasinglepointcutsthequantityofinformation contained in theoriginal data.Nonetheless, almost all conclusionsmadeearlieronthebasisofvisualanalysisofFigures1.2.4and1.2.5canequallybedrawnfromthedatapresentedinFigure1.2.6.

Page 36: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.6.Presentationofdelta-neutralityboundariesassinglepointswithcoordinatescorrespondingtocriterionthresholdandstrikesrange

indexes.EachpointcorrespondstooneoftheboundariesshowninFigures1.2.4and1.2.5.

Reducing delta-neutrality boundaries to points enables simultaneouscomparisonof a largenumberof boundarieswithin the scopeof one complexanalysis.This can be illustrated by an example of expanded analysis coveringtenyearsofhistoricdata.TwosamplesweretakenfromthedatabasecontainingthepricesofoptionsandtheirunderlyingassetsfromMarch2000toApril2010.Onesamplecorrespondstotheperiodoflowvolatility(whenhistoricvolatilitydidnotexceed15%);theotherone,totheperiodofhighvolatility(withhistoricvolatility of more than 40%). Within each sample, we created two portfoliovariants.Oneofthevariantsconsistedofthenearestoptionsexpiringinonetotwoweeks;anothervariantconsistedofdistantoptionsexpiringintwotothreemonths.Bothportfolioversionswerecreatedusingsignalsforpositionsopeninggeneratedbythebasicdelta-neutralstrategy.Figure1.2.7 shows criterion threshold and strikes range indexes for eachof

the portfolios obtained in this study. Analysis of these data (here we rely onvisualanalysis, though inpractice itcanbereplacedbyacomputeralgorithm)allowsustodrawanumberofimportantconclusionsregardingtherelationshipsamongdelta-neutralityboundaries,marketvolatility,andtimeleftuntiloptions

Page 37: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

expiration:•Duringcalmperiods,delta-neutralityboundariesaresituatedinthearea of low criterion threshold values (regardless of the time periodleftuntilexpiration).ThisconclusionisbasedonthelocationoffilledcirclesandtrianglesintheleftpartofFigure1.2.7.• During high-volatility periods, the position of delta-neutralityboundariesisquiteunsteadyinrelationtothecriterionthresholdaxis,but in most cases has a propensity for the area of low values. Thisconclusion is based on the location of contour circles and trianglesalong thehorizontal axis (with their predominance at the left part ofthisaxis)inFigure1.2.7.•Thetimeleftuntiloptionsexpirationdoesnotinfluencethepositionofdelta-neutralityboundariesrelative to thecriterion thresholdaxis.Delta-neutrality can be achieved in the widest interval of thresholdvalues.ThisconclusionisbasedonthelocationofcirclesandtrianglesalongthehorizontalaxisinFigure1.2.7.•Forportfoliosconsistingofoptionswiththenearestexpirationdate,delta-neutrality is attainable on the condition that a narrow strikesrange is used. This conclusion (which is accurate for both calm andvolatile markets) is based on the location of filled and contourtrianglesintheareaoflowvaluesrelativetotheverticalaxisinFigure1.2.7.•Ifportfoliosarecreatedduringvolatileperiodsusingdistantoptions,delta-neutralityboundariesaresituatedmostlyintheareaofaveragestrikesrangevalues.ThisconclusionisbasedonthelocationofmostofthecontourcirclesapproximatelyinthemiddleoftheverticalaxisinFigure1.2.7.•During low-volatility periods, only portfolios (consisting of distantoptions) that were created using a wide strikes range can be delta-neutral.ThisconclusionisbasedonthelocationofthefilledcirclesintheareaofhighvaluesoftheverticalaxisinFigure1.2.7.

Page 38: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.7.Presentationofdelta-neutralityboundariesassinglepointswithcoordinatescorrespondingtothecriterionthresholdandstrikesrange

indexes.Thedatarelatestoaten-yearhistoricalperiod.

Now we turn to the length of delta-neutrality boundaries. As mentionedearlier, this characteristic expresses the number of points composing theboundary.Thelongertheboundary, themorevariantsofdelta-neutralportfoliocanbecreatedbymanipulatingcriterionthresholdandstrikesrangevalues.Firstwe analyze the interrelationships between theboundary length and the

twocharacteristicsthatwerediscussedpreviously:criterionthresholdandstrikesrangeindexes.Figure1.2.8showstherelationshipbetweentheboundarylengthand itsposition in the topographicmap.The longestboundariesaresituated intheareaofhighcriterionthresholdvaluesandlowvaluesofstrikesrange.Thismeans that in order to obtain a longer delta-neutrality boundary, the strategyshoulduseanarrowstrikes rangeandselectcombinationswithhighcriterionvalues.Thiswillbroaden thechoiceofdelta-neutralportfolios,which, in turn,will allow selecting a portfolio with characteristics thoroughly satisfying therequirementsofthetradingsystemdeveloper.

Page 39: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.8.Relationshipsbetweenthelengthofthedelta-neutralityboundaryandtheindexesofcriterionthresholdandstrikesrange.Thedata

relatestoaten-yearhistoricalperiod.

Thedependenceofthedelta-neutralityboundarieslengthonmarketvolatilityand time left until options expiration is presented inFigure1.2.9.The longestboundariesareobservedwhenthevolatilityishighandthetimeleft tooptionsexpirationisrathershort(about20days).Ifthetimetoexpirationislessthan20days,theboundarylengthdecreases.Moredistantoptions(morethan20daystoexpiration) also shorten the delta-neutrality boundary. Thus, during high-volatilityperiods,thelargestnumberofvariantsofdelta-neutralportfoliosexistswhenthetimeofpositionsopeningisseparatedfromtheoptionsexpirationdatebyabout10to30tradingdays.

Page 40: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.9.Relationshipsbetweenthelengthofthedelta-neutralityboundary,thenumberofdaysleftuntiloptionsexpiration,andmarket

volatility.Thedatarelatestoaten-yearhistoricalperiod.

As volatility decreases, the length of the delta-neutrality boundary alsodecreases(seeFigure1.2.9).Thisrelationshipdoesnotdependonthenumberofdays left to options expiration. However, when positions are opened shortlybefore the expiration, the boundary shortensmore slowly. Evenwhen historicvolatilitydecreasestoabout20%,thelengthofthedelta-neutralityboundarystillremains within average values. Under extremely low volatility the boundaryshortenstoaminimallengthatthewholerangeoftime-to-expirationvalues.Insome cases the shortening of the delta-neutrality boundaries can be so drasticthat thewholeboundaryshrinkstoa tinygroupofpoints.Anexampleofsuchextremelyshortboundarywasshownearlierfortheportfoliocreatedduringthecrisisperiodusinglong-termoptions(thebottomchartinFigure1.2.5).Inextremecasesdelta-neutralityboundariesmayshrinktozero.Insuchcases

we say that delta-neutrality is unattainable. Let us examine whether theattainabilityofdelta-neutralitydependsonthenumberofdaysleftuntiloptionsexpirationandonmarketvolatility.Totestthis,weagaintooktwosamplesfromtheten-yeardatabase.Oneofthemwastakenfromthedatapertainingtoacalmmarketperiod (historicvolatility<15%); anotherone, from thehigh-volatilitydata(historicvolatility>40%).Twoportfoliovariantswerecreatedwithineachsample:oneconsistingofshort-termoptionsandanotheroneconstructedusing

Page 41: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

distant options (one to two weeks and two to three months to expiration,respectively). According to the definition given earlier, delta-neutralityattainabilitywasestimatedthroughthenumberofcases(portfolios)whendelta-neutralitywasachievedatleastatonepoint.Itwasexpressedasapercentageofthetotalnumberofcases.Statistically significant inverse relationshipswere discovered betweendelta-

neutralityattainabilityandthenumberofdaysleftuntiloptionsexpiration(foracalmperiodt=9.12,p<0.0001;foravolatileperiodt=15.24,p<0.0001;seeFigure 1.2.10). Delta-neutrality appeared to be attainable in almost all caseswhenportfolioswerecreatedjustseveraldaysbeforeexpiration.Movingawayfrom expiration reduces delta-neutrality attainability. When portfolios werecreated using long-term options (with more than 100 working days left untilexpiration), delta-neutrality was attainable in only 40% to 80% of cases(dependingonmarketvolatility).Valuesofdeterminationcoefficients(0.60forahigh-volatilityperiodand0.35foracalmperiod) indicate that35% to60%ofvariability indelta-neutralityattainability is explainedby the timeperiod frompositions opening to options expiration. Thus, using the nearest optionsguaranteesthatmostportfolioswillbedelta-neutral.

Page 42: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.10.Relationshipbetweendelta-neutralityattainabilityandthenumberofdaysleftuntiloptionsexpirationduringcalmandvolatile

markets.Thedatarelatestoaten-yearhistoricalperiod.

Market volatility influences the relationship between delta-neutralityattainability and the number of days left to options expiration.This is evidentfrom the distribution of data points in the two-dimensional coordinate systemandthedivergenceofregression linesrelating todifferentvolatility levels(seeFigure1.2.10).Slopecoefficientreflectingtherelationshipthatexistedduringavolatile market is less than the coefficient relevant to a calm market. Thisdifference in regression line slopes is statistically significant (t = 2.76, p <0.0065).Hence,delta-neutralityattainabilitydependsonthestateofthemarket:underhigh-volatilityconditionstheprobabilitytoattaindelta-neutralityislower.The impact of volatilityon the attainabilityof delta-neutrality increases as thetimeleftuntiloptionsexpirationincreases.Table 1.2.1 summarizes the analysis of delta-neutrality characteristics

conducted in this section. It presents the effects ofmarket volatility and timeperiodfromportfoliocreationtooptionsexpirationonthedelta-neutralityborder

Page 43: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

location, its length, anddelta-neutrality attainability.This table canbe used inthefollowingway.Letuspresumethatcurrentmarketvolatilityishighand,forsomereasonorother,theportfolioiscreatedusingoptionswithcloseexpirationdate.Insuchcircumstances,wecandeducethefollowing:

•Delta-neutralitycanbeachievedwithinthebroadintervalofcriterionthreshold values (denoted in the table as “variable criterionthreshold”).• To obtain a delta-neutral portfolio, we have to use strike pricessituatedclosetothecurrentunderlyingassetprice(denotedinthetableas“narrowstrikesrange”).•Theprobabilitytoattaindelta-neutralityinthegivencircumstancesishigh(denotedinthetableas“highdelta-neutralityattainability”).•Thereisagreatnumberofvariantsofdelta-neutralportfolio(denotedinthetableas“longdelta-neutralityline”).

Table1.2.1.Dependenceofdelta-neutralitycharacteristics(delta-neutralityboundary[DNB]location,DNBlength,anddelta-neutrality

attainability[DNA])onmarketvolatilityandtimefromportfoliocreationtooptionsexpiration.

1.2.5.AnalysisofthePortfolioStructureInprevioussectionswediscussedtheissueofdelta-neutrality attainability and analyzedvarious factors affecting theposition and length of delta-neutrality boundaries. We determined how toincrease the number of available variants of the delta-neutral portfolio bymanipulatingthreemainstrategyparameters.Alleffectswereexaminedforbothvolatileandcalmmarkets.Oftenwehaveachoicebetween(atleast)severalalternativecombinationsof

parameter values that can be equally used to create a delta-neutral portfolio.

Page 44: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

However, thestructureandpropertiesoftheseportfolioswillbedifferent.Thisdiversityinvitesthequestionofhowtoselectsuchacombinationofparametersthat would produce a portfolio satisfying the requirements of the strategydeveloperasmuchaspossible.To describe the general structure and the main properties of an option

portfolio,wewillusethefollowingcharacteristics:• The number of combinations in a portfolio (which expresses thediversification level, thenumberof trades,and,hence, theamountofslippageandoperationalcosts)• The number of different underlying assets in a portfolio (whichrepresents an additional indicator of the diversification level and thenumberoftrades)• Proportions of long and short combinations in a portfolio (whichdescribeportfoliostructure)•Proportionsofstraddlesandstranglesinaportfolio(whichdescribeportfoliostructure)• The extent of portfolio asymmetry (in addition to index delta, thischaracteristic expresses, in a different way, the degree of market-neutralityoftheportfolio)•LossprobabilityandVaR(whichexpressportfoliorisk)

Inthissectionweanalyzetheeffectsoffourmainparameters(strikesrange,criterion threshold, time to expiration, and market volatility) on thesecharacteristics. Since, as we will show shortly, many characteristics changesignificantlydependingon the criterion threshold and strikes rangevalues, theanalysiswillbelimitedtotheintervalofvaluesoftheseparametersfrom0%to25%. Otherwise, it would not be possible to distinguish the tendencies inchangesofthecharacteristicsinthecharts.Thisstudyisbasedondatapertainingtobothacalmperiodwithlowvolatility

andacrisisperiodwithextrememarketfluctuations.Twotimeintervalsfromthemomentofportfoliocreationtooptionsexpirationareanalyzed(oneweekandtwomonths).PortfoliosrelatedtoacalmmarketwerecreatedJanuary11,2010;the expiration dates are January 15, 2010 (one-week options), andMarch 19,2010 (two-month options). Portfolios related to volatile market were createdNovember 17, 2008; expiration dates are November 21, 2008 (one-weekoptions),andJanuary16,2009(two-monthoptions).NumberofCombinationsinthePortfolio

Page 45: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

The shapes of surfaces shown in Figure 1.2.11 demonstrate the extent ofinfluence exerted by different parameters on the characteristic under scrutiny.The number of combinations in the portfolio reaches its maximum when thelimitationsimposedonstrategyparametersareminimal:Thecriterionthresholdisthelowest(thismeansthatallcombinationswithpositiveexpectedprofitareincludedintheportfolio);thestrikesrangeiswide(meaningthatthemaximumnumberofstrikepricesisusedtocreatecombinations);andthetimeleftuntiltheexpirationdateislong.Thisholdstrueforbothcalmandvolatilemarkets.

Figure1.2.11.Dependenceofthenumberofcombinationsincludedintheportfolioonthecriterionthresholdandstrikesrange.Twomarket

conditions(calmandcrisis)andtwotimeperiodsfromthetimeofportfoliocreationuntiloptionsexpiration(one-weekandtwo-month)areshown.

Chartsrelatingtothecalmmarket(theleft-handchartsinFigure1.2.11)show

Page 46: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

that increasing the criterion threshold leads to an exponential decrease in thenumberofcombinationsintheportfolio.Narrowingthestrikesrangealsobringsaboutadecrease in thequantityofcombinations, though thisdecrease ismoregradual. The surface relating to portfolios created using the nearest optionsduring the volatile market (the top-right chart in Figure 1.2.11) shows theapproximately equal effect of both parameters on portfolios diversification.Whenlong-termoptionsareusedduringcrisisperiods(thebottom-rightchartinFigure1.2.11), a rising criterion threshold leads to a smoother decrease in thenumberofcombinationsthanthenarrowingofstrikesrangedoes.Inperiodsofcalmmarket, the leastnumberofcombinations isobtained for

portfolioscreatedclosetotheexpirationdate(thetop-leftchartinFigure1.2.11).Whenmoredistantoptionsareused(thebottom-leftchartinFigure1.2.11),thenumberofcombinationsincreasessignificantly.Thesametrendswereobservedduringvolatileperiods.However,thedifferencebetweenportfolioscreatedclosetoexpiration (the top-rightchart inFigure1.2.11)and far fromexpiration (thebottom-rightchartinFigure1.2.11)isnotassubstantialaswasnotedinthecaseofthecalmmarket.Besides,portfoliosconstructedofthenearestoptionscontainfewercombinationsduringthecalmmarketthanduringthecrisisperiod(thetopchartsinFigure1.2.11).Theoppositeistrueforportfolioscreatedusingdistantoptions: In calm market conditions they consist of more combinations thanduringvolatileperiods(thebottomchartsinFigure1.2.11).Thesepatternsholdfor all criterion thresholds and all strikes range values, though they aremorepronouncedatlowercriterionthresholdsandwiderstrikeranges.NumberofUnderlyingAssetsinthePortfolio

This characteristic represents another important indicator of diversification.Since fluctuations of underlying asset prices are among the main factorsinfluencing profits and losses of delta-neutral option portfolios, diversificationcan reduce unsystematic risk significantly. At the same time, redundantdiversificationmayhaveanegative impact since it requires a largenumberofexcessivetrades(therebyincreasinglossesduetoslippageandoperationalcosts)whilebringingaboutonlyasmallriskdecrease.Duringcalmperiods, thenumberofunderlyingassets inaportfoliodepends

only on the criterion threshold and the time left to options expiration. Thebreadth of strikes range does not influence diversification of the portfolioconsisting of the nearest options (the top-left chart in Figure 1.2.12). Whendistantoptionswereusedtoconstructaportfolio,onlyaweakeffectofstrikesrangecanbedistinguished in theshapeof thesurface(thebottom-leftchart in

Page 47: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure 1.2.12). Under the lowest criterion threshold value, the number ofunderlyingassetsmaybeveryhigh,ifaportfolioiscreatedusingoptionswiththenearestexpirationdate.Forthecriterionthresholdvalueof1%,thisnumberreachesabout400outofapossible500(rememberthatthisstudyislimitedtostocks included in theS&P500 index).However, evena slight increase in thecriterion threshold leads to a dramatic nonlinear decrease in the quantity ofunderlying assets. When the threshold value is raised to 3%, the number ofunderlyingassetsfallsto50;foran8%thresholditdoesnotexceed20.Asimilarpattern is observed when the portfolio was created using distant options.However,inthiscaseabitmoreunderlyingassetscorrespondtoeach{criterionthreshold×strikesrange}combination.Thisconclusionissupportedbythelessconcavesurfaceshapeofthebottom-leftchartinFigure1.2.12.Itshouldalsobenotedthatwhentwo-monthoptionsareusedtoconstructtheportfolioduringacalm market, the widening of the strikes range entails the increase (althoughinsignificant)inthequantityofunderlyingassets.

Page 48: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.12.Dependenceofthenumberofunderlyingassetsonthecriterionthresholdandstrikesrange.Twomarketconditions(calmand

crisis)andtwotimeperiodsfromthetimeofportfoliocreationuntiloptionsexpiration(one-weekandtwo-month)areshown.

Inperiodsofhighvolatility,thepictureisquitedifferent.Whentheportfolioconsistsofthenearestoptions,thecriterionthresholdandstrikesrangeinfluencethenumberofunderlyingassetssimilarly.Diversificationreachesitsmaximumatlowercriterionthresholdvaluescombinedwithawiderstrikesrange.Theflatplateau on the top-right chart in Figure 1.2.12 attests to this conclusion.Increasingthecriterionthresholdandcurtailingthestrikesrangeleadtoasharpdecrease in the quantity of underlying assets. When combinations are

Page 49: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

constructedoflong-termoptions,theeffectofthecriterionthresholdonportfoliodiversification is insignificant. In such circumstances themain parameter thatdeterminesthenumberofunderlyingassetsisthestrikesrange(thebottom-rightchartinFigure1.2.12).ProportionsofLongandShortCombinations

Thischaracteristic expressesoneof the fundamentalqualitiesof theoptionsportfolio.Ontheonehand, theproportionsof longandshortpositionsdirectlyinfluence the risk aswell as thepotential profitabilityof theportfolio. (Recallthatprofitabilityof shortcombinations is limitedwhile their loss ispotentiallyboundless.On thecontrary, longcombinationshave limiteddownside riskandunlimitedupsidepotential.)Ontheotherhand,therangeofacceptablevaluesforthischaracteristicisdeterminednotonlybyitsinfluenceonprospectiveriskandreturn, but also by many additional factors. They include various restrictionsimposedbyin-houseinvestmentpoliciesandexternalregulators(whichmaybeconsideredasobjectivelimitingfactors),aswellaspsychologicalconstraintsofthestrategydeveloper(subjectivelimitingfactor).During high-volatility periods, all portfolios are composed mostly of short

combinations(apartfromrareexceptions).Forthisreasonwedonotpresentthecharts related to crisis periods in Figure 1.2.13. The prevalence of shortcombinationsduringextrememarketfluctuationsisacommonoccurrence.Thishappens mostly due to the fact that option premiums (implied volatility) riserapidly during crises, while historical volatility (which is estimated usinghistorical price series that includes both current [volatile] and previous [calm]subperiods) increases more slowly. Consequently, most criteria have highervaluesforshortcombinations.Nevertheless,evenduringhigh-volatilityperiods,delta-neutral portfoliosmay include a certain (though limited) number of longcombinations. (After all, the examples presented in this section are limited toonly two expiration dates.)

Page 50: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.13.Dependenceofthepercentageofshortcombinationsonthecriterionthresholdandstrikesrange.Twotimeperiodsfromthetimeof

portfoliocreationuntiloptionsexpirationareshown.

Incalmmarketconditionsthepercentageofshortcombinationsdependsonlyon the criterion threshold value. The breadth of strikes range has almost noinfluenceonthecharacteristicunderscrutiny(seeFigure1.2.13).Toexaminetherelationship between the percentage of short combinations and the criterionthreshold, and to compare different time periods left to options expiration,wereduced surfaces shown in Figure 1.2.13 to lines. It was accomplished byaveragingdata related todifferent strikes rangevalues.Since the strikes rangehas no effect on the percentage of short combinations, this procedurewill notleadtolossesofinformation.AverageddatapresentedinFigure1.2.14evidencethatthepercentageofshort

combinations in the portfolio reaches its maximum at low-criterion thresholdvalues. Inportfolios consistingof short-termoptions, thispercentage is higher(more than80%) than in portfolios constructedof optionswith amoredistantexpiration date (about 70%). The increase in criterion threshold leads to thedecrease in the percentage of short combinations. If the portfolio consists ofoptions with the nearest expiration date, the share of short combinationsdecreasesatamuchfasterrate(exponentially).Furthermore,whenthecriterionthresholdexceeds15%,thepercentageofshortcombinationsdecreasestozero.(Thismeansthatiftheportfolioincludesonlythosecombinationsforwhichthecriterionvalue exceeds15%, then short combinations fullydisappear from theportfolio.)Whentheportfolioiscomposedofmoredistantoptions,thedecrease

Page 51: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

in the percentage of short combinations is gradual (almost linear). At thecriterion threshold value of 15%, more than a quarter of the portfolio stillconsistsofshortcombinations.

Figure1.2.14.Relationshipbetweenthepercentageofshortcombinationsandthecriterionthreshold.Twotimeperiodsfromthetimeofportfolio

creationuntiloptionsexpirationareshown.ProportionsofStraddlesandStrangles

The relative frequency of different types of option combinations in theportfoliodoesnotdependonthecriterionthresholdvalue.Ontheotherhand,thebreadthofthestrikesrangeinfluencestheproportionsofstraddlesandstranglessignificantly.Asimilar(butopposite)situationhasbeendetectedinthepreviouscase, in which relative frequencies of long and short combinations did notdepend on the strikes range, but were determined solely by the criterionthreshold value. By analogy with that previous case, we have averaged datarelating to different criterion threshold values. This enables us to betterrecognize the relationship between the percentage of straddles in the portfolioand the breadth of the strikes range, and to compare this relationship withindifferenttimeintervalstooptionsexpirationandindifferentmarketconditions.Inallsituationstheshareofstraddlesintheportfoliodecreasesasthestrikes

range increases (seeFigure1.2.15).Thisphenomenoncanbeexplainedby thefactthatifonlyanarrowrangeofstrikepricesisallowed,thenjustafewstrikes(or even only one strike) can get there. The fewer the strike prices that areavailabletocreatecombinations,thefewerthestranglesthatcanbeconstructed

Page 52: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

(and the higher the percentage of straddles in the portfolio). During calmmarkets, the decrease in the share of straddles is nonlinear—widening of thestrikes rangeup to 8% to 10%brings about a sharp and rapid decrease in thepercentageofstraddles.However, furtherwideningof therangedoesnotexertsignificantinfluenceonthischaracteristic.Whenthestrikesrangeiswidenedto25%, the proportion of straddles falls to 8% (for portfolios consisting of two-month options) and 19% (for portfolios constructed of one-week options).During high-volatility periods,widening the strikes range leads to a smoother(almost linear)decrease in theshareof straddles (seeFigure1.2.15).The timeleft to options expiration has almost no influence on the dynamics of thischaracteristic.

Figure1.2.15.Relationshipbetweenthepercentageofstraddlesandthestrikesrange.Twomarketsituations(calmandcrisis)andtwotimeperiodsfromthetimeofportfoliocreationuntiloptionsexpiration(one-weekand

two-month)areshown.PortfolioAsymmetry

This characteristic represents a special coefficient (described in detail inChapter3).Itexpressestheextentofasymmetryoftheportfoliopayofffunctionrelative to the current value of a certainmarket index. Symmetry of a payofffunctionimpliesthattheportfoliovaluewillchangebyapproximatelythesameamount regardlessofwhether themarket isgoingupordown(if theextentofmarket growth and decline is similar). If the symmetry is violated, the payoff

Page 53: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

function is biased relative to the current index value, and the asymmetrycoefficient reflects thedegreeof this bias.Since the concept underlyingdelta-neutral strategies is based on market neutrality principles, the asymmetrycoefficientisanimportantindicatorthatcharacterizesthebalancingofthedelta-neutralportfolio.During calmmarkets, the asymmetry of portfolios created using the nearest

options was rather low for almost all {criterion threshold × strikes range}combinations.However,atlow-criterionthresholdvaluesandwidestrikesrange,theasymmetrycoefficient turnedout toberelativelyhigh(the top-leftchart inFigure 1.2.16).When long-term options are used to construct a portfolio, thechart surface changes fromconcave to convex (thebottom-left chart inFigure1.2.16).Thismeans that portfolio asymmetrygets higher atmediumvaluesofcriterion threshold and strikes range. In such circumstances (calmmarket andlong-termoptions)thesymmetrypersistsintwoareas:(1)atalmostallcriterionthreshold intervals (given that the strikes range is rather narrow) and (2) atalmostallstrikesrangevalues(giventhatthecriterionthresholdishigh).

Page 54: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.16.Dependenceoftheasymmetrycoefficientonthecriterionthresholdandstrikesrange.Twomarketconditions(calmandcrisis)andtwotimeperiodsfromthetimeofportfoliocreationuntiloptionsexpiration

(one-weekandtwo-month)areshown.

In periods of high volatility, the most asymmetrical portfolios are obtainedwhenapplyingminimalcriterionthresholdvaluesandmaximalrangesofstrikeprices(theright-handchartsinFigure1.2.16).However,whileincalmtimestheasymmetry of portfolios consisting of the nearest optionswas generally lowerthan that of the portfolios constructed using long-term options, in volatilemarkets the picture is different. For all combinations of {criterion threshold×

Page 55: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

strikesrange},portfolioscreatedusingone-weekoptionsarelesssymmetricthanportfoliosconstructedoftwo-monthoptions(comparethetop-rightandbottom-rightchartsinFigure1.2.16).LossProbability

Thisisanimportantcharacteristicexpressingtheriskof theoptionportfolio(its calculation methodology is described in Chapter 3). The top-left chart inFigure 1.2.17 relates to portfolios created in a calmmarket using the nearestoptions.Thesurfaceofthischartformsquiteabroadplateau.Thisimpliesthatloss probability remains monotonously high in wide intervals of criterionthreshold and strikes range values. For portfolios consisting of combinationswith criterion values exceeding 15% and strikes range wider than 18%, lossprobability is about 60% to 65%.As the criterion threshold decreases and thestrikes range narrows, loss probability diminishes. However, even under themost favorable combinationof parameter values, loss probability doesnot fallbelow40%.

Page 56: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.17.Dependenceofthelossprobabilityonthecriterionthresholdandstrikesrange.Twomarketconditions(calmandcrisis)andtwotimeperiodsfromthetimeofportfoliocreationuntiloptionsexpiration

(one-weekandtwo-month)areshown.

Comparisonofthesurfacethathasjustbeendescribedwiththechartrelatedtoportfolioscomposedofoptionswithadistantexpirationdate(thebottom-leftchart inFigure1.2.17) reveals the following.Despite the general similarity ofthe two surfaces, there is one important difference between them.When long-termoptionsareusedtoconstructaportfolio,thewideplateaucorrespondingtotheareaofhighlossprobabilityturnsintoasmallpeak.Thismeansthatinsuchcircumstances there are many fewer {criterion threshold × strikes range}

Page 57: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

combinations forwhich loss probability reaches its highest level. The descentfrom the area of the most probable loss is steeper than it was in the case ofportfoliosconsistingofthenearestoptions.Asaresult,quiteabroadareawithrelatively low lossprobabilities is formed.This area covers criterion thresholdvaluesfrom0%to8%combinedwithstrikesrangevaluesfrom0%to5%.Duringcrisisperiods(therightchartsinFigure1.2.17),thelossprobabilityis

significantlylowerascomparedtothecalmmarketconditions.Atfirstsightthisseems illogical and suggests that there should be an error in probabilityestimates.However,thisphenomenoncaneasilybeexplainedbythefactthatinan extreme market a portfolio consists primarily of short positions (this wasdiscussedearlierinthissection).Lossprobabilityofshortoptioncombinationsismuch lower than thatof longones.This is evidencedby thedatapresented inFigure 1.2.18 (although this figure shows only one example, similar patternswere observed in all other cases that had been examined in the course of thisstudy). It also follows from Figure 1.2.18 that loss probability of shortcombinationsdepends stronglyon the criterion thresholdvalue (thehigher thethreshold, the lower the loss probability), but does not depend on the strikesrange. For long combinations the opposite relationship is observed: Lossprobability is independentof thecriterionthreshold,butdependsonthestrikesrange(thewidertherange,thehigherthelossprobability).

Figure1.2.18.Dependenceofthelossprobabilityonthecriterionthresholdandstrikesrangeasobservedduringcalmmarket,when

portfolioswereconstructedofoptionswithtwomonthslefttoexpiration.

Page 58: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Longandshortpositionsarepresentedseparately.

Inavolatilemarketthelossprobabilityofportfoliosconstructedoftheshort-termoptionsreachesitsmaximumat lowvaluesofcriterionthresholdandatawide range of strike prices (the top-right chart in Figure 1.2.17). This patterndiffers from the picture observed in calmmarket conditions (the highest lossprobabilitytherewasinlinewithhighcriterionthresholdvalues;seethetop-leftchart inFigure1.2.17).Loss probability of portfolios created during a volatileperiod using long-term options depends neither on criterion threshold nor onstrikesrange.Thehorizontalpositioningandtheflatshapeofthesurfaceofthebottom-rightchartinFigure1.2.17confirmthat.VaR

Thiswidelyknownriskindicatordoesnotneedspecialpresentation,althoughitscalculationforoptionportfolioshasmanyspecificpeculiarities.Figure1.2.19shows that regardless of market conditions and irrespective of time left untiloptionsexpiration,portfolioVaRishigheratlowervaluesofcriterionthreshold.This holds true for almost all ranges of strike prices, although there are someexceptions. In particular, when portfolios are constructed of distant options(regardless of market volatility) and combinations are created using strikessituated in thenarrowrangearoundthecurrentpricesofunderlyingassets, thecriterionthresholddoesnotexertanyinfluenceontheVaRvalue.

Page 59: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.2.19.DependenceofVaRonthecriterionthresholdandstrikesrange.Twomarketconditions(calmandcrisis)andtwotimeperiodsfromthetimeofportfoliocreationuntiloptionsexpiration(one-weekandtwo-

month)areshown.

Acomparisonofportfoliosconstructedofthenearestoptionsduringthecalmperiod (the top-left chart in Figure1.2.19) and during an extrememarket (thetop-right chart in Figure 1.2.19) reveals that in the latter caseVaR is slightlyhigher given the {low criterion threshold × wide strike price range}combination.However,whenthecriterionthresholdishigh,VaRislowerduringcrisis than in calmmarket conditions.Whenportfolios consist ofmore distant

Page 60: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

options, the effect of market volatility becomes more distinct. Under allcombinations of {criterion threshold × strikes range}, the VaR of portfolioscreated during the volatile period (the bottom-right chart in Figure 1.2.19) ishigher than the VaR of portfolios created in the period of calm market (thebottom-leftchartinFigure1.2.19).Surprisingly, the effect of the timeperiod left to options expiration ismuch

more pronounced than the effect ofmarket volatility.When long-termoptionsare used instead of short-term contracts, the VaR of all portfolios multipliesmanytimes.Thisholdstrueforbothcalmandextrememarketconditions.

1.3.PartiallyDirectionalStrategiesThe main difference between partially directional and market-neutral

strategies is that the forecast (predicting thedirection andmagnitudeof futurepricemovements) is among the basic elements of the former strategy. At thesame time, the index delta (assessing the extent of market neutrality) alsorepresents a constituent element of partially directional strategies. Althoughreducing delta to zero is not obligatory, observance of the delta-neutralitycondition(orminimizingdelta,ifdelta-neutralityisunattainable)whilecreatingtheoptionportfolioishighlydesired.

1.3.1. Specific Features of Partially Directional Strategies At first glance,simultaneousapplicationof the twobasicprinciplesof thepartiallydirectionalstrategies—reliance on forecasts and adherence to market-neutrality—contradicts their inner logic. On the one hand, partially directional strategy isexpected tobenefit fromchanges in theunderlyingassetprices (if theforecastturnsouttobetrue,thevalueoftheoptionportfolioshouldincreaseasaresultofpricechanges).Ontheotherhand,effortstowardattainingthedelta-neutralityimplythatthestrategydevelopertendstocreateaportfoliothatisinsensitivetounderlying asset price changes. This seeming contradiction disappears ifforecastsareapplied toseparatecombinations,while the indexdelta isusedatthe portfolio level. Applying forecasts to underlying assets of separatecombinations leads to creating market-non-neutral (skewed) combinations.Nevertheless, combining these individually skewed combinations may lead tocreationofamarket-neutralportfolio.(Ifmisbalancesofseparatecombinationshave opposite directions, unifying them should bring about construction of amarket-neutralportfolio.)Besides,thecontradictionbetweenusingforecastsandstriving for market-neutrality can be resolved naturally if we approach theproblem of price movements differentially, depending on the level of pricechanges.Letusrecallthatreducingdeltatozerominimizesthesensitivityofthe

Page 61: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

portfoliotosmallchangesinunderlyingassetprices.Onthecontrary,forecastsof price movements are oriented toward predicting medium and large pricechanges.Thus,minimizationofdelta ensuresaportfolio insensitivity to small,chaotic, and mostly unpredictable price fluctuations. At the same time, usingforecasts allows profiting from medium-and long-run price trends (if theirdirectionshavebeenforecastedcorrectly).Thispropertydifferentiatespartiallydirectional strategies from themarket-neutral ones, forwhich substantial pricemovements usually reduce a portfolio value regardless of the direction of theunderlyingassetpricechange.Therearevariousapproachestoforecastingthefuturepriceofanunderlying

asset.Ingeneral, theycanbedividedintotwomaincategories:forecastsbasedon technical analysis and forecasts based on fundamental analysis. Forecastsbelonging to the first category use various technical indicators, statisticalanalysis, and probability theory. These methods rely, for the most part, onprocessinghistoricaldatarelatingtoprice,volume,volatility,andsoforth.Thesecond category includes forecasts built on the basis of macro-andmicroeconomic indicators.Whenstocksareusedasunderlyingassets (mostofthe examples in this book use this class of underlyings), fundamental analysisreliesonestimatingmarketconditions,growthpotential,andcompetitioninthesector under scrutiny. It requires studying financial statements, consideringdifferentexpertforecastsandmanyotherinformationsources.

1.3.2. Embedding the Forecast into the Strategy Structure Whichevermethodsoffundamentalortechnicalanalysisareused,theresultingforecasthastobequantifiable (that is, itmustbeexpressednumerically). Inparticular, theforecastmaybepresentedinoneofthefollowingforms:

•Themostprobabledirectionoffuturepricemovement•Therangeofprobablefutureprices•Severalpricerangeswithprobabilitiesassignedtoeachofthem•Probabilitiesofeachpossiblepriceoutcome

In the last case the forecast represents a probability distribution, which iscreated by assigning the probabilities to the entire range of the discrete priceseries. (For continuous price such a forecast is presented in the form of aprobabilitydensityfunction.)Thistypeofforecastispreferablesinceitcontainsthegreatestvolumeofinformationrelatingtoexpectedpricemovementsoftheunderlyingasset.Inourfurtherdiscussionwewilluseforecastsexpressedintheformofeitherdiscretedistributionorprobabilitydensityfunction.

Page 62: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

There are several possible ways to embed the forecast into the strategystructure. Let us recall that signals for positions opening are generated on thebasisofspeciallydesignedvaluationcriteria,mostofwhichareintegralsoftheoption combination payoff function over specific distribution. Hence, forecastincorporationintotheprocedureofthegenerationoftradingsignalscanbedoneinoneoftwoways:

1. Adjustment of the discrete distribution (or probability densityfunction)accordingtotheforecast2.Changingofthestructureofthecombinationinawaythatalignstheformofitspayofffunctionwiththeforecastasmuchaspossible

Thecombinedapplicationofthesetwomethodsisalsofeasible.Letusconsiderthefirstmethod(embeddingtheforecast intothestrategyby

adjusting thedistributionaccording to the forecast). For example, the strategydevelopermayrelyontheforecastpredictingthattheunderlyingassetpricewillriseby10%.Supposethathistradingsystemgeneratespositionopeningsignalsbycalculatingthecriterionbasedonlognormaldistribution.Inthisdistributionanexpectedpriceof theunderlyingasset isoneof the twoparameters.Earlierwementioned that for amarket-neutral strategy the value of this parameter isusually set to be equal to the current price as of the moment of criterioncalculation.Inthecaseofapartiallydirectionalstrategy,theexpectedpricemaybe estimated as the current price plus expected increment (10% in this case).This will shift the whole probability density function to the right (since theforecastpredictsapriceincrease).Embeddingtheforecastintothestrategystructurebyadjustingthedistribution

isshowninFigure1.3.1.Blacklinesdepicttheprobabilitydensityfunctionsoflognormal distribution and the payoff function of the “butterfly” combination(whichpresumablyhasthehighestcriterionvalueascomparedtootheravailableoption combinations). Embedding the forecast shifts the probability densityfunction (thenew function is shownby the light-colored line inFigure1.3.1).Consequently, the criterion value is no longer maximal for the combinationdepictedby thebrokenblack line.Nowanothercombination(the light-coloreddottedline)withthepayofffunctionthatfitsthenewdistributionbetterhasthehighest criterionvalue.Thus,embedding the forecast bymeans of distributionadjustment leads to the selection of other combinations (not those that wouldhavebeenselectedwithouttheforecast).

Page 63: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.3.1.Probabilitydensityfunctionoflognormaldistributionandthepayofffunctionofthecombinationwiththehighestcriterionvalue

(blacklines).Embeddingtheforecastshiftstheprobabilitydensityfunction,whichleadstotheselectionofanothercombination(light-coloredlines).

The second method of embedding the forecast into the strategy consists inmodifying the combination structure. Consider a forecast that indicates a highprobability for the growth of the underlying asset price. For an opening shortstrangle(orstraddle)positionsuchaforecastmaybeembeddedbycreatingtheasymmetricalcombination,whereinthenumberofcalloptionssoldislowerthanthenumberofshortputs.Ifthetradingsignalrequiresenteringthelongposition,thenumberofcalloptionsboughtshouldbehigherthanthenumberoflongputs.A great number of methods can be invented to embed the forecast into the

strategy structure either by adjusting the distribution or by changing thecombination structure (or by combining these two approaches). The examplesusedinthissectiontoillustrateourdiscussionofpartiallydirectionalstrategiesarebasedonthefollowingprinciples.Weconstructtheforecastsoffuturepricemovements on the basis of analysis of historical price series. For eachunderlying asset the probability of a certain price change is estimated by

Page 64: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

assessingtherelativefrequencyofsuchoutcomesobservedduringapredefinedtime period (called “historic horizon”). After that, frequencies of past pricemovements obtained in this way are gathered into a discrete probabilitydistribution (called “empirical distribution”), or they can be used to create adensityfunction.Suchanapproachassumesthatprobabilitiesofdifferentpricemovements can be predicted by the frequency of their past realizations. ThepropertiesoftheempiricaldistributionandthemethodofitsconstructionweredescribedbyIzraylevichandTsudikman(2009,2010).In contrast to lognormal distribution, the probability density function of

empirical distribution has an irregular shape, with numerous local peaks andbottoms,andinmostcasesisasymmetrical(seeFigures1.3.2and1.3.3).Theseirregularities reflectpastprice trends.Forexample, theskewingofdistributiontotherightorpresenceoflocalpeaksontherightsideofthedistributiondenotetheprevalenceofuptrendsinthepast.Thus,presentingtheforecastintheformof the empirical distribution can be regarded as an adjustment of standardlognormaldistribution.

Figure1.3.2.ProbabilitydensityfunctionofempiricaldistributionofIBMstockandpayofffunctionsofthreevariantsofthecombination“long

strangle.”Thevariantsdifferbythecall-to-putratio.Thesuperiorvariant(havingthehighestcriterionvalue)isshownwiththeboldlight-coloredline.

Page 65: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.3.3.ProbabilitydensityfunctionofempiricaldistributionofGooglestockandpayofffunctionsofthreevariantsofthecombination

“shortstrangle.”Thevariantsdifferbythecall-to-putratio.Thesuperiorvariant(havingthehighestcriterionvalue)isshownwiththelight-colored

line.

In addition to the distribution adjustment, we will also modify thecombinationstructure (that is, acombinedapproach toembedding the forecastintothestrategywillbeimplemented).Althoughacombinationstructurecanbemodifiedinseveralways,wewillusethesimplestapproach,whichcanbeeasilycoupled with the empirical distribution—creating asymmetrical combinations.To apply this approach, several variants have to be created for each optioncombination.Thesevariantswilldiffer fromeachotherby therelativeratioofcall and put options (in the examples relating to amarket-neutral strategy theequal ratiowasused).Thecriterionvalue iscalculated foreachvariantof thiscombinationandthevariantwiththemaximalcriterionvalueisselected.Letusconsiderseveralexamples,inwhichthenumberofvariantsislimitedto

threecall-to-putratios:3:1,1:1,and1:3.Supposethatweneedtoselectthebestvariant of the long strangle for IBM stock. Figure1.3.2 shows the probabilitydensityfunctionofempiricaldistribution(constructedonthebasisofa120-day

Page 66: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

historical period) and payoff functions for three variants of this combination(constructedusing strikepricesofput125 and call 130).ThedistributionwascreatedonApril1,2010.TheexpirationdateoftheoptionsisApril16,2010.Inthis example the highest value of “expected profit on the basis of empiricaldistribution”criterionwasobtainedforthecombinationconsistingofthreecallsandoneput.The superiorityof this particular variant canbe explainedby theshapeofempiricaldistribution,whichisskewedtotheright(besides,thereisalocalpeakontherightsideofthisdistribution).Suchashapeoftheprobabilitydensityfunctionforecaststheincreaseoftheunderlyingassetprice.Hence,thelongcombination, inwhich thenumberof call options exceeds thenumberofputs,hashigherprofitpotential(iftheforecastturnsouttobecorrect).In thenextexampleweusedGooglestockas theunderlyingasset.Suppose

that this time the best variant has to be selected for another type of optioncombination, the short strangle. The probability density function of empiricaldistributionandpayofffunctionsof threestranglevariantsareshowninFigure1.3.3.AsintheprecedingexamplethedistributionwasconstructedonApril1,2010.All threecombinationvariantswerecreatedofoptionsexpiringonApril16,2010(usingstrikepricesofput560andcall570).Althoughtheappearanceof empirical distribution differs from the shape of distribution observed in theprecedingexample (compareFigures1.3.2 and1.3.3), it is also skewed to theright. This means that the forecast embedded into the partially directionalstrategyindicatesahighprobabilityoftheunderlyingassetpriceappreciation.Insuch circumstances it would be reasonable to sell more put options. If theforecastcomes true, thestockpricewill riseand the loss incurredby theshortcallwill be lower (because thisoptionwas sold in lessquantity).At the sametime, short puts will most likely expire out-of-the-money and thereby willproduce higher profit (since they were sold in greater quantity). In fullcompliance with this logic, the highest criterion value is obtained for thecombinationvariantwitha1:3call-to-putratio.

1.3.3. The Call-to-Put Ratio at the Portfolio Level Up to this point weconsideredtherelativefrequenciesofcallandputoptionsatthelevelofseparatecombinations.Whenthecall-to-putratiodeviatesfrom1:1,thepayofffunctionof the combination becomes asymmetrical (see Figures 1.3.2 and 1.3.3).Unifying several combinations may lead to noticeable transformation in theshapeoftheportfoliopayofffunction.Theresultingchangesinthepayoffformcanbeverydifferent.At theportfolio level thepayoff functionexpresses the relationshipbetween

portfolioprofits/lossesandacertainmarketindex.Tocreatesuchafunction,we

Page 67: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

needtoestablishtherelationshipsbetweentheindexvalueandprofits/lossesofall individual combinations composing the option portfolio. This can be doneusing the concept of beta (this issue is discussed in detail in Chapter 3). Thepayoff functions of separate option combinations constructed by applying thistechniqueare additive.Theirmere summationproduces thepayoff functionoftheresultingcomplexportfolio.Unifyinghomogenousoptioncombinations(thatis,combinationsofthesame

type with the same call-to-put ratio) gives rise to the payoff function thatresemblesthefunctionsofinputcombinations.Thelight-coloredlinesinthetop-leftchartofFigure1.3.4showthepayofffunctionsof twoshortstrangleswiththecall-to-putratioof1:3.Sucharatiocausestheleftpartsofbothfunctionstobecomesteeperascomparedtotheirrightparts(thisimpliesthatthedecreaseintheindexvalueresultsinhigherlossesthanitsincrease).Thepayofffunctionofthe portfolio (black line) consisting of these two combinations has a similarshape.

Figure1.3.4.Effectofthecombinationsasymmetry(resultingfrom

Page 68: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

unequalcall-to-putratios)andoftheratiooflongandshortcombinationsonthepayofffunctionoftheresultingportfolio.Payofffunctionsofseparatecombinationsareshownbylight-coloredlines;payofffunctionsofresulting

portfoliosareshownbyblacklines.

Ifthecall-to-putratiosofinputcombinationsaredifferent,thecharacteristicsof the resulting portfolio, including its payoff function, will depend on theweightedaverageoftheinitialratios.Forexample,unifyingtwoshortstrangleshaving the call-to-put ratios of 3:1 and2:3 leads to the creationof a portfoliowith a 5:4 ratio. The light-colored lines in the top-right chart of Figure 1.3.4show two short strangles with ratios of 1:3 and 3:1. Both combinations areasymmetricalbuttheyareskewedtodifferentsides.Unifyingsuchcombinationsresultsinanalmostsymmetricalpayofffunction(blacklineinthechart).Withinthe partially directional strategy this approach enables creating the optionportfolio, in which every element is an asymmetrical combination, butnevertheless the whole portfolio remains market-neutral (or approaches themarket-neutralityclosely).Earlier we stated that the relative ratio of long and short combinations

significantlyinfluencesitsmainproperties.Whenasymmetriccombinationsareallowed,thisstatementtakesonaspecialmeaning.Differentcall-to-putratiosinconjunctionwithdifferentproportionsoflongandshortcombinationsallowforcreatingagreatvarietyofshapesofportfoliopayofffunctions(sometimestheyassume very intricate forms). For example, unifying long and short strangleswiththecall-to-putratioof1:3generatesthepayofffunctionresemblingthatofthe “bull spread” combination (the bottom-left chart of Figure 1.3.4). At thesame time, adding more long or short combinations (thereby amending theresultingratiooflongandshortcombinations)maybringaboutthefundamentalchangeintheshapeoftheportfoliopayofffunction.Intheexamplepresentedinthe bottom-left chart of Figure 1.3.4, introduction of one additional longcombinationwithcall-to-putratioof2:3transformstheportfoliopayofffunctionandmakesitsimilartothetypicallongstraddle(thebottom-rightchartofFigure1.3.4).

1.3.4.BasicPartiallyDirectionalStrategySignals forpositionsopeningandclosing. Signals to open trading positions are generated by evaluating optioncombinations according to the values of the “expected profit on the basis ofempirical distribution” criterion. As mentioned earlier, using empiricaldistributionisregardedinthecontextofpartiallydirectionalstrategyasoneofthetwowaystoembedtheforecastintothestrategystructure.(Thesecondway,

Page 69: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

which is also used in the basic variant of this strategy, consists of creatingasymmetric combinations.)Theopening signal is generatedwhen the criterionvalueexceedsacertainthresholdvalue.Therangeofpermissiblevaluesforthethreshold parameter spans from zero to infinity. The exact threshold value isdetermined via optimization. Under the basic variant of partially directionalstrategy,openpositionsareholduntiloptionsexpiration.Aftertheexpiration,allpositions inunderlyingassets resulting from theexerciseofoptionsareclosedthenexttradingday.Criterionparameters.Thealgorithmforcalculationofthe“expectedprofiton

the basis of empirical distribution” criterionwas described by Izraylevich andTsudikman(2010).Incontrasttothelognormaldistribution,theempiricaloneisbasedona singleparameter: thehistoryhorizon (the lengthof thepriceseriesthat serves to construct the distribution). As in the case of the basic market-neutralstrategy,weset thevalueof thehistoryhorizonparameterat120days.Theforecasthorizon(numberofdaysfromthecurrenttimeuntilthefuturedateforwhich thedistribution isconstructed) isdeterminedautomaticallybyfixingthedateforwhichthecriterioniscalculated.Selection of option combinations. The initial set of underlying assets

availabletocreateoptioncombinationsincludesallstocksconstitutingtheS&P500index.Theacceptabletypesofoptioncombinationsincludelongandshortstrangles and straddles. Five variants of call-to-put ratios (one symmetric andfour asymmetric) are created for eachcombination:3:1,3:2,1:1,2:3,1:3.Foreach variant the criterion value is calculated, and then the variant with thehighest value is selected. If the criterion value obtained for the best variantexceeds the threshold value, the opening signal for this combination isgenerated.Under thisapproach theresultingratioofcallsandputs isnotsetapriori,butdependsonratiosofseparatecombinationsincludedintheportfolio.Hence,theextentoftheportfoliodivergencefrommarket-neutralityisnotsetaprioribythedeveloper,andtheindexdeltaisnotusedatthestageofportfolioformation(onlyforriskmanagement).Capital management and allocation within the investment portfolio. In a

basicvariantofthepartiallydirectionalstrategy,allavailablefundsareinvestedintheportfolio.Allfundsreleasedafterpositionsclosingarereinvested.Capitaldistributionbetweenportfolioelementsisbasedontheprincipleofequivalenceofstockpositions (thepositionvolume isset insuchamanner that should theoptionsbeexercised,theamountoffundsinvestedinallunderlyingassetswillbeapproximatelyequal;seeChapter4fordetails).Applyingthisprinciple toapartiallydirectionalstrategyiscomplicatedbytheinequalityofthecallandput

Page 70: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

quantities within a given combination. For asymmetrical combinations theamount of funds required to fulfill the obligation (or to exercise the right)dependsonwhichsideofthecombination,eithercallorput,isexercised(thatis,whichoftheoptionsisin-the-money).IfunusedcapitalatsomemomentintimeequalsC,andmopeningsignalshavebeengeneratedat that time, theposition

volumeforeachcombinationiswherer is the call-to-put ratio,Np andNc are the quantities of call and put

options included in thecombination,andScandSp are thestrikepricesofcallandputoptions,respectively.Riskmanagement. In contrast tomarket-neutral strategies, adherence to the

principle of delta-neutrality is not a compulsory condition in the riskmanagement of partially directional strategy. Nevertheless, the index delta, inthiscasetoo,remainsthemaininstrumentofriskassessmentandcontrol.Thisindicator evaluatespotential losses thatmaybe incurredunder adversemarketconditions. The index delta also expresses (indirectly) the extent of portfoliodisequilibriumandthedegreeofitspayofffunctionasymmetry.Otherindicators(VaR,lossprobability,andasymmetrycoefficient)arealsousefulinestimatingandmanagingtherisksofapartiallydirectionalstrategy.

1.3.5.FactorsInfluencingtheCall-to-PutRatioinanOptionsPortfolioThecall-to-put ratio strongly influences the shape of the portfolio payoff function.Various factors simultaneously influence the call-to-put ratio in the portfolio.Theeffectsofsomeofthemareillustratedhereforthebasicpartiallydirectionalstrategy. The statistical research presented next is based on the databasecontainingpricesofoptionsandtheirunderlyingassetsfromMarch2000untilApril2010.Duringthisperiod,wesimulatedoptionportfoliosaccordingtotheprinciplesstatedforthebasicstrategy.The“criterionthreshold”parameterwassetatzero(thatis,theopeningsignalsaregeneratedforallcombinationswithapositivecriterionvalue),andthe“strikesrange”parameterwassetat50%.The relative frequency of call and put options in the portfolio may be

expressedin threeways.Thiscanbeillustratedusingthedatapresentedin thebottom-right chart of Figure 1.3.4. This portfolio is composed of one shortcombinationwitha1:3call-to-putratioandtwolongcombinationswith1:3and2:3ratios.Thefirstmethodconsistsofasummationofallcallandputoptions.Inourexamplethisgivestheratioof4:9(or0.44).Thismethoddoesnotaccountforthefactthattheinfluenceofcalloptionsincludedintheshortcombinationonthe payoff function is neutralized to some extent by the influence of calls

Page 71: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

belonging to the long combinations. (The same is true regarding put options.)The second method consists of presenting the call-to-put ratios of shortcombinationsasnegativenumbers.Applicationofthisprincipletoourexampleproduces the ratioof2:3 (or0.67)because the short combinationwith the1:3ratioandthelongcombinationwiththesameratiooffseteachothercompletely.Under certain conditions the call-to-put ratio can be negative. If the portfolioconsistsofmanylongandshortcombinations,theirmutualoffsettingcandistortthe information about portfolio call-to-put ratio. This represents an essentialdrawbackof thesecondapproach.Forexample, if theportfolioconsistsof tenshortstrangleswitha1:1ratio, tenlongstrangleswiththesameratio,andonelong stranglewith a 1:2 ratio, the final call-to-put ratio is 1:2 (0.5).Does thisvaluereflecttherealsituation?It’squitedoubtful.In our opinion, it is preferable to use the third method of expressing the

relativefrequencyofcallsandputsintheoptionportfolio.Thismethodconsistsof calculating the call-to-put ratio separately for long and short positions.Thepercentageoflongandshortcombinationsintheportfolioshouldalsobetakeninto account. This approach enables expressing the effects of individualcombinations on the portfolio structure and on its payoff functions moreaccurately. The situation is complicated, however, by the fact that these twocharacteristics (the call-to-put ratio and the percentage of short combinations)areinterrelated.Webegin theexplorationof factors influencing thecall-to-put ratiowith the

percentageofshortcombinationsintheportfolio.Notethatthischaracteristicisnot really a “factor” as we generally understand this term. Speaking aboutfactors influencing the characteristic under scrutiny, we usually imply somevariable that is externalwith respect to the systemunder investigation and, inmostcases,independentofit.Inthebasicvariantofpartiallydirectionalstrategy,thepercentageof longand shortpositions isnot an independentvariable. It isdeterminedautomaticallyintheprocessofportfoliocreationanddependsonthealgorithmsused togenerateopeningsignalsandondifferentparametersof thetrading strategy. Besides, the percentage of short combinations can also beaffectedbymarketconditionsprevailingatthetimeofportfoliocreation.Thus,itwouldbemorecorrecttodiscusstheinterrelationshipbetweenthepercentageof short combinations and the call-to-put ratio rather than the influence of theformercharacteristiconthelatterone.It follows from Figure 1.3.5 that the higher the percentage of short

combinations in the portfolio, the higher the call-to-put ratio in these shortpositions. In caseswhen short combinations comprised less than60% to70%,

Page 72: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

they were significantly skewed toward the put side (puts outnumbered calloptions).However,thesituationchangedwhenshortcombinationscomprisedahigherpercentage.Inthesecasescallsbecameamajoritywithinshortpositions.Therelationshipwasthecontraryinlongpositions:Thehighertheproportionofshort combinations in the portfolio, the lower the call-to-put ratio in longcombinations. When shares of long and short positions were approximatelyequal (50% of short combinations), long combinations consisted primarily ofcalls (1.5 times more calls than puts), while short combinations were mainlyconstructedofputs(2timesmoreputsthancalls).

Figure1.3.5.Relationshipbetweenthecall-to-putratioandthepercentageofshortcombinationsintheportfolio.Thedata(presentedseparatelyforlongandshortpositions)relatestoaten-yearhistorical

period.

TocomprehendtheimplicationsoftherelationshipspresentedinFigure1.3.5forthebasicpartlydirectionalstrategy,weneedtoconsideranotherrelationship.Reviewing the properties of the basic delta-neutral strategy, we noted that inperiodsofhighvolatilityallportfoliosconsistedofalmostonlyshortpositions.For a partly directional strategy we also discovered the positive relationshipbetweenthepercentageofshortcombinationsandmarketvolatility(seeFigure1.3.6).This relationshipwasquiteweak forportfolioscreatedclose tooptions

Page 73: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

expiration (R2 = 0.06), but became stronger as the time left until expirationincreased(R2=0.18foratwo-tothree-monthperiod,R2=0.30forafour-tosix-monthperiod).

Figure1.3.6.Relationshipsbetweenthepercentageofshortcombinationsintheportfolioandthevolatilityoftheunderlyingassetsmarket.Threeperiodsfromthetimeofportfoliocreationuntiloptionsexpirationare

shown.Thedatarelatestoaten-yearhistoricalperiod.

Tracing the relationships shown in Figures1.3.5 and 1.3.6 brings about thefollowing chain of reasoning. During crisis periods, when market volatilityincreases significantly, the criterion generates signals to open mainly shortpositions. (It happens due to the sharp rising of option premiums in extrememarkets.)Basically, this seemsquite risky sinceduring a crisis there is a highprobability of great price drops that generally cause significant losses to shortoptionpositions.However,inthecaseofpartiallydirectionalstrategy,thisriskislargely offset by predominance of call options in short combinations duringperiods of high volatility. Since in a crisis period the risk of a sharp priceincreaseislowerthanthedeclinerisk,premiumsobtainedfromthesaleofextracalloptionsmaycompensate,atleastpartially,potentiallossesoccurringinthecaseofunfavorabledevelopmentstakingthemarketdown.Inlongpositions(incrisisperiodstherearefewofthem,butstilltherearesome),thenumberofputs

Page 74: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

is higher than the number of calls. This also diminishes the total risk of theportfolio because in the caseof amarket breakdown, excess put optionsyieldadditionalprofitwhichoffsetspartiallythelossesincurredbyshortpositions.Theseargumentssuggestthatthestructureofthepartiallydirectionalstrategy

contains a certain built-in mechanism providing for the skewness ofcombinations payoff functions in response to changes in market conditions(volatility jumps).Toverify this supposition,wehave toanalyze (directly) therelationship between the call-to-put ratio andmarket volatility. (Until nowweexaminedonlytheindirecteffectofvolatility.Itwasshownthatvolatilitymayinfluencetherelativefrequencyofcallandputoptionsthroughitsinfluenceonthe percentage of short combinations.) For long combinationswe detected theinversenonlinearrelationshipbetweenthecall-to-putratioandmarketvolatility(the left chart in Figure1.3.7). It should be noted that at low volatility levels(relatingtothecalmmarketconditions)theratiounderconsiderationfluctuatedinaquitewiderangeofvalues.However,duringcrisisperiods(athighvolatilitylevels) the quantity of puts in long combinations always outnumbered the callquantity (thisensures functioningofmechanismsallowingfor the reductionofrisks of short positions). As expected, a direct (also nonlinear) relationshipbetween the call-to-put ratio and volatility was discovered for shortcombinations(therightchart inFigure1.3.7).At lowvolatility levels theratiovaries in awide range,butusuallydoesnot exceedone (thismeans that shortcombinationsareskewedtowardaputside).However,volatilitygrowthleadstoa sharp increase in the call-to-put ratio.At extreme volatility values this ratioexceedsoneinmostcases.Thus,currentstudyprovidesratherstrongreasonstostate that the call-to-put ratio, changeable depending on market conditions,represents an automatic (that is, launching automatically during a crisis)regulatoroftheoptionportfoliorisk.

Page 75: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.3.7.Relationshipbetweenthecall-to-putratioandthevolatilityoftheunderlyingassetsmarket.Thedata(presentedseparatelyforlong

andshortpositions)relatestoaten-yearhistoricalperiod.

In conclusion of this study, let us consider the influence exerted by anotherimportantfactor, thenumberofdaysleftuntiloptionsexpiration.Theeffectofthisfactoronvariousaspectsofadelta-neutralstrategywasrepeatedlyshowninthe preceding section. Its influence is not less pronounced in the case of apartiallydirectionalstrategy.Closetotheexpirationdate,thecall-to-putratioissignificantlyhigherinlongthaninshortpositions(seeFigure1.3.8).Whilelongcombinationsduringthisperiodwereonaveragesymmetric(thecall-to-putratioapproximatelyequals1), in short combinations thenumberofputoptionswastwo times higher than the number of calls. Such a structure of shortcombinations,providinghigherprofitpotentialinagrowingmarket,reflectsthebullish trends that have prevailed in the stockmarket over the past ten years.(Recall that in thebasicvariant ofpartiallydirectional strategy, the forecast isembedded into the strategy by the use of empirical distribution that reflectstrendsprevailinginthemarketinthepast.)Eventhelastfinancialcrisishasnotchanged the bullish skewness of an average short combination constructed ofoptionswiththenearestexpirationdate,thoughitundoubtedlyhashadaneffectonvariabilityofthecall-to-putratio.

Page 76: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.3.8.Relationshipbetweenthecall-to-putratio(mean±standarddeviation)andthetimeleftuntiloptionsexpiration.Thedata(presentedseparatelyforlongandshortpositions)relatestoaten-yearhistorical

period.

Themore that distant options are used to create combinations, the less thedifferenceisinthestructureoflongandshortpositions.Figure1.3.8distinctlyshows twoopposite trends:Whereas in longcombinations the call-to-put ratiodecreases, in short combinations this characteristic grows as the time toexpirationincreases.Besides,itisnoticeablethatthevariabilityofthecall-to-putratio(showninFigure1.3.8withverticalbarsreflectingstandarddeviations)issignificantly higher in long combinations than in short ones. This differenceholds for the whole range of time periods left to option expiration. All theserelationships areof agreat importance for theoptimizationofparametersof apartiallydirectionalstrategy.

1.3.6.TheConceptofDelta-NeutralityasAppliedtoaPartiallyDirectionalStrategy Although the observance of the delta-neutrality principle is not anobligatorycondition(thekeyelementofthestrategyistheforecastofunderlyingassets prices), minimization of the index delta represents the second-most-importantcomponentofthepartiallydirectionalstrategy.Asaresultofforecastapplication, call-to-put ratios of individual combinations deviate from parity,which leads to an asymmetry of their payoff functions. By definition, suchcombinationscannotbemarket-neutral.Nevertheless,theportfolioconsistingofdifferent asymmetric combinationsmaybedelta-neutral (if the indexdeltas of

Page 77: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

separatecombinationshavedifferentsigns,theirsummaybeequaltoorclosetozero).Althoughthedeveloperofapartiallydirectionalstrategyshouldstriveforeffectiveembeddingoftheforecastintothestrategystructure,atthesametimeheneedstominimizetheportfolioindexdeltaasmuchaspossible.Areasonablecompromiseisrequiredhere;itseffectivenessdetermines,toalargeextent,thequalityofthestrategy.Considering the relationship between the relative frequency of call and put

optionsintheportfolioanditsindexdeltarevealsthefollowing.Inthosecaseswhen the call-to-put ratio is close to the parity, the index delta of shortcombinationsdivergesslightlyfromzero towardnegativevaluesandthe indexdelta of long combinations deviates in the opposite direction, toward positivevalues(seeFigure1.3.9).Hence,when thecall-to-put ratio isclose toone(forbothlongandshortpositions)andtheproportionsoflongandshortpositionsareapproximatelyequal,groupingallcombinationsshouldleadtothecreationofadelta-neutralportfolio.However,theconditionsunderwhichthedelta-neutralityof a partially directional portfolio may be attained are not limited to thesecircumstances.

Figure1.3.9.Relationshipbetweentheportfolioindexdeltaandthecall-to-putratio.Thedata(presentedseparatelyforlongandshortpositions)

relatestoaten-yearhistoricalperiod.

Page 78: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

We detected a direct relationship between the call-to-put ratio in longcombinationsand the indexdeltaof theportfolio.While theprevalenceofputoptions(call-to-put<1)leadstonegativedelta,thepredominanceofcalls(call-to-put>1)bringsittoapositivearea(seeFigure1.3.9).Forshortcombinationsthisrelationshipisopposite:thereisaninverserelationshipbetweenthecall-to-put ratio and the index delta. Puts predominance leads to positive delta; callsprevalence, to negative delta. The opposite directions of these relationshipssuggest that combining several portfolio variants (with different call-to-putratios) may lead to delta-neutrality of the global portfolio (despite significantdeviationsfromzeroindeltasofseparateportfolios).In the following text we present the extensive analysis of delta-neutrality

boundaries similar to the one shown earlier for a delta-neutral strategy. Twosamples,relatingtoperiodsoflowandhighvolatility,weretakenfromtheten-yeardatabase.Withineachsampletwoportfoliovariantswerecreated:portfoliosconsistingofcloseoptions(expiringinonetotwoweeks)andthoseconstructedof more distant contracts (two to three months until expiration). Each delta-neutrality boundary is described by four quantitative characteristics: criterionthresholdindex(determinesthepositionofthedelta-neutralityboundaryrelativetotherangeofallowablevaluesofthe“criterionthreshold”parameter);strikesrangeindex(determinesthepositionofthedelta-neutralityboundaryrelativetotherangeofallowablevaluesofthe“strikesrange”parameter);lengthofdelta-neutrality boundary (expresses the number of points composing the delta-neutralityboundary);anddelta-neutralityattainability(expressestheprobabilityofcreatingdelta-neutralportfolios).Figure 1.3.10 shows criterion threshold and strikes range indices. Visual

analysisofthesedatabringsustothefollowingconclusions:•Duringcalmmarketperiods,delta-neutralityboundariesaresituatedinaquitewiderangeofcriterionthresholdvalues.Thisconclusionisbased on the positioning of filled circles and triangles along thehorizontalaxisofFigure1.3.10.•During crisis periods, delta-neutrality boundaries are less variableby the criterion threshold value than during low-volatility periods.Thisconclusion isbasedon thepredominanceofcontourcirclesandtrianglesalongtheleftpartofthehorizontalaxisofFigure1.3.10.•Delta-neutrality boundaries of portfolios consisting of optionswiththenearestexpirationdateare located in theareaof lowercriterionthreshold values than boundaries of portfolios constructed of distant

Page 79: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

options.Thisconclusion(whichisaccurateforbothcalmandvolatilemarkets) is based on the positioning of circles to the left of thetriangleswithrespecttothehorizontalaxisofFigure1.3.10.•Thetimeleftuntiloptionsexpirationinfluencesthelocationofdelta-neutrality boundaries with respect to the strikes range axis.Boundariesofportfoliosconsistingofthenearestoptionsaresituatedintheareaoflowerstrikesrangevaluesthanboundariesofportfoliosformedofdistantoptions.Thisconclusion(whichholds trueforbothcalm and volatile markets) is based on the lower position of thetrianglesascomparedtothecircleswithrespecttotheverticalaxisofFigure1.3.10.• As compared to calm market conditions, during volatile periodsdelta-neutrality boundaries are located in the area of higher strikesrange values. This conclusion (which is accurate for portfoliosconstructedofbothnearestandmoredistantoptions) isbasedon thefactthatfilledcirclesandtrianglesarelocatedlowerthanthecontoursignswithrespecttotheverticalaxisofFigure1.3.10.

Figure1.3.10.Presentationofdelta-neutralityboundariesassinglepointswithcoordinatesmatchingthecriterionthresholdandstrikesrangeindexes.

Thedatarelatestoaten-yearhistoricalperiod.

Theconclusionsdrawnearlier fromasimilaranalysisof thedata relating tothe delta-neutral strategy (see Figure 1.2.7) differ in many respects from the

Page 80: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

findings of this study. This means that the effects of factors determining thepositionsofdelta-neutralityboundariesmayvarydependingontheclassoftheoptionstrategyunderconsideration.Hence,simultaneousapplicationofseveralheterogeneous strategies enables creating anautomated trading systemwith ahigh likelihood of constructing and maintaining portfolios that are globallydelta-neutralregardlessofexternalcircumstances(thatis,foralmostallpossiblecombinationsofinfluencingfactors).Now we turn to the issue of delta-neutrality boundaries length. This

characteristic is quite important since longer boundaries enable creatingmorevariants of a delta-neutral portfolio (by manipulating values of the “criterionthreshold”and“strikesrange”parameters).ThedependenceofboundarylengthoncriterionthresholdandstrikesrangeindexesisshowninFigure1.3.11.Thelongestboundariesaresituatedintheareaofhighcriterionthresholdvaluesandaverage values of strikes range. This means that to obtain a longer delta-neutrality boundary, it is necessary to select combinations with high criteriavalues and to use an intermediate range of strike prices. The lowering of thecriterionthresholdvalueleadstoshorteningofdelta-neutralityboundaries.Thesameeffectholdsfornarrowingorwideningthestrikesrange.

Figure1.3.11.Relationshipsbetweenthelengthofthedelta-neutralityboundaryandtheindexesofcriterionthresholdandstrikesrange.Thedata

relatestoaten-yearhistoricalperiod.

ParallelconsiderationofthedatapresentedinFigures1.3.11and1.2.8allowscomparison of two option strategies in terms of the potential effects of two

Page 81: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

parameters (criterion threshold and strikes range) on the length of delta-neutrality boundaries. Basically, the topographic maps shown in these twofigureslookquitesimilar.Theonlydifferenceconsistsintheeffectofthestrikesrange. For the delta-neutral strategy the longest boundary length is achievedunder a narrow strikes range,whereas for the partially directional strategy themaximization of the boundary dimension requires using an average range ofstrikeprices.Thedependence of the delta-neutrality boundary length onmarket volatility

and time left to options expiration is presented in Figure 1.3.12. The longestboundariesareobservedundertheconditionsofaveragevolatilityandshorttimetoexpiration.Ifportfoliosareconstructedusingoptionswith less than10daysleftuntilexpiration,theborderlineshortens.Usinglong-termoptions(morethan20daystoexpiration)leadstoasimilarresult.Regardlessofthetimeremainingtooptionsexpiration,thedelta-neutralityboundaryshortenswhenthevolatilitydeviatesfromitsaveragevalues(eitherincreasesordecreases).

Figure1.3.12.Relationshipsbetweenthelengthofthedelta-neutralityboundary,thenumberofdaysleftuntiloptionsexpiration,andmarket

volatility.Thedatarelatestoaten-yearhistoricalperiod.

A comparison of Figures 1.3.12 and 1.2.9 in terms of the influence ofvolatility and time to expiration on the length of delta-neutrality boundariesreveals a slight difference between the two option strategies. The maindissimilaritybetweenthetopographicmapspresentedinthesetwofiguresliesinthevolatilityeffect.Forthedelta-neutralstrategytheboundarylengthreachesits

Page 82: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

highest values under high-volatility conditions, whereas for the partiallydirectionalstrategythelongestboundariesgowithmoderatevolatilitylevels.Inother respects the effects of volatility and time to expiration do not differbetween the two option strategies. Thus, although the positions of delta-neutralityboundariesarequitespecificfordelta-neutralandpartiallydirectionaloptionstrategies(compareFigures1.3.10and1.2.7),thesestrategiesaresimilarwithregardto theboundaries length(compareFigure1.3.11withFigure1.2.8,andFigure1.3.12withFigure1.2.9).Let us examine the extent towhich the delta-neutrality is attainable for the

partiallydirectionalstrategy.Accordingtothedefinitiongiveninsection1.2.4,attainability of delta-neutrality is expressed as the percentage of cases whendelta-neutrality is attained in at least one point. Figure 1.3.13 shows therelationshipbetweendelta-neutralityattainabilityandthenumberofdayslefttooptionsexpiration(presentedseparatelyforcalmandvolatilemarkets).Aswasthe case for the delta-neutral strategy, for the partially directional strategywediscoveredstatisticallysignificantinverserelationshipsbetweendelta-neutralityattainability and the time remaining to options expiration (for calmperiod t =10.29,p<0.0001;forvolatileperiodt=10.89,p<0.0001;seeFigure1.3.13).

Figure1.3.13.Relationshipbetweendelta-neutralityattainabilityandthenumberofdaysleftuntiloptionsexpirationduringcalmandvolatile

Page 83: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

markets.Thedatarelatestoaten-yearhistoricalperiod.

Delta-neutrality is attainable in almost all instances when portfolios werecreatedlessthan40dayspriortotheoptionsexpiration.If longer-termoptionsareused,delta-neutralityattainabilitydecreases.However, thisdecreaseoccursat a slower rate than was observed in the case of the delta-neutral strategy(compare Figures 1.3.13 and 1.2.10). Market volatility does not exert astatistically significant influence on the relationship between delta-neutralityattainabilityandthenumberofdaysleftuntilexpiration.Thisconclusionfollowsfromtheproximityofregressionlinesrelatingtocalmandvolatileperiods.Thedifference in regression lines slopes is statistically insignificant (t = 1.65,p =0.10).Inthisregardthepartiallydirectionalstrategyalsodiffersfromthedelta-neutral one, for which delta-neutrality attainability does depend on marketconditions(attainabilityislowerunderhighvolatility).All characteristics of delta-neutrality boundaries relating to the partially

directionalstrategyaresummarizedinTable1.3.1.Asimilartablewaspresentedearlier for the delta-neutral strategy (Table 1.2.1). Comparison of these tablesreveals the differences between these strategies. Next we contrast the twostrategiesinregardtotheeffectofdifferentvariantsof{marketvolatility×timeto expiration} values on characteristics of delta-neutrality boundaries. Theinfluenceofmorethanhalfofthesevariantsisnotthesameforthedelta-neutralandpartiallydirectionalstrategies.Inparticular,thefollowingdifferencesshouldbe noted:

Table1.3.1.Dependenceofdelta-neutralitycharacteristics(delta-neutralityboundary[DNB]location,DNBlength,anddelta-neutralityattainability[DNA])onmarketvolatilityandthetimefromportfolio

creationtooptionsexpiration.

Page 84: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

•Whenthemarketishighlyvolatileandtheportfolioiscreatedusingoptionswiththenearestexpirationdate,thedelta-neutralityboundaryofthedelta-neutralstrategyissituatedintheareaoflowstrikesrangevalues,whereas for the partially directional strategy the boundary isshiftedtowardaveragevaluesofthisparameter.Besides,intheformercasetheboundaryislongerthaninthelattercase.•Whenthemarketisinthestateoflowvolatilityandtheportfolioisconstructedofthenearestoptions,thedelta-neutralityboundaryofthedelta-neutral strategy is located in theareaof lowcriterion thresholdvalues,whereasfor thepartiallydirectionalstrategyit is foundalongthe whole range of this parameter’s values. The boundary length ismedium in the formercase, though in the latter case itmaybequitelengthy(frommediumtolong).•Inavolatilemarket,whentheportfolioconsistsofoptionswith thedistant expiration date, the delta-neutrality boundary of the delta-neutral strategy is situated in the area of average values of strikesrange, whereas in the case of the partially directional strategy it islocatedintheareaofaverage-to-highvaluesofthisparameter.Intheformer case the delta-neutrality is barely attainable, whereas in thelattercaseitsattainabilityismedium.• In a calm market, when the portfolio is created using long-termoptions, the delta-neutrality boundary of the delta-neutral strategy isfound in the area of low criterion threshold values, whereas for thepartially directional strategy this parameter is highly unsteady(fluctuatingfromlowtoveryhighvalues).Besides,intheformercasethe delta-neutrality boundary is situated in the area of high strikesranges, though in the lattercase it is shifted toward lowandaveragevalues. Delta-neutrality attainability is low for the delta-neutralstrategyandmediumforthepartiallydirectionalstrategy.

1.3.7.Analysis of the Portfolio Structure In this sectionwe apply the sameapproachesandcalculatethesamecharacteristicsaswasdoneinsection1.2.5todescribe the structure of portfolios created by the delta-neutral strategy. Asbefore,we limit values of themain parameters, criterion threshold and strikesrange, to the interval spanning from 0% to 25%. All characteristics of thepartially directional portfolioswill be analyzed in conditions of low and highvolatility. Two time intervals (one-week and two-month) from the time ofportfolio creation to options expiration will be considered. To compare the

Page 85: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

structureof thepartiallydirectionalandthedelta-neutralportfolios,weusethedatarelatingtothesamedatesofportfoliocreationandthesameexpirationdatesthatwereusedinsection1.2.6.Sincevariousaspectsofportfoliostructurehavealreadybeendescribedwithregardtothedelta-neutralstrategy,herewelimitourdiscussion to examining the differences between the structure of partiallydirectionalportfoliosandthedelta-neutralones.Number of combinations in the portfolio. The relationships between the

numberofcombinationsincludedintheportfolioandthevaluesofthetwomainparameters, criterion threshold and strikes range, are similar to the patternsobservedinthecaseofthedelta-neutralstrategy(seeFigure1.2.11).Themaindifferenceconsistsinthefactthatforpartiallydirectionalstrategythequantityofcombinationsrelatingtoeachvariantofthe{criterionthreshold×strikesrange}combinationislower.Thedecreaseinthenumberofcombinationsindicatesthedeteriorationofportfoliodiversification.However,suchadecreasemaybecomecritical only under conditions of significant restrictions imposed on strategyparameters:highcriterion threshold,narrow rangeof strikeprices, andnearestexpirationdates. Inallothercircumstances thenumberofcombinationswouldsufficetoreachtheacceptablediversificationlevel.Numberofunderlyingassets in theportfolio.This characteristic represents

anotherimportantindicatorofportfoliodiversification.Duringahigh-volatilityperiod (regardless of the time left until options expiration), the dependence ofthenumberofunderlyingassetsonthecriterionthresholdandstrikesrangedoesnotdifferfromtherelationshipobservedearlierforthedelta-neutralstrategy(seeFigure 1.2.12). However, in calm market conditions the partially directionalstrategydemonstratesotherformsofrelationships(compareFigures1.2.12and1.3.14).Whileforthedelta-neutralstrategy(undertheconditionofusingshort-termoptions)thenumberofunderlyingassetsisindependentofthestrikesrangeanddecreases exponentially as the criterion threshold increases, in case of thepartially directional strategy the widening of the strikes range leads to anincrease in the number of underlying assets, and an increase in the criterionthreshold causes a slower decrease in the underlyings quantity (see Figure1.3.14). When long-term options are used, the difference between the twostrategiesbecomesevenmoreobvious.Whereasforthedelta-neutralstrategythenumberofunderlyingassetsislargeatlowcriterionthresholdsandalmostdoesnotdependonthestrikesrange, in thecaseof thepartiallydirectionalstrategythis number turns out to be quite low (regardless of the criterion thresholdvalues)anddropsevenlowerundernarrowstrikesranges(seeFigure1.3.14).

Page 86: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.3.14.Dependenceofthenumberofunderlyingassetsonthecriterionthresholdandstrikesrange.Twotimeperiods(one-weekandtwo-month)fromthetimeofportfoliocreation(incalmmarketconditions)until

optionsexpirationareshown.

Proportionsoflongandshortcombinations.Duringahighlyvolatileperiod,all portfolios created within the framework of the partly directional strategyconsist mainly of short combinations. The same was observed for the delta-neutralstrategy.Incalmmarketconditionsthepercentageofshortcombinationsintheportfolioisindependentofthewidthofstrikesrange,butdependsonthecriterionthresholdvalue(thisalsocoincideswithpatternsdetectedforthedelta-neutralstrategy;seeFigure1.2.13).Tobettertracetherelationshipbetweenthepercentageofshortcombinationsandthecriterionthresholdandtocomparetwostrategies with each other, we averaged the data relating to different strikesranges (this procedure reduces chart surfaces to lines).Regardless of the timeleftuntiloptionsexpiration,thepercentageofshortcombinationsintheportfoliodecreasesas thecriterionthresholdincreases.Thisdecreaseisgoingfasterandreaches lowerpercentagesofshortcombinations inportfoliosconsistingof thenearestoptionsthaninportfoliosconstructedofmoredistantoptions.Thesametrends are peculiar for thedelta-neutral strategy (seeFigure1.3.15). Themaindifferencebetween the twostrategies is thatwhenshort-termoptionsareused,thepercentageofshortcombinationsinpartiallydirectionalportfoliosisalwayslower than inportfolios createdby thedelta-neutral strategy (regardlessof thecriterion thresholdvalue).When long-termoptionsareused, thepercentageofshortcombinationsinpartiallydirectionalportfoliosislower(ascomparedwithportfolioscreatedbythedelta-neutralstrategy)atlowcriterionthresholdvalues,

Page 87: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

butbecomeshigherifthecriterionthresholdexceeds10%.

Figure1.3.15.Relationshipbetweenthepercentageofshortcombinationsandthecriterionthreshold.Twostrategiesandtwotimeperiodsfromthe

timeofportfoliocreationuntiloptionsexpirationareshown.

Portfolioasymmetry.Thischaracteristicexpressestheextentofasymmetryoftheportfoliopayoff functionwith respect to thecurrent indexvalue.Since theconcept underlying the partially directional strategy includes the forecastcomponent and does not require market-neutrality, the asymmetry coefficientmayrisetoquitehighvalues.Whileforthedelta-neutralstrategythischaracteristicdidnotexceed0.35(for

allvaluesofcriterionthreshold,strikesrange,marketvolatility,andtimelefttooptions expiration; see Figure 1.2.16), in the case of the partially directionalstrategy this indicator rises to the range of 0.4 to 1.4. Notwithstanding that,reductionofasymmetrytoitsminimum(whilekeepingtheforecastelement)isan important task in developing the partially directional strategy. Hence, it isnecessary to search for such parameter sets that would decrease portfolioasymmetryasmuchaspossible.Thedependenceof theasymmetrycoefficientonthecriterionthresholdandstrikesrangevaluesisshowninFigure1.3.16forportfolios consisting of short-term options. During a calm market, theasymmetry of the portfolio payoff function reaches its maximum under theweakest restrictions imposed on the strategy parameters (a low criterion

Page 88: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

thresholdandawiderangeofstrikeprices).Inavolatilemarketthemaximumasymmetryisobservedathighervaluesofcriterionthreshold.Theimportantfactisthatduringbothcalmandcrisisperiodstherearealargenumberof{criterionthreshold × strikes range} variants for which portfolio asymmetry can bemaintainedattheacceptablylowlevel.

Figure1.3.16.Dependenceoftheasymmetrycoefficientonthecriterionthresholdandstrikesrange.Twomarketconditions(calmandcrisis)are

shownforportfolioscreatedusingone-weekoptions.

Lossprobability.Therelationshipsbetweenthelossprobabilityandthevaluesof the twomainparameters, criterion thresholdand strikes range, resemblebytheir shape the relationships detected for the delta-neutral strategy. Thissimilarity holds true for both volatility levels (see Figure 1.2.17). The onlydifference (which holds only during a calm period and only for portfoliosconstructedoflong-termoptions)isthat,whileforthedelta-neutralstrategylossprobability increases as the strikes range widens, in the case of partiallydirectional strategy this parameter has no effect on loss probability. For allvariants of {strikes range × criterion threshold} the absolute values of lossprobability relating to the partly directional portfolios are slightly higher ascompared to the estimates of this characteristic for portfolios created by thedelta-neutralstrategy.VaR. In the case of the delta-neural strategywe observed that the time left

until options expiration influences portfolios VaR more strongly than marketvolatilitydoes(seeFigure1.2.19).Thesamephenomenoncanbenotedforthepartiallydirectionalstrategy(VaRincreasesseveral timesif two-monthoptions

Page 89: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

areusedinsteadofone-weekcontracts).TheVaRofportfolioscreatedwithintheframework of the delta-neutral strategy reached its maximum at the lowestcriterion threshold values and the widest strikes ranges. In the case of thepartially directional strategy, the peak of VaR values shifts toward highercriterion thresholds; it is especiallynoticeableduring thehigh-volatilityperiod(seeFigure1.3.17).

Figure1.3.17.DependenceofVaRonthecriterionthresholdandstrikesrange.Twomarketconditions(calmandcrisis)areshownforportfolios

createdusingone-weekoptions.

1.4. Delta-Neutral Portfolio as a Basis for the Option TradingStrategyIn preceding sections we examined two main aspects of delta-neutral and

partiallydirectionaloptionstrategies:(1)thepossibilitytoattaindelta-neutrality,location, and length of delta-neutrality boundaries, and (2) the structure andpropertiesofobtainableoptionportfolios.Hereweweavethesetwoaspectsintoone general concept and develop a technique to select such portfolio thatsatisfiestherequirementsofthetradingstrategydeveloperasmuchaspossible.

1.4.1. Structure and Properties of Portfolios Situated at Delta-NeutralityBoundariesRecallthatadelta-neutralityboundaryrepresentsasetofportfolioswith one common quality: Their index delta equals zero. In this respect suchportfolios are all identical. However, they differ substantially in many otherimportant characteristics. In fact, these characteristics compose the wholecomplexofpropertiesthatdetermineexpectedprofitabilityandpotentialrisksof

Page 90: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

the trading strategy under construction. In this section we describe themethodologyofdeterminingthestructureandpropertiesofportfoliossituatedattheboundariesofdelta-neutrality.Althoughnominallyalltheseportfolioscanbeusedwithinbothdelta-neutralandpartiallydirectionalstrategies, thedevelopershould establish the procedure to select a single variant (or several equivalentalternatives)withthebestpossiblecombinationofcharacteristics.Inthisandthenextsection(devotedtotheproblemofoptimalportfolioselection),wepresentexamples related to delta-neutral trading strategy. However, all methodsdescribedherecanequallybeappliedtoanyoptionstrategy.The following procedures need to be executed in order to determine the

characteristicsofdelta-neutralportfolios:1.Present thedelta-neutralityboundaryasasequenceofpoints,eachofwhich isspecifiedbyapairofcoordinatesat the two-dimensional{criterion threshold× strikes range} systemof axes. Since in theorythe boundarymay consist of an infinite number of points, a discretestephastobedefinedinordertodeterminepointcoordinates.Wesetthis step at 1% for both criterion threshold and strikes rangeparameters.2.Presentthedependenceofthecharacteristicunderinvestigationonthecriterionthresholdandstrikesrangeasatopographicmap.(Earlierthese relationships were presented as three-dimensional charts; seeFigures1.2.11through1.2.13andothers.)Horizontalandverticalaxesof the map correspond to values of criterion threshold and strikesrangeparameters,respectively.Thealtitudeofeachpointonthemapexpressesthevalueofacertaincharacteristicof theportfoliodefinedbythepairof{criterionthreshold×strikesrange}coordinates.3. Plot the delta-neutrality boundary on the topographic map.Coordinates of points composing the boundary indicate locations ofdelta-neutral portfolios. Altitude marks corresponding to theselocationsrepresentthevaluesofthecharacteristicunderinvestigation.4. Reiterating steps 1 to 3 for each characteristic, we obtain thecompletesetofcharacteristicsforeachdelta-neutralportfolio.

The results of executing the first three procedures for the “loss probability”characteristicareshowninFigure1.4.1.Inthisexampleweusedthesamedataasinsections1.2.5and1.3.7:Theportfolioscreationdate isJanuary11,2010,andtheexpirationdatesareJanuary15,2010(forone-weekoptions),andMarch19,2010(fortwo-monthoptions).Pointsandboundariesofdelta-neutralitywere

Page 91: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

determinedbyapplyingthemethoddescribedinsection1.2.2.The topographicmapwasdrawnusing theproceduresappliedearlier todrawFigures1.2.3and1.2.8.Delta-neutralityboundariesandtopographicmaps,presentedinacommoncoordinate system (seeFigure1.4.1), enable determining the value of the lossprobability for each delta-neutral portfolio. Altitudemarks of the topographicmap show the lossprobability for eachportfolio locatedat thedelta-neutralityboundary(aswellasforallotherportfoliosnotsituatedatthisboundary,whichwearenotreallyinterestedin).

Page 92: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure1.4.1.Plottingdelta-neutralityboundaries(boldlines)onthe

Page 93: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

topographicmapofthe“lossprobability”characteristic.Datarelatetocalmmarketconditionsandtotwotimeperiodsfromthetimeofportfolio

creationuntiloptionsexpiration(one-weekandtwo-month).

Figure1.2.1 illustrates theproceduresofdetermining thevaluesofacertaincharacteristic for the complete set of delta-neutral portfolios obtainable undergiven conditions.However, it does not enable getting the exact values of thischaracteristic (becausealtitudemarkson the topographicmaparepresented inthe form of interval bands). Furthermore, creation of automated tradingstrategies cannot be built on visual analysis, but requires developingcomputationalalgorithms.Letusdemonstratetheprocedureofdeterminingtheexactvaluesofthe“lossprobability”characteristicforthedatapresentedontheuppermapofFigure1.4.1(whenportfolioswerecreatedusingoptionswiththenearestexpirationdate).In thisparticularcase twodelta-neutralityboundarieswereobtained.Oneof

themisatfirstparalleltothestrikepricerangeaxisandthenturnssharplyandgoesalongthecriterionthresholdaxis(wewillnotconsiderthisboundarysinceall portfolios located on it have very low values of at least one of theparameters).Thesecondboundarytraversesthetopographicmapfromthetop-left corner toward thebottom-rightpart of themap.Portfolios situatedon thisboundary have various combinations of {criterion threshold × strikes range}values.Tomakethingsclearer,wereplacethetopographicmapwithatableinwhich the cells reflect loss probabilities relevant to all possible variants ofparameters combinations {criterion threshold × strike price range}. In Table1.4.1allcellsrelatedtothedelta-neutralityboundary(whichisbrokenhereintoseparatepoints)aremarkedwithgray.Notethatthedispositionofgraycellsinthis table repeats the shapeof thedelta-neutralityboundary in the topchartofFigure1.4.1.Values of gray cells represent loss probabilities of correspondingdelta-neutral portfolios. This way of determining portfolio characteristics israther easy, is simple to program, and eliminates a biased judgment whichotherwiseisinevitableinvisualchartanalysis.

Table1.4.1.Lossprobabilities.Eachcellrepresentsoneportfoliowithacertaincombinationof“criterionthreshold”and“strikesrange”

parameters.Delta-neutralportfoliosaremarkedwithgray.

Page 94: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

1.4.2. Selection of an Optimal Delta-Neutral Portfolio In the precedingsectionwedescribedthemethodoffindingasetofdelta-neutralportfoliosandestablished a procedure to determine their characteristics. The next step is toselect out of thewhole set of attainable delta-neutral portfolios such a variantthatwouldhavecharacteristicssatisfyingtherequirementsofthetradingstrategydeveloper in the bestway.However, the fullmatch between the requirementsand the values of all characteristics is never attainable within one singleportfolio.Therefore,theproblemofportfolioselectionshouldbeformulatedinthefollowingway:Selectanalternativepossessingasetofcharacteristicsthatisclosesttosomereferencestandarddeterminedbythestrategydeveloper.Todemonstrate themainapproaches tosolving theselectionproblem, letus

Page 95: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

considerthecompletesetofcharacteristicsofdelta-neutralportfoliosobtainedinthe two following cases. In one case portfolios are created using one-weekoptions; inanothercase,using two-monthoptions (both,duringacalmmarketperiod).Earlierwedeterminedthevaluesofonecharacteristic, lossprobability(the top chart in Figure 1.4.1 refers to the first case; the bottom chart, to thesecond case). To examine other characteristics, it is necessary to construct atable, similar to Table 1.4.1, for each characteristic and to fix values of cellsrelatedtodelta-neutralitypoints(thatis,cellsmarkedwithgray).Itisimportantto note that delta-neutrality boundaries of portfolios constructed of two-monthandone-weekoptionsdiffer significantly (seeFigure1.4.1).Consequently, thedistributions of gray cells (that mark delta-neutrality points) within tablesrelatingtothenearestandtomoredistantoptionsalsodiffer.Toavoidtheoverburdeningofthisbookwithinterimtables,wedonotshow

hereseparatetablesforeachcharacteristic.Instead,wesummarizeinTable1.4.2the characteristics relating only to delta-neutral portfolios (that is, only cellsmarked with gray). This provides a general overview of a complete set ofcharacteristicsrelevanttoallavailablevariantsofdelta-neutralportfolios.

Table1.4.2.Characteristicsofdelta-neutralportfolioscreatedduringacalmmarketusingone-weekoptions.Eachlinepresentsaseparateportfoliospecifiedbyauniquecombinationoftwoparameters(criterionthreshold

andstrikesrange).Graymarksdenotecellsthatcontainvaluesbelongingtotheintervalofthedesiredvaluesofaspecificcharacteristic.Boldframes

indicatethreeportfoliossatisfyingrequirementsforfiveoutofsixcharacteristics.

Page 96: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems
Page 97: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

The values of six characteristics are shown in Table 1.4.2 (portfoliosconsistingofshort-termoptions)andTable1.4.3(portfoliosconsistingoflong-term options) for all obtainable delta-neutral portfolios. To analyze these dataandtoperformtheselectionoftheoptimalportfolioonthebasisofthisanalysis,it isnecessary to fix the intervalsof thedesiredvalues for eachcharacteristic.Theseintervalsdependonthepeculiaritiesofthestrategyunderdevelopment,aswell as on individual preferences of the developer andon external restrictionsimposedonhim.Thus, ineachspecificcase the intervalsof thedesiredvaluesmaybedifferent.Wewillusethefollowingintervals:

•Thenumberofcombinations:from20to200•Thenumberofunderlyingassets:from20to100•Thepercentageofshortcombinations:from20%to80%•Lossprobability:lessthan50%•Asymmetrycoefficient:lessthan0.1•VaR:lessthan600

Table1.4.3.Characteristicsofdelta-neutralportfolioscreatedduringacalmmarketusingtwo-monthoptions.Eachlinepresentsaseparate

portfoliospecifiedbyauniquecombinationoftwoparameters(criterionthresholdandstrikesrange).Graymarksdenotecellsthatcontainvaluesbelongingtotheintervalofthedesiredvaluesofaspecificcharacteristic.Aboldframeindicatesthesingleportfoliosatisfyingrequirementsforfiveout

ofsixcharacteristics.

Page 98: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

In Tables 1.4.2 and 1.4.3 we used gray to denote cells that contain valuesbelongingtotheintervalsofthedesiredvalues.Withineachcolumngraymarksindicatecellsrelatingtothedesiredintervalofagivencharacteristic.Sinceeachlineinthesetablesrepresentsaseparateportfolio,graymarkswithinagivenlinedenotethecharacteristicsthathavethedesiredvaluesforaspecificportfolio.

Page 99: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Whenportfolioswerecreatedusingthenearestoptions(seeTable1.4.2),noneof them had a set of characteristics entirely satisfying our requirements (withregardtobelongingtotheintervalsofdesiredvalues).However,threeportfoliosprove in linewith five characteristics. These portfolios are denotedwith boldframes inTable1.4.2.Whetherat leastoneof these threeportfolios issuitableforutilizingwithin the frameworkofparticular trading systemdependson theselectionalgorithmadoptedbythestrategydeveloper(inthefollowingtextwedwellonthissubjectindetail).Similarlytotheprecedingexample,whenportfolioswereconstructedoflong-

termoptions,noneof themhasacomplete setofcharacteristics satisfyingourrequirements (see Table 1.4.3). However, one portfolio has five out of sixcharacteristics thatmeet the requirementsof the intervalsofacceptablevalues.This portfolio is denoted with a bold frame in Table 1.4.3. If that is enoughaccordingtothealgorithmofportfolioselection,thisalternativemaybeusedtoopentradingpositions.Wecanproposeavarietyofalgorithmsforselectinganoptimaldelta-neutral

portfolio. All of them represent, in essence, different variants of solving theproblem of multicriteria selection, where each characteristic represents aseparatecriterion.Themostrestrictivealgorithmmaybeasfollows.Atthefirststageweselect

portfolioswithallcharacteristicssatisfyingtheaprioriestablishedrequirements.(In the two examples presented in Tables 1.4.2 and 1.4.3, therewere no suchportfolios.) At the second stage there are several alternative procedures toimplement. All characteristics can be ranked by their significance. After that,oneportfoliowiththebestvalueofthemostsignificantcharacteristicisselectedfromthesetofportfoliosthathavebeenchosenatthefirststage.Ifthereismorethan one such portfolio, further selection is conducted on the basis of thecharacteristic that isrankedsecondin importance,andsoon.Thedrawbackofthismethodconsistsintheobjectivedifficultyinrangingdifferentcharacteristicsintheorderoftheirrelativeimportance(manyofthemareequallysignificant).Another procedure that can be implemented at the second stage is the Paretomethodofmulticriteriaanalysis.(ApplyingthismethodtooptionswasdescribedbyIzraylevichandTsudikman[2010]).However,inthiscasewecannotcontrolthe number of selected portfolios. This drawback may turn out to be verysubstantial since the selection of several portfolios instead of a single onerequires opening much more positions that may significantly increase lossescausedbyslippageandoperationalcosts.

Page 100: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Alessrestrictivealgorithmmaytakethefollowingform.Atthefirststageweselectallportfoliosthathavencharacteristicssatisfyingtherequirementsfortheinterval of desired values. The total number of characteristics is m. In ourexamplesm=6.Ifnissetat5,intheexamplepresentedinTable1.4.3asingleportfoliowill be selected at the first stage. InTable1.4.2 there are three suchportfolios.Thesecondstagemayberealizedinthesameway(orways)asinthemorerestrictivealgorithm.Forexample,ifthedeveloperofthestrategydecidesthat the “number of combinations” is the most significant characteristic (thelowerthenumberofcombinations, thebetter,butnot less than20), thenat thesecondstagetheportfoliodefinedbyparameters{criterionthreshold=4,strikeprice range = 20}will be selected out of three alternatives. Alternatively, thesecondstagecanberealizedinthefollowingway.Withinthevariantsthathavebeen chosen at the first stage, we can select at the second stage the portfoliopossessing thebestvalue for the failedcharacteristic.Although thisbestvaluedoes not fall into the interval of the desired values of this particularcharacteristic,itstilldominatesoverallothervariantsselectedatthefirststage.InTable1.4.2allthreeportfoliosthathavebeenselectedatthefirststagehaveunsatisfactoryvaluesforthe“numberofcombinations”characteristic.However,theportfoliodefinedbyparameters{criterionthreshold=4,strikepricerange=20} has better values of these two failed characteristics than the other twovariants.Thisportfoliomaybeselectedastheoptimalone.Forbothmorerestrictiveandlessrestrictivealgorithmstheimplementationof

thesecondstagemaybebasedonanotherprinciple.Insteadofapriorirankingofcharacteristicsbytheirrelativesignificance,wecanconsiderthecharacteristicthatvariesinthewidestrangeofvaluesasthemostimportantone.Forexample,in Table 1.4.2 the values of “asymmetry coefficient” do not change at all.Therefore,all threeportfoliosselectedatthefirststagedonotdifferfromeachotherby thischaracteristic.Hence, there isnosense inselecting itas themainreferencepointsat thesecondselectionstage.Ontheotherhand,valuesof theother two characteristics, “number of combinations” and “VaR,” fluctuate in awider rangeofvalues.Thus, in this particular case, itwouldbenatural tousethemasthemaincharacteristicsforthefinalselectionofanoptimaldelta-neutralportfolio.It is important to emphasize that whichever algorithm is adopted in the

process of developing the automated trading strategy, it represents, in manyrespects, the main factor determining the choice of the delta-neutral portfoliothatwillbeusedtoopentradingpositions.

Page 101: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Chapter2.Optimization

2.1.GeneralOverviewTheproblemofselectingtheoptimalsolutionarises inallspheresofhuman

life—onindividual,corporate,andstatelevels.Theoptimizationmaybedefinedas the search for either an optimal structure of a certain object (structuraloptimization)orasasequenceofactions(calendaroptimization).Inthecontextofcreatingautomated tradingstrategies,parametricoptimization is the subjectof interest. In this case the optimal solution represents a combination ofparametervalues.Despite the availability of numerous sophisticated methods that have been

developed recently for treating various aspects of optimization, it is stillimpossibletoproposeauniversalapproachthatwouldapplyequallywelltoallsituations. The reasons include the heterogeneity of optimization problems,limitedness of time, and computational resources. Only a synthetic approachcombining achievements fromvariousmathematic fields canprovide adequateframeworkforoptimizationoftradingstrategies.

2.1.1.ParametricOptimizationDependingonthedefinitionoftheproblem,parametersmayberealnumbers

(for example, the share of capital invested in a certain strategy) or integers(numberofdays frompositionopening tooptions expiration), or theymaybepresentedbydummyvariables(forexample, if theparametersignifieswhetherweuseacertaintypeofoptioncombination,itcanassumevaluesof1or0).Thenumberofparametersmaybelimitedtoone(one-dimensionaloptimization),butinmostcasesthereismorethanoneofthem(multidimensionaloptimization).The definition of an optimization problemmay be unconditional or contain

certain constraints. In particular, not all possible combinations of parametervalues are permissible. Due to specific limitations, some of them may beunacceptable or unrealizable. If some combinations of parameter values areexcluded from consideration, the optimization is defined as conditional. Theconstraintsmaylooklike

x1+x2+...+xn=M,

wherexitakesonavalueof0or1,dependingonwhetherthetradingpositionis opened for underlying asset i. The point of this constraint may be, for

Page 102: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

example, that the total number of underlying assets in the portfolio equalspreciselyM.Constraintsmayalsobedefinedasinequality:

c1x1+c2x2+...+cnxn≤K.

Herecimaybe thepriceofoption iandxi is thenumberofoptions i in theportfolio.Thesignindicateswhetherthepositionislong(plus)orshort(minus).ThemeaningoftheconstraintisthatthetotalvalueoftheoptionportfoliodoesnotexceedK.Constraintsmayalsobeappliedto therangeofvalues thataparametermay

possess (in the previous chapter we often used the notion of “the range ofacceptable values”). Such constraints are often applied in the development ofautomated trading strategies. They may be applied on the basis of practicalreasons,sincethereductionofthesetofacceptablevaluesreducessubstantiallythevolumeofcomputationalworkandshortenstheoptimizationtime.Besides,constraints may follow from some specific features of the strategy underdevelopment or from requirements of the risk management system. At last,constraints on the range of acceptable values may arise when the data forcalculationofanobjectivefunctionareunavailableforcertainparametervaluesorsuchcalculationisimpossible.Inordertoavoidamessindefinitionsusedinthedescriptionofoptimization

procedures, we provide a short explanation for the terms that we use in thischapter.

•Optimizationspace—Asetofallpossiblecombinationsofparametervalues.•Node—The smallest structural element of an optimization space (auniquecombinationofparametervalues).Afullsetofnodesformsanoptimizationspace.•Computation—The whole set of procedures necessary to calculatetheobjectivefunctionforonenodeofanoptimizationspace.• Full optimization cycle—The whole set of all computationsperformedinthecourseofsearchingforanoptimalsolution(fromthebeginningoftheoptimizationprocedureuntilthealgorithmstops).•Objectivefunction—Thequantitativeindicatorexpressingtheextentofutilityofagivencombinationofparametervaluesfromthepointofview of a trading system developer (may be calculated eitheranalyticallyoralgorithmically).•Global maximum—The node with the highest value of objective

Page 103: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

function.Theglobalmaximumcanbeviewedas thehighestpeakofthetwo-dimensionaloptimizationspace.Theremaybemorethanoneglobalmaximum.• Local maximum—The node situated at one of the peaks of theoptimizationspacebutwithalowerobjectivefunctionvaluethantheglobalmaximum.Theremaybeseverallocalmaximums.•Optimal solution—The node at which the optimization algorithmstops.Thisnode isspecifiedbyasetof theparametervaluesandbythe value of the objective function. Optimal solution does notnecessarily coincide with the global maximum. The higher theeffectiveness of the optimization algorithm, the closer the optimalsolutionistotheglobalmaximum.•Robustnessofoptimalsolution—Theextentoftheobjectivefunctionvariabilityintheareaofoptimizationspacethatsurroundstheoptimalsolution node. Although the term “robustness” is widely used instatistics, economics, and biology, it has no strict mathematicalformalization when applied to optimization issues. We define thesolutionasrobustifthevaluesoftheobjectivefunctionofmostnodesarounditarenotsignificantlylowerthantheobjectivefunctionoftheoptimalsolutionnode.•Optimalarea is the areaof theoptimization spacewhere all nodeshave relatively high values of the objective function (higher than apredefined threshold). There may be several optimal areas. Usuallythese areas are situated around nodes of global and/or localmaximums.However,theoptimalareamayalsoappearasanelevatedsmooth plateau without evident extremes (in case of the two-dimensionaloptimizationspace).

2.1.2.OptimizationSpaceOptimizationspaceisasetofcombinationsofallpossibleparametervalues(a

fullsetofnodes).Itisdefinedbythreecharacteristics:1.Dimensionality,whichisthenumberofparameterstobeoptimized2.Rangeofacceptablevaluesforeachparameter3.Optimizationstep

Most optimization problems, which are a subject of practical interest fordevelopinganautomatedtradingsystem,aremultidimensional.Thismeansthattheobjectivefunctioniscalculatedonthebasisofmanyparameters(ithasmore

Page 104: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

than one argument). In complex trading strategies, the number of optimizedparameters may be very high. In these cases the risk of overfitting increasesgreatly(wewilldwellonthisissueinChapter5,“BacktestingofOptionTradingStrategies”). Since most objective functions used in optimization of tradingsystems cannot be calculated analytically, the methods of direct optimization(when the objective function is calculated algorithmically) have to be applied.Thecomplexityof thealgorithmdependsdirectlyon thedimensionalityof theobjectivefunction(thatis,onthenumberofitsarguments-parameters).The range of acceptable values is determined by constraints (established by

thetradingsystemdeveloper)withrespecttotheparametersusedtocalculatetheobjective function. For example, in Chapter 1, “Development of TradingStrategies,”weconsideredtwoparameters:acriterionthresholdandarangeofstrike prices. The range of acceptable values for the first parameterwas fromzerotoinfinity.Thelogicbehindthischoicewasthefollowing.Sinceweusedexpectedprofitasthevaluationcriterion,itwasquitenaturalnottoconsideranynegative rangeofexpectedprofitvalues.For the“strikes range”parameter therangewassettobefrom0%to50%.Thelowerlimitwasbasedonthefactthatthisparametercannotbenegative.Thereasonfor theupper limitwas that it isimpractical tousestrikes thatare situated too far from thecurrentpriceof theunderlyingasset(distantstrikeshavelowliquidityandwidespreads).The bestmethod of direct optimization requires calculation of the objective

functionforallacceptablevaluesoftheparameter(exhaustivesearch).However,in practice thismethod is rarely implemented since the number of acceptablevaluesmaybetoohigh.Iftheparameterisofintegernature,thenumberofitsvaluesisfinite(withintheacceptablerangenotincludinginfinity).Nevertheless,eveninthiscasetheexhaustivesearchthroughallvaluesmayrequiretoomanycomputationsandtoomuchtime.Iftheparameteriscontinuous,thenumberofitsvaluesisinfinitewithoutanyregardtotherangeofacceptablevalues.Inthiscasewehavetosetastepforitsvaluechange(referredtoasthe“optimizationstep”) and investigate the parameter bymoving along its range of acceptablevalues discretely. The step represents a distance between two adjacent nodes.Thehigher the stepvalue, the lessnodeswill be tested and, consequently, thelessertimewillberequiredtocompletethefulloptimizationcycle.However,ifthestepistoowide,theriskofmissingtheglobalmaximumincreases(asharppeakmaygetintotheintervalbetweentwonodes).Theshapeoftheoptimizationspacehasadirectimpactontheeffectivenessof

the optimization procedure and its final outcome. If optimization is one-dimensional(whenthereisonlyoneparameter),theoptimizationspacemaybe

Page 105: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

viewed in a system of axes as a line with coordinates corresponding to theparametervalues (axisx) and theobjective functionvalue (axisy). If this linehasonlyoneglobalmaximum,theobjectivefunction(andoptimizationspace)isunimodal.Iftheobjectivefunctionhasoneormorelocalmaximumsapartfromtheglobalone,itiscalledpolymodal.Iftheobjectivefunctionhasapproximatelyequal values at the whole range of parameter values, it is nonmodal and canhardlybeusedforoptimizationofthisparticularparameter.In the case of two-dimensional optimization (when objective function is

calculatedonthebasisoftwoparameters),theoptimizationspacecanbeeasilypresentedasasurface.Suchasurfaceisdepictedasatopographicmapwithaxescorresponding to parameters and altitude marks—to values of the objectivefunction.Unimodal surfaceshave a singlepeak,whilepolymodal oneshave amultitudeofsuchtops.Arelativelyflatsurfaceisnonmodalandcanhardlybeappropriateforoptimization.In the three-dimensional case (and dimensionality of higher orders), nodes

represent areas inwhich values of all parameters are relatively high. In thesecases itwould be impossible to depict the optimization space topographically,but this isnotreallynecessarysincecomputationalalgorithmsdonotneedourimagination.Mostoptimizationmethodsperformbetterwhensearchingwithinthesimplest

optimizationspace—unimodalspacewithasinglemaximum.Ifthereareseverallocalmaximumsandthesearchisnotexhaustive,mostmethodsproduceasub-optimalsolution,whichcanbemoreorlessfarfromthebestone.Optimization space has a number of properties that influence optimization

effectivenesssignificantly.Twoofthemareworthmentioning.Thefirstpropertyis optimization space smoothness. In the two-dimensional case, smoothnessmeans absence of a large quantity of small local peaks making the surface“hilly.” In extreme cases, optimization spacemay be either absolutely smooth(withasingleextreme)ortotallybumpywithalotofsharppeaksandbottoms.Obviously, smooth space is preferable from the optimization efficiencystandpoint.Hillyspaceincreasestheriskofstoppingtheoptimizationprocedureatasmalllocalextreme.Laterwewillshow(section2.7.2)thatthesmootherthespace, the higher the effectiveness of different optimization methods and thehigherthelikelihoodoffindinganappropriateoptimalsolution.The second important property is the steadiness of optimization space.

Steadiness can be viewed as nonsensitivity of the space relief to (or, in otherwords, invariability of the space shape depending on) small changes in

Page 106: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

parameters, which are not involved in the optimization process, but are fixedbasedonparticularreasons.Thenonsensitivitytosmallchangesinthestrategystructurealsobelongstothisproperty.Anotheraspectofsteadinessistheextentof optimization space sensitivity to the length of historical price data used tocalculate objective function values. A very short price history results indevelopingatradingstrategythatisadaptedmerelytorecentmarkettrends.Onthe other hand, a very long price historymay lead to adapting the system topossiblyoutdateddata.Besides,itishighlydesirablethathistoricaldatashouldreflectdifferentmarketconditions(calmandcrisisperiods).Inordertooptimizeatradingsystemproperly,adevelopermusttaketheseargumentsintoaccount.

2.1.3.ObjectiveFunctionTheessenceofparametricoptimizationconsistsoffindingthehighestorthe

lowest value of the objective function. This function may be specified as anequation,maybe specified as a computational algorithm (which calculates thefunction’svaluesonthebasisofagivensetofparameters),ormaybeobtainedexperimentally.Thechoiceofanyparticularmethodtobeusedintheautomatedsystemforfindingtheoptimalsolutiondependslargelyonthepropertiesoftheobjectivefunction.Following established scientific traditions, optimization problems are solved

by finding the lowest value of the objective function. Although findingmaximumvaluesandfindingminimumvaluesrepresentoppositeproblems,thesame methods are used to perform both of these tasks. Notwithstanding thetraditional approach, wewill formulate optimization problems as a search formaximums. (An alternative approach is to find the reciprocal values for theobjective function and then perform the optimization by solving theminimizationproblem.)The reason is thatoneof themainobjective functionsusedintheoptimizationoftradingstrategiesisprofitanditsvariousderivatives.Fromapsychologicalpointofview, it ismorecomfortable tomaximizeprofitthantominimizeit.Historically,optimization theoryoperatedmostlywith theobjectivefunction

given by the analytical formula. In simple cases the formula represents adifferentiable function. Its properties (areas of increase and decrease, extremepoints) are investigated using derivatives. Equating derivatives to zero in allparametersandsolving theobtainedsystemofequations isanelegantwayforfindingtheoptimalsolution.Modern needs to optimize complex heterogeneous systems, supported by

impressive theoretical achievements, led to a vast expansion of the range of

Page 107: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

solvable problems. In most of them the objective function is not givenanalyticallyandhencecannotbeanalyzedwiththehelpofderivatives.Inthesecasesfunctionvaluesareobtainedviaalgorithmiccalculations.Methods that are based on algorithmic calculations and do not require

obtaining the objective function derivatives are called direct methods. Theobvious advantage of directmethods is that they do not require the objectivefunctiontobedifferentiable.Moreover,itmaybenotgivenanalytically(intheformofanalgebraicequation).Thesolerequirementtodirectmethodsconsistsin the necessity to estimate objective function values. Almost all problemsinvolved in the optimization of trading systems are solved on the basis ofalgorithmic models. Hence, in this chapter we deal exclusively with thesemethods.Solving an optimization problem becomes a significantly harder task when

there is more than just one objective function. This issue arises frequently inoptimizationof tradingstrategies.Notsurprisingly, themainobjectivefunctionfor most strategies is profit. However, it would be unwise to limit the wholesystem to this single characteristic. It is also necessary to consider profitvariability, maximum drawdown, share of profitable transactions, and manyotherimportantfactors,eachofwhichrepresentsaseparateobjectivefunction.Thespecificfeatureofusingseveralobjectivefunctionsisthatthemaximum

of one function rarely coincides with the maximum of another one. On thecontrary, different objective functions usually contradict each other—optimalvalues of one of them may be way too far from the maximum of anotherfunction.(Asimilarsituationisdiscussedinsection1.4.)Developingtechniquesfor the effective application of several objective functions is the subject ofmulticriteria optimization theory. Three main approaches to multicriteriaoptimizationshouldbementioned.

1.Choosing a certain criterion (objective function) as themain oneandconsideringothercriteriaasconstraintsorfilters.Afterobtainingthe optimal solution according to the main criterion, other criteriavalues are calculated at the same node of optimization space. If thesolution,derivedonthebasisof themaincriterion,meetsconstraintsset for the secondary criteria, the algorithm stops. If values of thesecriteriaappearunacceptablyloworhigh, thissolutionisrejectedandthesearchbythemaincriterionrecommences.2. Constructing a combined criterion (convolution). It may becalculated as a simple or a weighted arithmetical average (weights

Page 108: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

reflecttheimportanceofthecriteria)orasageometricalaverage(alsosimple or weighted). Besides, there are several other convolutionmethods.3.Using thePareto optimizationmethod. Inmost cases thismethodleadstofindingseveraloptimalsolutionsevenifeachcriterionhasauniquemaximum.TheoutcomeoftheoptimizationisaParetosetthatrepresents a group of solutions that dominate over all other variantsnot included in it.None of the solutions belonging to the Pareto setdominates over other solutions included in it. Thus, any solutionbelongingtotheParetosetcanbeselectedasoptimal.

All methods of multicriteria analysis introduce a subjective element to theoptimizationsystem.Inthefirstmethod,thesubjectivenessconsistsinselectingone criterion as the main one and defining specific constraints for secondarycriteria.Intheconvolutionapproach,selectingaparticulartechniquetocombinecriteriaandsettingweights(especiallyiftheyareintroducedtoaccountfortherelative importance of different criteria) is highly subjective. The necessity toselecttheuniquesolutionfromthesetofequivalentones(Paretomethod)mayalsobeaffectedbysubjectivefactors.Insection2.4wediscussthemainaspectsofmulticriteriaoptimizationasappliedtothedevelopmentofautomatedtradingsystems.

2.2.OptimizationSpaceoftheDelta-NeutralStrategyTheshapeandpropertiesof theoptimizationspacedependonmanyfactors,

mostofwhichweredescribed in theprecedingsection.Certainly, theshapeofthe optimization space is specific for different option strategies. Each strategyhas its own set of parameters, their acceptable value ranges, and optimizationsteps. Therefore, it is quite natural that different strategies have differentoptimization spaces. Furthermore, even in cases when parameters, acceptablevalues ranges, and optimization steps are the same for two different strategies(for example, this situation can be encountered for delta-neutral and partiallydirectional strategies), their optimization spaces may still differ substantially(andinmostcasestheydodiffer).In this chapter we will examine the shape and the properties of a typical

optimizationspace,takingbasicdelta-neutralstrategyasanexample.Twomainparameters of this strategy (covered in Chapter 1) are fixed at the followingvalues:criterionthreshold>1%,strikesrangeof10%.Intheprecedingchapterwepartly touchedontheoptimizationissuewhilediscussing theseparameters.However, in section 1.4 we were detecting optimal values mostly relying on

Page 109: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

scientificapproachandnotusingspecificoptimizationtechniques,whicharethetopicofthischapter.We will analyze optimization space corresponding to two parameters of a

basic delta-neutral strategy: the number of days to options expiration and thelengthofhistoricalperiodused tocalculatehistoricalvolatility (wewill call it“HV estimation period”). The meaning of the first parameter is discussed inChapter1. The value of this parameter influences directly the structure of theportfolio.ThesecondparameterreflectsthelengthofthepriceseriesemployedinHVcalculation.Historicalvolatility,initsturn,isusedtoestimatevaluesofexpectedprofit,whichservesas thesourceforgenerationofpositionsopeningsignals. Despite the fact that the impact of this parameter is indirect, it alsorepresents one of the most important factors in this strategy, since its valuesdefine,toacertainextent,whichoptioncombinationswillfinallybeincludedintheportfolio.

2.2.1.DimensionalityofOptimizationOneofthemainfactorsdeterminingtheshapeof theoptimization space is a setofparameters.Whena trading systemdeveloper formalizes the strategy, the first and one of the main issues is thequantityofparametersrequiringoptimization.Ingeneral,itisadvisabletostickto theruleofminimizing thenumberofparameters.Thereare tworeasonsforthis.Firstly,thehigherthenumberofparameters,themoredegreesoffreedomareinherentinthesystemand,hence,thehighertheriskofoverfitting.Secondly,higher optimization dimensionality requires excessive calculations,whichmaynotbetechnicallyfeasible.Ontheotherhand,anunreasonablereductioninthenumberofoptimizedparametersmayleadtooverlookingapotentiallyprofitablestrategy. Putting all these pros and cons together, not fewer than two and nomore than five parameters are usually used in creating automated tradingsystems.One-DimensionalOptimization

One-dimensional optimization is straightforward and the simplest one(althoughitisrarelyusedinpractice).Itcanbeconsideredasaspecialcaseofamorecomplexmultidimensionaloptimization.Consideringtheone-dimensionalvariantcanfacilitatetheunderstandingofthedifficultiesthatariseinanalysesofcomplexoptimizationspaces.Algorithmsutilizedforsolvingmultidimensionalproblems are often reduced to consecutive reiterated executions of one-dimensionalprocedures.Figure 2.2.1 shows three examples of one-dimensional optimization space.

Thischartdepictsoptimizationofthe“HVestimationperiod”parameterofthe

Page 110: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

basicdelta-neutral strategy for three fixedvaluesof the secondparameter thatexpressthenumberofdayslefttooptionsexpiration.Therangeofpermissiblevalues for the parameter under optimization is from 5 to 300 days; theoptimization step is 5 days. The complete optimization space in this caseconsists of 60 nodes.This optimizationwas performedwith 10-year historicaldata.Averageprofit value is used as theobjective function.Noneof the threeoptimization spacespresented inFigure2.2.1 is smooth.This isnot surprisingsince this figure is based on real market data, while only spaces based onanalytically given equations may be absolutely smooth. Nevertheless,unavoidablestatistical“noise”doesnotpreventusfromdistinguishingthemainpatternspeculiar to eachof the lines andclassifying theseoptimization spacesaccordingtotheirmodality.

Figure2.2.1.Threeexamplesofone-dimensionaloptimizationspace.Optimizedparameter—“HVestimationperiod.”Eachlinecorrespondstooneofthreevaluesofthefixed(notoptimized)parameter“numberofdays

lefttooptionsexpiration.”Objectivefunction:profit.

Each line in Figure 2.2.1 illustrates one of the main forms of optimizationspace.Whenthe“numberofdaystooptionsexpiration”parameterwasfixedat32days,optimizationspaceturnedouttobeunimodal.Inthiscase,theobjectivefunctionhastheonlyglobalmaximumcorrespondingto“120days”(thelengthof the historic period used forHV calculation). Therewere no apparent local

Page 111: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

maximums. We should note that the statement about the absence of localmaximums and unimodality of this optimization space is to some extent asubjective opinion.Actually, since this line is not absolutely smooth, one canclaimthatsomelocalmaximumsarepresentatnodes“105days”(totheleftoftheglobalmaximum)and“230days”(totherightofit).Nevertheless,sinceonthescaleof thewholeoptimizationspace thesepeaksarenegligiblysmall,weconsiderthemasnoise.Ifvisualanalysisisnotobvious,modalitydeterminationprocedureshouldbeformalizedinordertoavoidsubjectivejudgments.The example of polymodal optimization space is presented by the line

correspondingto“108days”asthevalueofthefixedparameter(thenumberofdays to options expiration).Globalmaximumof this optimization falls on the“HV estimation period” value of “145 days.” In contrast to the precedingexample, the objective function of this optimization has an evident localmaximumatthe“HVestimationperiod”valueof“205days.”Finally,thethirdlineinFigure2.2.1isanexampleofnonmodaloptimization

space.Inthiscase,whentradingpositionsopeningsignalsweregeneratedonlyforshort-termoptions(the“numberofdaystooptionsexpiration”parameterisfixed at “4 days”), the objective function fluctuated around zero almost at thewholerangeofthe“HVestimationperiod”parametervalues.Since inall threeexamplespresented inFigure2.2.1 theobjective functions

wereanalyzedatthewholerangeofacceptableparametervalues(thismethodisreferred to as “exhaustive search”), the selection of optimal solution at firstglance is evident. For unimodal objective function it falls on 120 days; forpolymodalfunction,on145days;andfornonmodalthereisnooptimalsolution.However, the optimumdoes not necessarily coincidewith the global extreme.There is another (and not less important) criterion for selecting an optimalsolution: its robustness. Taking the concept of robustness into account, theselectionof120daysastheoptimalsolutionmaynotbethebestone.Increasingthe parameter leads to a sharp decrease in the value of the objective function(whichmeansthatthissolutionisnotrobust).Atthesametime,ifweselect100daysastheoptimalsolution,alltheadjacentparametervalueshavesufficientlyhigh values of objective function (which means that this solution is robust).Globalmaximumoftheunimodalobjectivefunctionrepresentsanexampleofamore robust solution (since it is situated at the wide plateau) than the globalmaximumofthepolymodalfunction(whichislocatedatarathernarrowpeak).Two-DimensionalOptimization

Hereafter we will analyze examples pertaining to two-dimensional

Page 112: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

optimization space. The same two parameters thatwere used in the precedingexamplewillformtheoptimizationspace:HVestimationperiod(thisparameterwasoptimizedintheprecedingexample)andthenumberofdayslefttooptionsexpiration (in the preceding example this parameter was fixed). The range ofacceptablevaluesforthefirstparameterisfrom5to300days;theoptimizationstepis5days.Forthesecondparametertherangeofacceptablevaluesisfrom2to120days; theoptimization step is 2days.Thus, the full optimization spaceconsistsof3,600nodes(60×60).Figure 2.2.2 shows two-dimensional optimization space of the objective

functionexpressinganaverageprofit.Infact,thethreeone-dimensionalspacesdiscussed earlier (in Figure 2.2.1) represent three special cases of this two-dimensionalspace.SinceFigure2.2.2isatopographicsurface,verticalsectionsexecuted throughvalues4,32,and108of the“numberofdays left tooptionsexpiration” parameter coincidewith one-dimensional profiles shown in Figure2.2.1. Undoubtedly, the two-dimensional optimization space gives a muchbroader look at the objective function and better reflects the properties of thetradingstrategy.

Figure2.2.2.Two-dimensionaloptimizationspaceconstructedforthe

Page 113: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

basicdelta-neutralstrategy.Objectivefunction:profit.

TheglobalmaximumoftheoptimizationspaceshowninFigure2.2.2hasthefollowing coordinates: 30 on the horizontal axis and 105 on the vertical axis.Thismeans that theaverageprofit (which is theobjectivefunction)reaches itsmaximum when positions are opened using options with 30 days left toexpiration,andhistoricalvolatilityusedtocalculatethecriterionisestimatedatthehistoricalperiodof105days.Thisglobalmaximumissituatedatthetopofaslight edge spreading along the 30th vertical line (the “number of days toexpiration”parameter)intherangefrom80to125(the“HVestimationperiod”parameter).Thisedgemaybeconsidered theoptimalareasinceallnodes inside ithave

high values of the objective function (>6%). The optimal area itself is alsosurrounded by a rather wide area consisting of nodes with relatively highobjective function values.Therefore, the globalmaximumof this optimizationspace is quite robust.However,we shouldmention that the robustness of thisoptimalsolutionisnotthesameforthetwoparameters.Changesinthevalueofthe“HVestimationperiod”parameterinsidetheoptimalareaandarounditleadtosmallerchangesoftheobjectivefunctionthanchangesinthe“numberofdaystoexpiration”parameter.Driftingfromtheoptimalvalueofthelatterparameter(30 days) in any direction causes a sharp decrease in the objective function.Hence, the robustnessof theglobalmaximumrelative to the firstparameter ishigherthanrelativetothesecondone.TheoptimizationspacepresentedinFigure2.2.2isrelativelyunimodal.This

statementisjustifiedbythefactthattheoptimalarearisesdistinguishablyovertherestofthesurface(inthetwo-dimensionalcasetheoptimizationspacecanbecalled“surface”).Atthesametime,sincethissurfaceisnotabsolutelysmooth,the judgment about its unimodality can be disputed. Apart from the areadesignated as optimal, this surface has many other areas where the objectivefunctionisnotjustpositive,buttakesonvaluesfallinginaquitegoodrange(2%to4%).Therefore,dependingontheadoptedpointofview,thissurfacemay,inprinciple, be regarded as polymodal. Although the issue of classifying theoptimization space is not of paramount importance, the presence of localmaximums suggests that a global maximummust not necessarily be the bestoptimalsolution.Ifsomelocalmaximumhasanobjectivefunctionvaluethatisnot significantly lower than the global maximum, but, at the same time, itsrobustness ismuch higher, itmay turn out that the best decisionwould be toselect this local maximum as an optimal solution. The objective selection isimpossible without applying some quantitative techniques that exclude

Page 114: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

subjectivejudgment(thisissueisdiscussedinsection2.5).Toobtainadetailednotionabouttheshapeandpropertiesoftheoptimization

spaceshowninFigure2.2.2,wehadtocalculatetheobjectivefunctionvaluesinall the3,600nodes.Since this optimizationwasperformedusing10-year data(like all other optimizations considered in this chapter), the computationsrelatingtoonenodetookaboutoneminute.Accordingly,ittookabout60hourstoperformall thecalculations for thewholeoptimizationspace.Although thiswas quite reasonable for research purpose, for day-to-day practicalwork suchinflated timecostsarenotalwaysacceptable,especially if therearemore thantwo parameters. Besides, 3,600 is the number of nodes relating to a singleobjectivefunction,butusuallytherearemoreofthem.Hence,inmostcases,itwould be impractical tomake computations for thewhole optimization space.Instead,differentmethodsofoptimalsolutionfindingthatdonotrequiresuchanexhaustivesearchshouldbeapplied(thisissueisdiscussedinsection2.7).

2.2.2.AcceptableRangeofParameterValues In thissectionwediscusshowthe acceptable range of parameter values influences the optimization spaceshape. To start the examination of this issue, we cut the acceptable ranges ofbothparametersbyhalf(relativetorangesusedintheprecedingsection).Forthe“HVestimationperiod”parametertheupperlimitofthenewrangewillbe150days (instead of 300), and for the “number of days to options expiration” thelimitwillbesetat60days(insteadof120).Theseconstraintsleadtofourtimesshrinkageoftheoriginaloptimizationspace.Thiseffectofnarrowingparameterranges is positive (since nowwe need to perform computations for only 900insteadof3,600nodesinordertoconstructthecompleteoptimizationspace).Incaseofthree-dimensionaloptimization,cuttingthevaluerangebyhalfleadstoanoptimizationspace,whichiseighttimessmallerthantheoriginalone.The left chart of Figure 2.2.3 shows optimization space constructed for the

newacceptablevalueranges.Comparingthissmallerspacewiththeoriginalone(inFigure2.2.2)demonstratesthattheareaofglobalmaximumwasnotlostastheresultofemployingstricterconstraintsonparametervalueranges.Nowthisareaissituatedalmost in thecenterof thespace.Besides, themajorportionofthe original space that contained lower objective function values is now leftoutside thenewoptimization space.Thismeans that the shareofoptimal arearelative to the total sizeofnewoptimization spacehas significantly increased.Hence, the probability of finding the global maximum in the process ofsearching for the optimal solution (using methods not requiring exhaustivesearch)hasalsoincreased.However,whenselectingtheacceptablevaluerangefor a given set of parameters, thedeveloper of the trading systemhasno idea

Page 115: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

abouttheformofthecompleteoptimizationspace.Consequently,bydecreasingthe range of acceptable values, the developermay exclude from considerationtheareathatcontainsthebestsolution.

Figure2.2.3.Optimizationspacesofthebasicdelta-neutralstrategyconstructedfordifferentacceptablerangesofparametervalue.Objective

function:profit.

Besides, the range of acceptable values does not necessarily start with thelowestpossiblevalueoftheparameter(aswasthecaseintheexamplesgiveninFigure2.2.2 and in the left chart of Figure2.2.3). Suppose that the developercreates a trading strategy employing longer-term options. In this case thedeveloper can fix the lower limit on the range of acceptable values for the“numberofdaystooptionsexpiration”parameter.Forexample,itcanbesetat60days(lettheupperlimitbe120).Thechangeintherangeofthisparameterinduces changes in the range of the second parameter, since it seemsinappropriate toevaluate long-termoptionswith thecriterioncalculatedon thebasisofvolatilitythathasbeenestimatedattheshorterperiodthantheperiodofoptionslife.Hence,thelowerlimitontherangeofvaluesforthe“HVestimationperiod”parametershouldalsobesetat60days(toequatethenumberofvaluesforbothparameters,theupperlimitwillbefixedat210days).Let us examine the optimization space obtained for these new ranges of

acceptable parameter values (the right chart of Figure 2.2.3). Obviously, theresults of optimization performed at this new surface will be different. Theglobal maximum falls now on the node with other coordinates—106 on the

Page 116: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

horizontal axis and 145 on the vertical one. When we analyzed the broaderoptimizationspace,thisnodewasjustthelocalmaximum.Nowwhenthehigherextreme has been left outside the optimization space, the local maximumbecomestheglobalone.Theobjectivefunctionvalueinthisnodeis4.1%,whichissignificantlylowerthantheglobalmaximumoftheoriginalspace(7.1%).Tosummarize,wecanconcludethattherangeofparametervaluesdetermines

theshapeofoptimizationspaceandinfluencessignificantlytheoptimalsolutionthat will finally be chosen. In general, the broader the range of acceptableparameter values, the higher the chance that the objective functionmaximumwillfallintotheoptimizationspaceunderscrutiny.However,thechancetofindthismaximumintheprocessofoptimizationdecreases,sincemorenodeshavetobe examined and the risk that optimization algorithm will stop at a localmaximumincreases.

2.2.3.OptimizationStepThe optimization step does not exert influence on the general shape of the

optimizationspace,butitdirectlyinfluencesitsdetails.Thewiderthestep, themore details of relief of the optimization surface may be missed in theoptimizationprocess.Forexample, thenarrowpeakof theobjectivity functionmaybemissedbecauseofawidestep.Hence,thescopeofinformationabouttheobjectivefunctiondecreaseswhenthestepisincreased.For the optimization surface analyzed earlier (in Figure 2.2.2) we used the

stepof2days for the“numberofdays tooptionsexpiration”parameterand5daysforthe“HVestimationperiod”parameter.Nowletusincreasethesevaluesto 4 and 10 days, respectively, and examine the effect of this change on theminuteness of information borne by this new surface.The left chart of Figure2.2.4showstheoptimizationspaceobtainedastheresultofincreasingthestep.Comparisonof this surfacewithFigure2.2.2 reveals that, despite reduction indetails, the area of global maximum remained intact. Originally the globalmaximum node had coordinates of 30 on the horizontal axis and 105 on thevertical axis. Coordinates of the new global maximum are 30 and 100,respectively. Although the node with the highest value of objective function(7.1%)hasdisappeared,itwasreplacedbyanotherglobalmaximumwithaveryclosevalueofobjectivefunction(7%).

Page 117: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure2.2.4.Optimizationspacesofthebasicdelta-neutralstrategyconstructedfordifferentoptimizationsteps.Objectivefunction:profit.

Let us keep on increasing the step to 6 days for the “number of days toexpiration” parameter and 15 days for the “HV estimation period” parameter.Thenumber of relief details decreases evenmore (in the right chart ofFigure2.2.4).Furthermore,theoriginaloptimalarea,whichwasalongthe30thverticallineandcontainedtheglobalmaximumnode,hasdisappeared.Thenewglobalmaximum has drifted to the node with coordinates 32 and 125. The value ofobjective functionof thenewglobalmaximumhasdeclined.Thisbringsus tothe conclusion that as the optimization step increases, the effectiveness ofoptimizationdeclines.Nevertheless,theincreaseoftheoptimizationstephasitsadvantages.Despite

theshiftinglobalmaximumcoordinatesandworseningoftheoptimalsolution,the new optimal area is still located approximately in the same region of theoptimization space where it was originally. At the same time, the surfacebecomessmoother.Theadvantageofsmoothingisthatmostinsignificantlocalextremesdisappearfromtheoptimizationspace.Consequently,theprobabilityofthe optimization (using more economical methods to search for an optimalsolution than the exhaustive search method) stopping at the local maximumdecreases.The following conclusion can be drawn from this study:By increasing the

optimizationstep, thesystemdeveloper,on theonehand,decreases thechancethat theobjective functionmaximumwillget into theoptimizationspaceunder

Page 118: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

scrutiny, but, on the other hand, he also reduces the number of computationsrequired and increases search effectiveness by eliminating insignificant localextremes.

2.3.ObjectiveFunctionsandTheirApplicationTheobjectivefunctionisusedtoevaluateandcomparetheutilityofdifferent

combinationsofparametervalues.Thatiswhyselectionofappropriateobjectivefunction is one of the key elements determining the effectiveness ofoptimization.Eachfunctioncreatesitsownoptimizationspacewithspecificandsometimes even unique features. Although optimization spaces pertaining todifferent utility functions may be quite similar in their shape, they may alsodiffergreatly. In this sectionweanalyzeobjective functions thatgeneratebothsimilaranddifferentspacesintermsoftheirshape.Inmostcases,itishighlyunadvisabletolimitoptimizationsystemtoonlyone

utility function. Usually three to four functions must be used simultaneously.Sometimestheirnumbermaybeevenhigher(uptotenormore).Applyingmanyobjective functions is especially relevant to the optimization of option tradingstrategies,sinceinthiscasenotonlystandardriskandreturncharacteristicshavetobeevaluated,butalsodifferentfeaturesthatarespecifictooptions.InChapter1wealreadymentionedseveralobjectivefunctions(whenwediscussedvariouscharacteristics of option portfolios). Using more than one objective functionnecessitatesdeveloping specialmethodsofmulticriteria analysis.A substantialpartofthissectionisdevotedtothisveryproblem.

2.3.1. Optimization Spaces of Different Objective Functions The keyobjectivefunctionforoptimizationofmostautomatedtradingsystemsisprofit.Thischaracteristicmaybeexpressedindifferentforms—inrelative(percentage)or absolute figures, annualized or tied to the system’s operational cycle. Allpreviousexamplesinthischapterwerebasedonthisobjectivefunction.Thetop-leftchartofFigure2.3.1reproducestheoptimizationspaceconstructedforthisbasicobjectivefunction.Nowweturnourattentiontothefollowingquestion:Inwhatwaydoes the selectionof specificobjective functionsaffect the shapeofthe optimization space? (The same two parameters that we examined in theprevious sections will be used to construct the space.)

Page 119: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure2.3.1.Optimizationspacesofthebasicdelta-neutralstrategyconstructedforfourdifferentobjectivefunctions.

WhentheSharpecoefficientisusedastheobjectivefunction(inthetop-rightchartofFigure2.3.1),theoptimizationspacehasalmostthesameappearanceasit had for the profit-based function (except for some minor, insignificantdiscrepancies). The large optimal area is situated in approximately the sameplaceandhasavery similar shape.Theglobalmaximumhasalmost the samecoordinatesasfortheprofit-basedobjectivefunction.Theonlydifferenceisthattheverticalaxiscoordinateis100daysfortheSharpe-basedfunctioninsteadof105 for the profit-based function (this insignificant difference is hardly of any

Page 120: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

importance).We should also note that this optimization surface is polymodalbecauseithasseveralotheroptimalareaswithlocalmaximums.However,sincetheseareasareverysmall,theyareinferiortotheglobalmaximumareaintermsofrobustness.Thenextobjectivefunction,maximumdrawdown,representsariskindicator

that is commonlyused for evaluationof trading strategies.Optimization spacecorrespondingtothisfunctionisshowninthebottom-rightchartofFigure2.3.1.In contrast to other objective functions, optimization based on maximumdrawdown requires minimizing the function rather than maximizing it. Thussurfaceareaswithlowaltitudesareoptimal.ContrarytotheoptimizationspaceconstructedusingtheSharpe-basedobjectivefunction,thesurfacecorrespondingtomaximumdrawdown is completely different from the space of profit-basedfunction.Optimalareasarestretchedintwodirections:(1)inthefirsthalfofthevaluesrangeofthe“numberofdaystooptionsexpiration”parametergiventhatthe“HVestimationhorizon”haslowvalues(alongthehorizontalaxis);(2)inawiderangeof“HVestimationhorizon”parametervaluesgiventhatthe“numberofdaystooptionsexpiration”parameterhaslowvalues(alongtheverticalaxis).TheoptimalareasoftheSharpe-basedobjectivefunctionwerenotedinthesamelocationsoftheoptimizationspace(althoughtheywereofamuchsmallersize).This can be explained by the fact that the Sharpe coefficient “contains” risk-related information (standard deviation). Since maximum drawdown is theextreme outlier of the returns time series, it directly influences the standarddeviationandindirectlyinfluencestheSharpecoefficient.Thepercentageofprofitabletradesisanotherindicatorappliedfrequentlyfor

measuring the performanceof automated trading systems.When this indicatorwasusedastheobjectivefunction(inthebottom-leftchartofFigure2.3.1),weobtained theoptimization surface thatwas fundamentally different by its formfrom the surfaces pertaining to other functions. Firstly, instead of a singleoptimalarea(foundfortheprofit-basedobjectivefunction)orseveralsuchareas(found for the Sharpe-based and maximum drawdown-based functions), thesurfaceofthisfunctionishighlypolymodalwithmanyoptimalareas.Secondly,all optimal areas of this objective function represent small islands, while themajority of areas pertaining to other functions have relatively large surfaces.Thirdly, and this is probably themost valuable feature, optimal areas of otherfunctions do not coincide with optimal areas of the objective functionconstructedonthebasisofthepercentageofprofitabletrades.Afterstudyingoptimizationspacesoffourobjectivefunctions,wecanmake

several important conclusions. Each function carries a certain amount of

Page 121: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

importantinformation,partofwhichisduplicatedwithinformationcontainedinother functions and the rest of which is unique. The extent to which theinformation contained in different functions overlaps may be different fordifferentfunctions.Forexample,theSharpe-basedfunctionalmostdoesnotaddnew information to the information contained in the profit-based function.Hence,itwouldhardlybereasonabletousebothfunctionssimultaneously(thevolume of additional calculations does not justify the little additionalinformationthatmightbeobtained).Atthesametime,otherobjectivefunctionsdocontainasubstantialvolumeofnewunique information,whichmaynotbeobtainedthroughusingtheprofit-basedfunction.Theinclusionofsuchfunctionsintoamulticriteriaoptimizationsystemmightbejustified.In this section we performed a visual (nonformalized) analysis of different

objective functions and detected different extents of duplication of theinformation carried by these functions. In order to express these observationsquantitatively—whichwill enable us to accomplish an objective and unbiasedselectionoftheobjectivefunctions—weneedtoanalyzetheircorrelations.Thisiswhatthenextsectionisabout.

2.3.2. Interrelationships of Objective Functions In order to expressnumerically the extent of duplication of information contained in differentobjective functions, we need to conduct pairwise comparison of theirinterrelationships.Thelowerthecorrelationbetweentwofunctions,thelesstheinformation overlaps and the better it is for multicriteria optimization. Thecorrelation coefficient shows the extent of interrelationship between twofunctions, and the determination coefficient (the square of correlationcoefficient) expresses the extent to which the variability of one objectivefunction is explained by the variability of the second function. Therefore, theportion of additional nonduplicated information that is introduced into theoptimization system as the result of including an additional objective functioncan be expressed by the indicator calculated as one minus the determinationcoefficient.Correlationanalysisdemonstrates thatallobjectivefunctionsare interrelated

toagreaterorlesserextent(seeFigure2.3.2).Asonecouldexpect,thehighestcorrelation was detected between profit and Sharpe coefficient (visualsimilaritiesofoptimization spacespertaining to these two functionshavebeennotedintheprevioussection).Inthiscasethecorrelationcoefficientisveryhigh(r=0.95).Hence,theportionofnonduplicatedinformationisjustabout10%(1-0.952=0.10).Therefore,thereisnoreasontouseprofitandSharpecoefficient

Page 122: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

simultaneouslywithinoneoptimizationsystem.

Figure2.3.2.Correlationsofdifferentobjectivefunctions.

Page 123: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Theextentofinterrelationshipbetweenprofitandthepercentageofprofitabletrades,aswellasbetweenprofitandmaximumdrawdown,ismuchlowerthanbetween profit and Sharpe coefficient (an inverse relationship in the case ofmaximum drawdown should be treated as a direct one since low drawdownvaluesarepreferable).Inthefirstcase,thecorrelationcoefficientis0.37(inthemiddle-leftchartofFigure2.3.2),andinthesecondcaseitis–0.35(inthetop-right chart of Figure 2.3.2). This means that the portions of nonduplicatinginformationforthesepairsofobjectivefunctionsare86%and88%,respectively.Thesevaluesarehighenough to induce thoroughconsiderationconcerning thepracticability of their inclusion in the multicriteria optimization system.However, before deciding this positively, we need to determine whether it isreasonabletousebothadditionalfunctions(percentageofprofitabletradesandmaximum drawdown) or whether adding just one of them to the profit-basedfunctionwouldbesufficient.Inordertomakethisdecision,wemustanalyzetherelationshipbetweenthese

two utility functions. As the bottom-right chart of Figure 2.3.2 and lowcorrelation coefficient (–0.10) imply, the percentages of profitable trades andmaximum drawdown are almost independent. Information contained in thesetwofunctionsalmostdoesnotoverlap(theshareofnonduplicatinginformationis 99%). Therefore, adding both objective functions into the multicriteriaanalysissystemisjustified.Wecansummarizethisanalysisbystatingthatitwouldbereasonabletouse

threeobjectivefunctions(profit,percentageofprofitable trades,andmaximumdrawdown) out of four examined candidates. The elimination of the Sharpecoefficient frommulticriteria analysis is justifiednotonlyby the fact that thisfunctionduplicatesalmostcompletelytheprofit-basedfunction,butalsobythefactthattheSharpecoefficientcorrelateswiththepercentageofprofitabletradesandmaximumdrawdownmuchmorestronglythantheprofitfunctiondoes(inthemiddle-rightandbottom-leftchartsofFigure2.3.2).Uptothispoint,theprocedureofselectingtheobjectivefunctionslooksquite

simple and straightforward. However, we must admit that it was deliberatelysimplifiedinordertofacilitatedescriptionofgeneralprinciples.Nowweremovethis simplification to demonstrate the complexity of the objective functionsselectionprocess.The point is that interrelationships shown in Figure 2.3.2 are based on the

whole set of data belonging to optimization spaces of correspondingobjectivefunctions.Thismeansthattheseinterrelationshipswerecreated(andcorrelations

Page 124: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

calculated)onthebasisoffullrangesoftwoparametervalues(2to120daysforthenumberofdaystooptionsexpirationand5to300daysfortheHVestimationperiod). For example, to estimate the correlation between profit and Sharpe-based functions, eachnode in the top-left chartofFigure2.3.1was associatedwithacorrespondingnodeinthetop-rightchart.Therelationshipobtainedastheresultofsuchassociationconsistsof3,600points(inthetop-leftchartofFigure2.3.2).However, it would be reasonable to suppose that the extent and even the

directionofinterrelationshipsbetweendifferentobjectivefunctionsmaychangedependingon specificvaluespossessedby theparametersand,hence,on theirvalue ranges. In order to check this idea, we should calculate correlationsseparately for each parameter (that is, we need to check whether correlationschangedependingonanyspecificvaluesoftheparameter).Letusstartwiththe“HVestimationperiod”parameter.Correlationsbetween

somepairs of the objective functions depend on values of this parameter, andcorrelations of other pairs of the functions do not (see Figure 2.3.3). Forexample, the correlation of functions for which the highest extent ofinterrelationshipwas observed (profit andSharpe coefficient) doesnot changethrough the whole range of parameter values. All other pairs of functionsdemonstratecertainpatterns.

Figure2.3.3.Therelationshipbetweenthecorrelationcoefficientofsix

Page 125: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

pairsofobjectivefunctionsandvaluesofthe“HVestimationperiod”parameter.

The interrelationship between the objective functions expressing profit andpercentage of profitable trades is rather high under low values of the “HVestimation period.” As parameter values increase, correlation of these twofunctions decreases, and when the parameter reaches the upper bound of itsacceptable values range, it drops to zero. The same trend is observed forinterrelationshipwithinanotherpairofobjective functions—Sharpecoefficientandthepercentageofprofitabletrades.ThissimilarityintrendsisnotsurprisinggiventhatprofitandSharpecoefficientarealmostperfectlycorrelated.Two other pairs of objective functions (profit and maximum drawdown;

Sharpecoefficientandmaximumdrawdown)alsodemonstratealmost identicaltrends(thereasonforsimilarityofthetrendsisthesameasinthepreviouscase).Correlations for these two pairs are quite high under low parameter values(rememberthatincaseofmaximumdrawdown,negativecorrelationcoefficienthas thesamemeaningaspositivecorrelation inothercases).As theparameterincreases to average values, correlations approach zero and then becomenegativeagain.Whenthesamedatawereexaminedaggregately(inthetop-rightand middle-right charts of Figure 2.3.2), we could discover only the inverserelationship for these pairs of objective functions. The detailed analysispresented in Figure 2.3.3 reveals that under average values of the “HVestimation period” parameter, there are no correlations at allwithin these twopairs of objective functions (and hence information contained in them is notduplicated).The interrelationshipbetween the lastpairofobjective functions (maximum

drawdownandpercentageofprofitabletrades)demonstratestheuptrend.Underlow parameter values the correlation coefficient is negative, and when theparameter reaches its highest values, correlation becomes positive (thecorrelationcoefficientiszerowhentheHVestimationperiodisabout200days).Notethatwhenthesamedatawereconsideredaggregately(inthebottom-rightchart of Figure 2.3.2), we could not detect any relationship between theseobjective functions. As a result, we could come to a wrong conclusion thatinformationcarriedbythesefunctionsiscompletelynonduplicating.Meanwhile,the detailed analysis (see Figure 2.3.3) specifies that the information isnonduplicatingonlyinthesecondthirdoftheparametervaluesrange.Nowwegoontoconsidertheinfluenceofthesecondparameter(numberof

daystooptionsexpiration)ontheinterrelationshipbetweenobjectivefunctions

Page 126: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

(seeFigure2.3.4).Thisparameterinfluencescorrelationsofobjectivefunctionsmuchstrongerthanthe“HVestimationperiod”parameterdoes(compareFigure2.3.3andFigure2.3.4).Evensmallchangesintheparameterleadtosignificantchangesincorrelations.Correlationcoefficientsofalmostallpairsofobjectivefunctionsfluctuateinaverywiderange(from–0.9to0.9).However,incontrastto the previous case (when we examined the effect of the “HV estimationperiod”parameter),theinfluenceofthenumberofdaystooptionsexpirationisratherchaotic.Thedynamicsofcorrelationcoefficientshavenodistinguishabletrends.

Figure2.3.4.Therelationshipbetweenthecorrelationcoefficientofsixpairsofobjectivefunctionsandvaluesofthe“numberofdaystooptions

expiration”parameter.

The pair of objective functions expressing profit and Sharpe coefficientpresents the only exception. In this case the correlation coefficient does notdependonthenumberofdayslefttooptionsexpirationandispersistentlyatitsmaximumalmostatthewholerangeofparametervalues(seeFigure2.3.4).Thesame relationship was observed for this pair of objective functions when theinfluenceofthe“HVestimationperiod”parameterwasanalyzed.In general,we can conclude thatwhen deciding to include or not include a

given objective function in the multicriteria optimization system, theinterrelationships between this function and other candidate functionsmust be

Page 127: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

considered.Functionswiththelowestpossiblecorrelationsshouldbepreferred.Thiswillintroducenewnonduplicatedinformationintothewholesystem.Whileestablishing theextentof interrelationships that ispermissible foracceptinganobjectivefunction(thethresholdforthecorrelationcoefficientbelowwhichtheobjectivefunctionisaccepted),wehavetomakesurethatthecorrelationusedinthe decision-making process is independent of parameter values. If suchdependence does exist (as it was shown previously), we should use thecorrelationcoefficientthathasbeenobtainedonthebasisofdatacorrespondingmostcloselytothelogicofthetradingstrategyunderdevelopment.

2.4.MulticriteriaOptimizationIn the preceding section we discussed selection of objective functions for

multicriteria optimization. This section is devoted to the search of optimalsolutions using multicriteria analysis methods. As applied to parametricaloptimization, the purpose of multicriteria analysis consists in simultaneousutilization of many objective functions (each of which represents a separatecriterion)torangenodesofagivenoptimizationspace(eachnoderepresentsauniquecombinationofparametervalues)bytheextentoftheirutility.Themainproblemofmulticriteriaoptimization is that completeorderingof

allalternativesmayturnouttobeimpossibleduetotheirnontransitivity.Letusillustrate thiswithasimpleexample.Assumethatanalternative is regardedasthebestoneifitoutmatchesallotheralternativesbymostcriteria.Supposethatthe comparison of three nodes (A, B, and C) by values of three objectivefunctions(criteria)givesthefollowingresult:A=(1;2;3),B=(2;3;1),C=(3;1;2) (criteriavalues aregiven inparentheses).Obviously, nodeB ispreferred tonodeAaccordingtothevaluesofthefirstandsecondcriteria.CisbetterthanBby thefirstand thirdcriteria. If transitivity ismaintained, it shouldfollowthatnodeCispreferredtoA.However,thatisnotthecase,sinceA surpassesCbytwocriteria,thesecondandthethirdones.Unfortunately, the nontransitivity problem has no universal solution.

Nevertheless,therearetwomainapproachestoobtaininganoptimalsolution(orseveral solutions) despite the failure to comply with transitivity. The firstapproach is based on reducing all objective functions to the single criterioncalled“convolution.”ThesecondapproachconsistsofapplicationoftheParetomethod.

2.4.1.ConvolutionGivingup simultaneous application of several criteria and substituting them

Page 128: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

withanewandonlycriterion(whichisafunctionwithinitialcriteriaservingasarguments) constitutes the approach called “convolution.” The advantage ofconvolutionisthesimplicityofrealizationandthepossibilitytoadjusttheextentof influence of each criterion on optimization results. This can be done bymultiplying criteria values byweight coefficients—the higher theweight of aparticularcriterion, thegreater its impactonthefinalresultof themulticriteriaoptimization. The main drawback of convolution is an unavoidable loss ofinformationthatoccurswhenmanycriteriaaretransformedintoasingleone.Twoconvolutiontypesareusedcommonly:additive(asumoranarithmetic

meanofparametervalues)andmultiplicative(aproductorgeometricalmeanofparametervalues).Applicationofmultiplicativeconvolution ispossibleonly ifbothcriteriaarepositive(sincetheproductoftwonegativevaluesispositive),orifonlyoneofthecriteriamaytakeonanegativevalue.Onemustalsotakeintoaccountthatwhenoneofthecriteriaiszero,themultiplicativeconvolutionalsoequalszeroregardlessofthevaluepossessedbythesecondcriterion(itisnotthecaseforadditiveconvolution).Criteriawithlowervalueshavemoreinfluenceinthemultiplicativethanintheadditiveconvolution.Additiveconvolutionismoreappropriateforcriteriahavingvalueswithsimilarscales.Apart from additive and multiplicative convolutions there is a selective

convolution when the lowest (the most conservative approach) or the highest(themost aggressive approach) value is taken from thewhole set of objectivefunctions as a convolution value for each node. In our previous book(Izraylevich and Tsudikman, 2010) we introduced minimax convolution, forwhich the product of the highest and the lowest criteria is used as theconvolutionvalue.Whencalculatingtheconvolutionvalue,wemustrememberthatcriteriamay

be measured in different units and have different scales. The followingtransformationcanbeused to reduce them to theuniformscalewith the same

valueranges:where xi is the criterion value for the i-th node, and xmin and xmax are

minimum and maximum criterion values, respectively. Application of thisformulareducesthecriterionvaluetotherangefrom0to1.Letusconsideranexampleofapplyingtheconvolutionconcepttothebasic

delta-neutral strategy. Suppose that three of the four objective functionspresented in Figure 2.3.1were selected to serve as criteria—profit, maximumdrawdown,andthepercentageofprofitabletrades(Sharpecoefficientisrejected

Page 129: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

due to its high correlation with profit). In the first place, values of all threeobjective functionsmust be reduced to the range 0 to 1 (by applying formula2.4.1).Havingcreatedthreetypesofconvolutions(additive,multiplicative,andminimax), we observed that in this particular case they all produced rathersimilarresults.Figure 2.4.1 shows the optimization space of minimax convolution. This

surfaceispolymodalandhasfouroptimalareas.Threeofthemhavearelativelyvastareaandoneisverysmall(sincethesurfaceareaisoneofthemainfactorsindeterminingtheselectionofoptimalsolution,thefourthareamaybeexcludedfrom our consideration). In this case, multicriteria analysis based on theconvolution of objective functions did not allow establishing a single optimalsolution since each of the three areas has its own localmaximum.Hence, theapplication of convolution did not solve the optimization problem completely.We still have to select one of these three areas. Since all of them haveapproximately the same altitudes (convolution values), the selection must bebasedonadifferentprinciple.Inthenextsectionswediscusstheselectionofanoptimalareaonthebasisofitsreliefcharacteristicsandquantitativeestimatesofrobustness.

Figure2.4.1.Multicriteriaoptimizationofthebasicdelta-neutralstrategy.Optimizationspaceiscreatedbyconstructingaminimax

convolutionofthreeobjectivefunctions(profit,maximumdrawdown,and

Page 130: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

thepercentageofprofitabletrades).

2.4.2. Optimization Using the Pareto Method Application of the Paretomethod allows solving the selection problem when different criteria valuescontradicteachother.Thesituation,whensomenodesoftheoptimizationspaceare better than others according to the values of one objective function (forexample, profit), but are worse according to another function (for example,maximum drawdown), is rather frequent. The main drawback of the Paretomethodisthatwecangetseveralequallygoodsolutionsinsteadofasingleone.In such circumstances the selection of a unique solution will require furtheranalysisandapplicationofadditionaltechniques.Formalization of the multicriteria optimization problem is realized in the

following way. Assume that for each node (alternative) a of the optimizationspacethereisn-dimensionalvectorofobjectivefunctions(criteria)valuesx(a)=(x1(a),...,xn(a)). Using values of n criteria, we need to find alternatives withmaximum values of vector coordinates (that is, with maximum values ofcorrespondingobjectivefunctions).Suppose that thehigher thecriterionvalue,the better the alternative. When alternative a is compared to alternative b,alternativea is deemed to dominate over alternative b if the following set ofinequalitiesholds:xi(a)≥xi(b),foralli=1,...,n,andthereisatleastonecriterionj for which strict inequality xj(a) >xj (b) holds. In other words, node a ispreferred to node b if a is not worse than b according to the values of allobjectivefunctionsandisbetterthanbbyatleastoneofthem.Obviously, the presence of domination (in the sense defined previously)

determinesunambiguouslywhichof the twoalternatives isbetter.However, ifdominationisuncertain,thequestionofwhichalternativeisabetteroneremainsopen. In this case we have to admit that none of the alternatives isunambiguouslysuperiortotheotherone.Based on the previously stated reasoning, the multicriteria optimization

problem can be defined in the following way: Among the set of all possiblealternatives, identify the subset that includes only nondominated alternatives,that is, those for which there are no alternatives dominating over them. ThissubsetistheParetoset.Eachelementbelongingtoitcanbeconsideredthebestin the sense defined previously. The number of alternatives composing thePareto setmay be different. Itmay be one alternative dominating over all therest,severalbestalternatives,oreventhewholeinitialset.Inourexampleof thebasicdelta-neutralstrategy, theoptimizationspaceA=

Page 131: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

{a1,...,am}consistsofmalternativenodes(m=3,600intheexample),evaluatedwithnfunctions-criteria(n=3)withvaluesx(a)=(x1(a1),...,xn(am)).ToestablishtheParetoset,weneedtoarrangeapairwisecomparisonofallthealternatives,duringwhichwegetridofdominatedonesandincludenondominatedvariantsintotheParetoset.Eachalternativeak iscomparedwithall therest.If thereisthealternativeal thatisdominatedbyak,al isdiscarded.Ifak isdominatedbysomeelementam from the remaining elements,ak is discarded. If none of theelementsdominatesoverak, the latter is included in thePareto set.Afterward,we pass on to comparing the next variant with all the rest. The maximumnumber of comparisons required is about 0.5×m×(m-1), which is quitereasonableinmostcases.However,fasteralgorithmsmaybeneededtobuildtheParetosetwhenmorecriteriaandalternativesare involved in theoptimizationprocedure.Asmentionedearlier,thedrawbackoftheParetomethodistheimpossibility

to influence the number of nodes included in the Pareto set. The number ofalternativesbelongingtotheoptimalsetmaychangefromcasetocaseanddoesnotdependonourwishesandpreferences.Theuniqueoptimalsolutionmaybeobtained onlywhen the optimization space has the node forwhich all criteriavaluesarehigherthantheirvaluesforanyothernodes.However,inmostcases,severaloptimalsolutions,ratherthanasingleone,arepresent.LetusconsidertheapplicationoftheParetomethodforoptimizingthebasic

delta-neutral strategy. The same three objective functions that were used inmulticriteria optimization with the convolution method (profit, maximumdrawdown,andpercentageofprofitabletrades)willbeusedagainasthecriteria.In contrast to convolution, the Pareto method does not allow constructing anoptimizationspacesimilartothesurfaceshowninFigure2.4.1.Instead,wegetthe list of dominating nodes that compose the optimal set. Consequently, theoptimizationsurface turns into thecoordinatespacedesignatingthepositionofseparateoptimalnodes(seeFigure2.4.2).

Page 132: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure2.4.2.Multicriteriaoptimizationofthebasicdelta-neutralstrategybytheParetomethod.Theleftchartshowsoptimalsetsobtainedby

applyingtwoobjectivefunctions(threeoptimalsetscorrespondingtothreedifferentfunctionpairsareshown).Therightchartshowstheoptimalset

obtainedbysimultaneousapplicationofthreeobjectivefunctions.

First we consider the Pareto set obtained by applying two criteria. Threeobjectivefunctionscangiverisetothreecriteriapairs,eachofwhichproducesitsownoptimalset.Nodescomposingtheseoptimalsetsaregroupedinseveralareas in thecoordinatespace.On the leftchartofFigure2.4.2, theseareas aredenoted with sequence numbers. Interestingly, none of these areas containsnodesbelongingtoall threeoptimalsets.Thethirdareacontainsasinglenodebelongingtothesetobtainedbyapplyingprofit-basedandmaximumdrawdownobjectivefunctions.Nodesselectedbythispairoffunctionsarealsopresentinthe second and fifth areas. Nodes corresponding to the pair of objectivefunctionsthatarebasedonprofitandpercentageofprofitabletradesarefoundinthe first, second, and fourth areas. Finally, nodes contained in the optimal set,selectedusingobjectivefunctionsbasedonmaximumdrawdownandpercentageof profitable trades, are located in the first, fourth, and fifth areas. Suchdistributionofoptimal sets incoordinate space indicates that eachof the threeobjective functions makes its own contribution to solving the optimizationproblem. Therefore, in this case it would be reasonable to include all threeobjectivefunctionsintheParetosystemofmulticriteriaoptimization.

Page 133: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

The set of optimal solutions obtained as a result of applying three criteriasimultaneously isshownin therightchartofFigure2.4.2.Nodesbelonging totheoptimalParetosetarelocatedapproximatelyinthesamefiveareasasintheprevious examplewhen criteriawere applied by pairs. The highest number ofnodes(sevenin total) issituatedin thesecondarea; thefirstareacontainsfivenodes;andthethird,fourth,andfifthareascontainonlytwonodeseach.In the previous example, when criteria were used by pairs, optimal sets

contained five to seven nodes (depending on the specific criteria pair).Simultaneousapplicationofthreecriteriaenlargedthesetto18elements.Thisisthe general property of the Pareto method—increasing the number of criterialeads to increasing the number of optimal solutions, other things being equal.Since effective resolution of the parametric optimization problem requiresselectingasingleoptimalnode,includingeachadditionalutilityfunctionintotheoptimization system complicates this task significantly. Thus, whenmaking adecision concerning the inclusion of a particular objective function into aspecificoptimizationframework,weshouldnotonlyconsider thescopeof thenew information added to the system by each additional function, but alsoaccountforincreasingcomplexityoftheselectionofasingleoptimalsolution.Distributionofoptimalareasobtainedbyapplyingtheconvolutionmethodis

quite similar to the distribution observed when optimal solutions weredetermined using the Paretomethod (compare Figure 2.4.1 and Figure 2.4.2).Thismeansthatbothmethodslead,inthisparticularcase,toapproximatelythesame results. However, it should be noted that under other circumstances,applicationofthesemethodsmightbringaboutcompletelydifferentoutcomes.Themost important conclusion that follows frommulticriteriaoptimizations

considered in this section is that bothmethods definemore than one optimalarea. None of them can be designated as the unique optimal solution.Consequently,wemustadmitthattheoptimizationproblemhasnotbeensolvedcompletely.Weshouldcontinuethesearchfortheuniqueoptimalsolution.Thisissueisdiscussedinthenextsection.

2.5.SelectionoftheOptimalSolutionontheBasisofRobustnessAsshownintheprecedingsection,multicriteriaoptimizationhasoneessential

drawback.Inmostcasessimultaneousapplicationofseveralobjectivefunctionsleadstoselectionofseveraloptimalsolutions.Whilenoneofthemisbetterthanothers,westillneedtochooseoneuniquealternative.Suchachoicecanbemadebyconsideringtheshapesoftheoptimalareasthatsurroundoptimalnodes.

Page 134: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Whenanyparticularnodeisevaluatedintheprocessofmulticriteriaanalysis,onlythevaluesoftheobjectivefunctionsthatcorrespondtothisparticularnodearetakenintoaccount.Objectivefunctionsofadjacentnodesaretotallyignored.Meanwhile, the relief of the optimal area is an important indicator ofoptimizationreliability.Allotherthingsbeingequal,thenodeispreferredifitissituated near the center of a relatively smooth high area (the height isdeterminedbythevaluesofobjectivefunctions).Itisalsodesirablethatthisareahaswide,gentleslopes.Thismeansthatnodessurroundingthenodeofoptimalsolutionshouldbeclosetoitbyobjectivefunctionvalues.According to thedefinitiongivenearlier,anoptimalsolutionsituatedwithin

suchanareaisrobust.Iftheoptimalsolutionissituatedintheareawithvariablealtitudes, sharp peaks, and deep lows, it is less robust and, consequently, lessreliable.Although robustness has no strict mathematical definition with regard to

optimization procedure, we can state that an optimal solution located on thesmooth surface is more robust than a solution on the broken surface. If thesolutionisrobust,smallchangesinvaluesofoptimizedparametersdonotleadtosignificantchangesinthevaluesofobjectivefunctions.Inordertobasetheselectionoftheoptimalsolutionnotonlyonthealtitude

mark, but on robustness as well, it is necessary to evaluate quantitatively therelief of the optimal area and the extent of its roughness.When optimizationspaceismultidimensional,thisproblemisverycomplexandrequiresapplicationof topology methods. However, for two-dimensional spaces we can proposeseveralrelativelysimplemethods.

2.5.1.Averaging theAdjacentCells Thismethod of robustness evaluation issimilar to the concept of moving averages. When the moving average iscalculated, values of the objective function (usually price or volume) areaveragedwithinacertain timeframe that ismoving in time.Thisprocedure isused to describe time dynamics and to determine trends in price or otherindicators. For analyzing the relief of optimization space and evaluating therobustness of the optimal solution, averaging of the objective function isperformedwhilemoving through the optimization space. In each node of thespace,thevalueoftheobjectivefunctionissubstitutedwiththeaveragevalueofthe objective functions of a small group of adjacent nodes. Thus, the originaloptimization space is transformed into a new space that will subsequently beused to find the optimal solution. The search in this transformed space isperformedasusual,bythealtitudemarks.Thenewaltitudemarkofeachnode

Page 135: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

containsinformationnotonlyabouttheobjectivefunctionsofthenodeitself,butalsoabout theobjective functionvaluesofa smallareasurrounding thisnode.Therefore,applyingthismethodenablesustotakeintoaccounttherobustnessoftheoptimalsolution.The only averaging parameter is the size of the area whose nodes are

averaged.Thesemaybeonlyadjacentnodes (one lineofnodes surroundingagivennode).Iftheoptimizationspaceistwo-dimensional,eachnodeisadjacentto eight other nodes (excluding nodes situated at the borders of acceptableparameter values). Thus, when one line of nodes is averaged, the average iscalculatedon thebasisofninevalues—eightvaluesofadjacentnodesplus thevalue of the central one. In averaging two lines, the calculation is performedwith25values;forthreelines,49values;andsoon.Ingeneral, thenumberofaveragednodesniscomputedas

n=(2m+1)2,wheremisthenumberoflinesofnodessurroundingthecentralnode.Application of this procedure can be demonstrated using the optimization

space obtained earlier as the convolution of three objective functions. Theoriginaloptimizationspace(seeFigure2.4.1)containsthreeoptimalareas,eachof which may be selected to perform the final search for a single optimalsolution. Figure 2.5.1 shows two transformations of the original optimizationspace:Theleftsurfacewascreatedusingm=1(averagingonelineofadjacentnodes), while for the right surfacem = 2 (two lines are averaged). After thetransformation,basedontheaveragingofonlytheclosestnodes(oneline),justoneoptimalarea remainedoutof the three thatwerepresentedoriginally. It islocated in the range of 28 to 34 days by the “number of days to expiration”parameter and from75 to 125 days by the “HVestimation period” parameter.The reason for the disappearance of the two other areas is that their extremevalues turned out to be less robust than the extremum of the area that hadpersisted. The transformation obtained by averaging more nodes (in the rightchart of Figure 2.5.1) generates similar results—the disappearance from theoptimizationspaceoftwolessrobustareasandpreservationofjustoneoptimalarea.Thus,both transformationspoint to thesamepreferablearea.Besides thehighest robustness, this area has also the biggest surface (see the originaloptimization space, in Figure 2.4.1). This additional advantage supports thedecisiontoselecttheoptimalsolutionwithinthisparticulararea.

Page 136: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure2.5.1.TransformationoftheoptimizationspaceoftheconvolutionshowninFigure2.4.1byapplicationoftheaveragingmethod.Theleftchart

isobtainedbyaveragingonelineofadjacentnodes;therightchart,byaveragingtwolines.

2.5.2.RatioofMeantoStandardErrorTheaveragingmethoddescribedinthepreceding section takes into account the height (objective function value) andsmoothness (robustness) of the optimal area, but the influence of the formercharacteristicisgreaterthanthatofthelatterone.Themethodproposedinthissectionassignsmuchgreaterweighttotherobustness.Accordingtothismethod,theobjective functionvalue in eachnodeof theoriginal optimization space issubstitutedwiththeratioofthemeanofobjectivefunctionvalues,calculatedfora group of surrounding nodes, to the standard error, calculated for the samegroup. The notion of the “group of nodes” has the same meaning as in theaveragingprocedure.Thegroupcontainsthecentralnodeitselfandone,two,ormore lines of the adjacent nodes. Such transformation of optimization spacetakes into account both the altitude of the optimal area (numerator) and thesmoothnessofitsrelief(denominator).Figure 2.5.2 demonstrates two transformations of the convolution shown in

Figure2.4.1.Asintheprecedingsection,transformationswereconstructedusingoneandtwolinesofadjacentnodes(m=1andm=2,respectively).Whenonelineofnodeswasusedfor transformingtheoriginaloptimizationspace(in theleft chart of Figure 2.5.2), many new optimal areas arose (the original spacecontains only three such areas). The number of new areas is so high that

Page 137: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

objectiveselectionofoneofthemispracticallyimpossible.Thisproblemcanbesolvedbyusingalargergroupofnodes(twolines).Thissignificantlysimplifiesthe relief of the transformed optimization space (in the right chart of Figure2.5.2).Onlythreeoptimalareas(fromwhichweneedtochooseone)arepresentnow.

Figure2.5.2.TransformationoftheoptimizationspaceoftheconvolutionshowninFigure2.4.1performedusingtheratioofmeantostandarderror.Theleftchartisobtainedbyusingonelineofadjacentnodes;theright

chart,byusingtwolines.

In contrast to the transformation obtained by simple averaging (see thepreceding section), location of none of the three optimal areas coincideswithlocationsofoptimalareasontheoriginaloptimizationspace.Thereasonisthatoptimalareasoftheoriginalconvolutionrepresentnarrowridgesandhighpeaks.Theseareasarenot robustenoughand their relief isquitebroken (hence, theydisappearasaresultofthetransformation).Asopposedtothis,optimalareasofthetransformedoptimizationspacerepresentfairlysmoothandwideplateausofaverage height, whichmight be preferable from the robustness point of view.Since the new optimal areas are almost equivalent in respect to both theobjectivefunctionvaluesandtherobustness,wecanselectoneof thembythesizeofthesurfaceareaanditsshape.Otherthingsbeingequal,itisbetteriftheoptimalareahasagreatersurfaceareaandamoreroundedshape(narrowareasarelessrobustatleastbyoneoftheparameters).Thesecriteriaaresatisfiedforthe area situated in the range of 84 to 92 days by the “number of days toexpiration” parameter and 155 to 175 days by the “HV estimation period”

Page 138: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

parameter.

2.5.3.SurfaceGeometryTwomethodsdescribedin theprevioussectionsarebasedontransformation

oftheoptimizationspace.Nowwemovetodescribingthealternativeapproachthatdoesnotrequiretransformation.Itisbasedonanalyzingandcomparingthegeometry of optimal areas. Actually, the developer of a trading system candevelop a multitude of similar methods employing different mathematicaltechniquesofanycomplexitylevel.Hereweproposeonepossibilitytosolvetheproblem of selecting the optimal solution while taking into account itsrobustness.To explain themain principles of the proposedmethod, let us consider the

hypotheticaloptimizationspace(seeFigure2.5.3)containingtwooptimalareas.Oneofthem(locatedintheleftpartofthespace)hasasmallersurfacearea,ahighertop,andamorestretchedform.Anotherarea(locatedintherightpartofthespace)hasabiggersurface,alowertop,andamoreroundedform.Weneedto decide which of them is preferable for optimal solution searching. Theapproach we propose is based on the assumption that the optimal area withgreater space area is preferable. By “space area” we mean the area of anelevation measured in the three-dimensional space (in the case of two-dimensional optimization), rather than surface area of its two-dimensionalprojection.Thisassumptionisquiterealisticsinceagreaterareamayindicateasuperior combination of two important characteristics—higher value of theobjective function at the extreme point and higher robustness of the potentialoptimalsolution.

Page 139: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure2.5.3.Hypotheticalexampleoftheoptimizationsurfacecontainingtwooptimalareaswithdifferentshapes.

Inthefollowingdiscussionweassumethattheoptimalarearepresentsacone.Undoubtedly,thisassumptionisasimplification;realareashavemorecomplexshapes. Nevertheless, in reality the shape of many optimal areas resembles acone. Any optimal area may be reduced to a cone by simple mathematicalmanipulations. This allows calculating the surface area without applyingcomplex differentiation methods. In order to estimate the surface area byreducingacertainpartofoptimizationspacetoacone,thefollowingproceduresshouldbeimplemented.

1.Specifytheleveloftheobjectivefunctionthatdeterminestheborderof the optimal area. All nodes situated above this altitude mark areconsidered tobelong to theoptimalareaand,correspondingly, to theconesurface.Thislevelcircumscribesthebaseofthecone.ThelevelacceptedforthetheoreticalexampledepictedinFigure2.5.3is0.25.2.Calculatetheareaoftheconebaseasthenumberofnodeslocatedwithinagivenoptimalarea.IntheexamplepresentedinFigure2.5.3,this area is equal to the number of nodes within the border thatencompassthenodeswithaltitudemarksexceedingthe0.25level.3. Knowing the cone base area of k, calculate the radius of the

Page 140: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

symboliccircleattheconebaseas4.CalculatetheareaofthelateralconesurfaceasS=Lπr,whereListheconeside.

UsingthePythagoreantheorem,wecalculatethesideoftheconeas

whereh is theconeheight.Theconeheightisknown—itisthevalueoftheobjective function at the extreme point of the optimal area.Knowing the side

length,wecancalculatetheareaofthesidesurfaceoftheconeasAftersimplealgebraictransformationsweget

It is important tonote thatkandhareexpressed indifferentunits.Thefirstonerepresentsthenumberofnodes,andthesecondoneistheobjectivefunctionvalue,whichmaytakevariousforms(percent,dollars,oranyother).ThatiswhySisadimensionlessindicator,whichisnotanareainitsoriginalsense,thoughitisproportionaltotherealareaoftheoptimalsurfaceandcanbeusedtocomparedifferentoptimalareas.Toavoidmisunderstanding,wewillfurtherrefertothischaracteristic as a “conventional area.” It is necessary that k and h haveapproximatelythesamemagnitude(forexample,ifh=5andk=70,weshouldadjust k by dividing its value by 10). Besides, h must not be less than 1;otherwise,squaringitwillnotincreasebutdecreasethefinalresult(seeformula2.5.1).Letusdemonstratethepracticalapplicationofthismethod.Inthehypothetical

example presented in Figure 2.5.3, the left area consists of 185 nodes; theobjectivefunctionvalueofthenodewiththehighestaltitudemarkis0.47(thatis,k=185,h=0.47).Fortherightareak=266andh=0.40.Toreducekandhto thesamescale,wedividekby100andmultiplyhby10 (to satisfyh>1).Using formula 2.5.1, we get

Theconventionalareaoftheleftoptimalareaissmallerthanthatoftherightone.Thismeans that despite the fact that the left area is higher, the right oneshouldbepreferred.Therefore,inthiscasetheadvantagesofthewiderandmoresloping surface of the right area (that is, the advantage of robustness)outweighedtheadvantageofthehigherobjectivefunctionvalueoftheleftarea.Nowweturnourattentiontotheexamplebasedontherealmarketdata.The

rightchartofFigure2.5.2containsthreeareaswithaltitudemarkshigherthan10

Page 141: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

(remember that this optimization space represents transformation of the initialspaceobtainedbyconvolutionofthreeutilityfunctions).Wedenotetheseareasas«left»,«middle»and«right»ones.Allthreeareashavesimilarbaseareas(kleft=10,kmiddle=13,kright=14)andheights(hleft=14.09,hmiddle=13.45,hright=11.91),whichturnstheselectionofoneofthemintoadifficult task.However,by applying the method based on the surface geometry, we can make anobjective choice. Since values of k and h are scaled similarly and h > 1, noadjustments are required.Substitutingvalues into formula2.5.1,wegetSleft =79.6, Smiddle = 86.9, Sright = 80.2. On the basis of these conventional areaestimations,weconcludethatthemiddleareaispreferable.Thisdecisionisnottrivial since themiddle area has neither the biggest base area nor the highestaltitudemark.Thisexampledemonstratescombinedapplicationoftwomethods.First, the optimization space was transformed by calculating the ratio of themeantothestandarderror,andthentheselectionofoptimalareawasperformedonthebasisofsurfacegeometry.

2.6.SteadinessofOptimizationSpaceIntheprecedingsectionwecomparedoptimalareasoftheoptimizationspace

onthebasisof theirrobustness.Wedefinedrobustnessasthesensitivityoftheobjective function to small changes in values of the parameters underoptimization. The desired property of the optimal solution is high robustness(thatis,nonsensitivitytoparameterchanges).Itisimportanttoemphasizethatinthiscontextwetalkabouttherobustnessrelativetooptimizedparameters.In this section we will discuss another aspect of robustness: the extent of

optimization space sensitivity to fixed (that is, non-optimized) parameters.Duringoptimizationbasedonalgorithmiccalculationof theobjective functionvalue,amultitudeofcombinationsofoptimizedparametervaluesareanalyzed.Still, many other parameters are kept unchanged (we call them “fixedparameters”). Their values may be selected at earlier stages of strategydevelopment (using the scientific approach), or they may be defined by thestrategyidea.Therobustnessoftheoptimizationspacerelativetosmallchangesin values of the fixed parameters and to inessential alterations of the strategystructureisanimportantindicatorofoptimizationreliability.Whenreferringtothe sensitivity of the optimization space to any changes other than changes inoptimizedparameters(whicharemeasuredbyrobustness),wewillusetheterm“steadiness.”Thefollowingreasoningwouldexplainthis idea.Duringoptimizationof the

Page 142: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

basicdelta-neutralstrategy,wehaveobtainedacertainoptimizationsurface(seeFigure 2.2.2). In this specific case only two parameters have been optimized,while values of all others were fixed. In particular, the “criterion threshold”parameterwasfixedat1%(positionsopenedonlyforoptioncombinationswithexpectedprofitexceeding1%).Supposethatwedecidedtoincreasethevalueofthisparameterto2%.Assumefurtherthatthischangeledtoatransformationofthe original optimization surface (and now its appearance is similar to thatshowninFigure2.5.2).Ifsuchasmallchangeofthefixedparameterledtosuchasignificantsurfacechange,wewouldconcludethatthissurfaceisunsteady,theoptimizationisunreliable,andhenceitisveryriskytotrustitsresults.

2.6.1.SteadinessRelativetoFixedParametersInthissectionweanalyzethesteadinessoftheoptimizationspaceofthebasicdelta-neutralstrategyrelativetothe fixed “criterion threshold” parameter. Figure 2.2.2 shows the surfaceobtained using the profit-based objective function provided that the criterionthresholdisfixedat1%.Wewillincreasethevalueofthisparameterto3%andtesttheconsequencesofthischangeontheshapeoftheoptimizationsurface.Beforethefixedparameterwaschanged,theglobalmaximumhadcoordinates

of 30 by the “number of days to expiration” parameter (horizontal axis of thechart) and105by the “HVestimationperiod”parameter (vertical axis).Whenweincreasedthevalueofthefixedparameter,theglobalmaximumshiftedtothenodewith coordinates of 16 and 120, correspondingly. Themagnitude of thisshiftcannotberegardedassignificant(thoughitisnotnegligibleeither).The original optimization space had a single optimal area along the 30th

verticalintherangeof80to125daysbythe“HVestimationperiod”parameter(see Figure 2.2.2). The left chart of Figure 2.6.1 demonstrates the newoptimization space resulting from the fixed parameter change. The formeroptimalarearemainedalmostatthesameplace(shifteddownabit)andslightlyincreasedinsize.Atthesametime,fournewoptimalareasemergedtotheleftoftheoriginalone;twoofthemareverysmallandanothertwoarecomparabletothe previous one in size. It is important to note that although the number ofoptimalareasincreased(fiveinsteadofone),allofthemaresituatedaroundthebottom-leftpartoftheoptimizationspace(12to36daysbythe“numberofdaysto expiration” parameter and 40 to 180 days by the “HV estimation period”parameter).

Page 143: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure2.6.1.Thechangeoftheoptimizationspaceofthebasicdelta-neutralstrategy(theoriginalspaceisshowninFigure2.2.2)inducedbythechangeinvalueofthe“criterionthreshold”parameter(leftchart)andby

prohibitionoflongpositions(rightchart).

We can conclude from these data that the change in the value of this fixedparameterdidnotchangetheshapeoftheoptimizationspacefundamentally.Ittestifies to the relative steadiness of the optimization space. Although thechanges that have taken place may seem to be quite significant, it should betakenintoaccountthatthechangeinthevalueofthefixedparameter(from1%to3%)wasalsosubstantial.Weusedthisbigchangeonpurposetomakeacleardemonstration of the change in the optimization space. When testing thesteadiness of the automated strategy intended for real trading, it would besufficienttoapplymuchsmallerchangesinvaluesoffixedparameters.

2.6.2. Steadiness Relative to Structural Changes The concept of structuralsteadinessisverybroad.Thestrategystructureincludesvariousaspectsfromthebasic idea to relatively insignificant technical elements. The change of somestructural elementsmay change the shapeof optimization space radically.Thedeveloperofthetradingstrategyshouldstrivetoobtaintheoptimizationspace,whichisrelativelysteadytosmallchangesinthestrategystructure.Thepointisthatanysignificantchangeturnsthestrategyunderoptimizationintoanentirelydifferent strategy that may require an application of a completely differentapproachtooptimization.

Page 144: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Small structural changes may include slight altering of a capital allocationmethodorapplicationofanalternativeriskmanagementinstrument.Withregardto the delta-neutral strategy, the change in themethod used to calculate indexdeltamay be considered as a structural change. On the one hand, changes intheseandsimilarstructuralelementsdonotchangethenatureofthestrategy.Onthe other hand, it is highly desirable that the optimization space woulddemonstrate steadiness to changes of such kind.Undeniably, if the scheme ofcapital allocation among portfolio elements changes, but the shape ofcorresponding optimization space does not change significantly, suchoptimizationcanbe regardedas steadyand reliable.Oneshouldalsonote thatthesameoptimizationspacecanbesteadytosomestructuralchangesandhavealowsteadinesstoothers.Letusconsideranexampleofanotherstructuralchange—limitationsoflong

positions.Initsextremeform(completeprohibitiontoopenlongpositions)suchachangeisratherconsiderableandmayevencompletelychangethenatureofatradingstrategy.However, thisrestrictionmustnotbeabsolute.Forexample,a“soft”limitationmaybeappliedthatrestricts theshareoflongpositionsintheportfolio to the predetermined threshold level. To make the change of theoptimizationspacemorespectacularandobservable,weuseinourexamplethefull prohibition of long positions opening (although in practice such a strictsteadinesstestwouldhardlymakeanysense).TherightchartofFigure2.6.1shows thatevensuchasignificantchangeof

the strategy structure as completeprohibitionof longpositionsdidnot changetheoptimizationsurfaceshapefundamentally.Theglobalmaximumshiftedfromthe node with coordinates of 30 and 105 (at horizontal and vertical axes,respectively) to the node with coordinates of 30 and 70. This means that theoptimal value of one parameter did not change at all and the optimum of thesecondparameterdecreasedbyathird.The surface of the original optimal area increased significantly. Besides,

severalnewoptimalareasemerged(alloptimalareasaregroupedinonepartoftheoptimizationspace,aroundtheoriginaloptimalarea).Thesechangescanbeexplainedbythefactthatduringthepast10years(theperiodofoptimization),despitetherecentfinancialcrisis,marketsweregrowingatmoderaterateswithlow volatility prevailing during most periods. In such circumstances, shortoption positions were more profitable than the long ones. Consequently, fullprohibitionoflongpositionsledtoahigherquantityofparametercombinationsthat turned out to be more profitable (in other words, the optimization spacecontainsmorenodeswithrelativelyhighvaluesofobjectivefunctions).

Page 145: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Considering the fact thatcompleteprohibitionof longpositions representsaverysignificantstructuralchange(onthevergeoffundamentalstrategychange),weshouldconcludethatthesteadinessoftheoptimizationspaceinthisexampleisratherhigh.

2.6.3. Steadiness Relative to the Optimization Period Algorithmiccomputationoftheobjectivefunctionintheprocessofparametricoptimizationisbasedonhistoricaldata.Thedecisiononthelengthofhistoricalperiod(alsocalled “historical optimization horizon”) may affect optimization resultssignificantly.Unfortunately, therearenoobjectivecriteria toselect thespanofhistoricaldata.Optimizationshouldbebasedondataincludingbothunfavorableand favorable periods for the strategy under development. Sticking to thisconcept,someautomatedtradingsystemdeveloperssuggestusingthedatabasecomposed of separate historical frames instead of basing optimization on thecontinuoustimeseries.Thisapproachseemstobeunacceptablesincethechoiceof“appropriate”segmentsofhistoricaldatacanhardlybeobjective.In our opinion, the continuous price series should be used for parametric

optimization.Thedecisionon the length of this series shouldbe basedon thepeculiaritiesof the specific trading strategy.The less theoptimization space issensitive to small alterations in optimization period length, the higher thesteadinessofthestrategy.Itisdesirablethattheoptimizationspacepreservesitsoriginalformevenundersignificantchangesinthehistoricalperiodlength.Thesituationcanbejudgedasidealwhentheresultsoftheoptimizationperformedata2-yearperiodareclosetotheresultsobtainedata3-yearperiodorwhentheresultsof6-yearand10-yearoptimizationsdonotdiffersignificantly.To illustrate the idea of optimization space steadiness to changes in

optimization period,wewill perform the sensitivity test using the basic delta-neutralstrategyandtheprofit-basedobjectivefunction.Inordertodeterminetheextent of the steadiness of this space relative to the length of the historicalperiod, we will perform a successive series of optimizations using historicalperiods of different lengths.All optimizations discussed earlier in this chapterwerebasedon a10-yearhistorical period.Nowwewill analyzeoptimizationsperformedon9,8,...,1yearsofpricehistory.Tomake optimization results comparable (and to enable the creation of the

convolutionofseveraloptimizations), thevaluesofobjectivefunctionsineachcaseshouldbeofapproximatelythesamescale.Itcanbereachedbyapplyingthe transformation described in the section dedicated to multicriteria analysis(seeequation2.4.1).

Page 146: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Comparison of ten optimization spaces (see Figure 2.6.2; to simplifyperceptionof thecharts,onlyoptimalareasareshown)reveals thepresenceoftwooptimalareasinalmostallsurfaces.Oneofthemissituatedwithin28to32daysbythe“numberofdaystooptionsexpiration”parameterand85to140daysby the “HV estimation period” parameter. (We will refer to this area as “theleft.”) The second optimal area has coordinates of 108 to 112 by the firstparameterand90to160bythesecondone.(Thisareawillbereferredtoas“theright.”)

Page 147: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems
Page 148: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure2.6.2.Variabilityoftheoptimizationspaceofthebasicdelta-neutralstrategy(onlyoptimalareasareshown)inducedbythechangeinthelengthofthehistoricalperiodsusedforstrategyoptimization.Each

chartcorrespondstooneofthehistoricalperiods.Thebottom-middleandbottom-rightchartsshowminimaxandadditiveconvolutionoften

optimizationsurfaces.

The left area is present on all surfaces except those corresponding tooptimizations performed using two-and three-year time series. The area of itssurface is rather stable (it changes just slightly from case to case). The onlyexception is theoptimizationbasedonone-yeardata. In this case the left areaoccupies a bigger space and in fact represents three separate areas groupedaroundthesamelocation.The right area is alsopresent on all surfaces, excluding theonly casewhen

optimization was performed using a ten-year historical period. In two morecases,thisareaturnedouttobeslightlyshiftedtowardhighervaluesofthe“HVestimationperiod”parameter.Thesizeoftherightareaismorevariablethanthatoftheleftarea.Therightareaofoptimizationsbasedonone-,two-,three-,four-,and five-yeardata isof a rather large size. In contrast to that, onoptimizationsurfacesobtainedatlongerperiodsithasasmallersize.Besides,inallcasestheright areadoesnot forma singlewholebut is ratherdivided into several sub-areas.The extent of optimization space steadiness can be estimated by different

methods.The simplest of them consists in visual analysis. The comparison ofdifferent charts inFigure2.6.2 suggests that this optimization is rather steady.This conclusion follows from the above-described persistent disposition ofoptimal areaswithin the optimization space.More sophisticated approaches toestimating the steadiness should express numerically the sensitivity ofoptimizationspace(forexample,bycalculatingthevariabilityofcoordinatesofnodesconstitutingtheoptimalareas).Whensteadinessisestimatedbycomparingthelargenumberofoptimization

spaces(asitisinourexample),theconvolutionmethodcanbeusedtofacilitatethe comparison. If spaces differ from one another considerably (that is,optimizationisunsteady),theirconvolutionwillhaveanappearanceofasurfacewitha largenumberofoptimalareas scatteredover it irregularly.At the sametime,ifoptimizationspacesaresimilar,withoptimalareashavingapproximatelythe same form and situated at the more or less same locations (indicatingsteadinessofoptimization),theconvolutionwillhavealimitednumberofeasily

Page 149: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

distinguishable optimal areas. The bottom-middle and bottom-right charts ofFigure 2.6.2 show additive and minimax convolutions of ten optimizationsurfaces (both convolutions produce in this case almost identical results). Theleft and the right optimal areas are localized clearly and can be distinguishedeasily. This confirms once again our conclusion about optimization steadinessrelativetothechangeofthehistoricalperiodusedforstrategyoptimization.

2.7.OptimizationMethodsHitherto, we used the most informative optimization method—exhaustive

search through all possible combinations of parameter values. This methodrequires estimating the values of objective function(s) in all nodes of theoptimizationspace.Sincethecomputationoftheobjectivefunctionineachnoderequiresanexecutionofcomplexmultistepprocedures,themaindrawbackofanexhaustive search is the long time required to complete the full optimizationcycle.Asthenumberofparametersincreases,thenumberofcomputationsandthe time increaseaccording to thepower law.Theexpansionof theacceptablevalue range and reduction of the optimization step also increase the timerequiredforanexhaustivesearch.In all examples considered up to this point, only two parameters were

optimizedand60valuesweretestedforeachofthem.Accordingly,optimizationspaceconsistedof3,600nodes.Onaverage,onecomputation(calculationofoneobjective function in one node) took about one minute (using the system ofparallel calculations running on several modern PCs). This means thatconstructionoffulloptimizationspacesimilar to thoseconsideredearlier takesabout60hours.Furthermore,addingjustoneextraparametertotheoptimizationsystem(threeintotal)increasescalculationtimedramatically,uptofivemonths!Obviously, this is unacceptable for efficient creation and modification ofautomated trading strategies. This implies that an exhaustive search is not themostefficient(andinmostcasesnotsuitableatall)methodtosearchforoptimalsolutions.Inmost cases, itwouldbemore reasonable to apply special techniques that

avoid an exhaustive search through all the nodesof theoptimization space.Awholegroupofmethods—fromthesimplesttothemostcomplexones—canbeusedtomaximize(ortoapproachthemaximum)theobjectivefunctionviadirect(as opposed to the exhaustive) search. This area of applied mathematics hasrecentlyachievedconsiderablesuccessandcontinuestodeveloprapidly.Inthisreview, we will not touch on the two most popular optimization methods—genetic algorithms and neuronets. Firstly, these methods are so complex that

Page 150: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

eachofthemwouldrequireaseparatebook(thenumberofpublicationsonthistopic grows from year to year). Secondly, most challenges of parametricoptimizationwithalimitednumberofparameterscanbesolvedatalowercost.Inthissection,weconsiderfiveoptimizationmethodsthatwereselectedonthebasis of their effectiveness (considering the specific problems encountered inoptimization of options trading systems) and simplicity of practicalimplementation.Optimization methods that do not require an exhaustive search have two

significant drawbacks. They reach maximal efficiency only when theoptimization space isunimodal (that is, contains a singleglobalmaximum). Ifthereareseveral localextremes (whenoptimizationspace ispolymodal), thesemethods may get to a sub-optimal solution (that is, select the local extremeinstead of the global maximum). Figuratively speaking, this situation may becomparedwithclimbingahillinsteadofcapturingamountainpeaknearby.Thisisageneraldrawbackofallmethodsthatarebasedontheprincipleofgraduallyimprovingthevalueofobjectivefunctionbymovingaroundthenodeselectedatthepreviousstepoftheoptimizationalgorithm.Thisisanunavoidabledrawbackinherent in all optimization methods that rely on direct search. As we notedearlier, finding the globalmaximum can be guaranteed only by an exhaustivesearchthroughalltheoptimizationspacenodes.There is a simple, although time-consuming, way to solve this problem. If

therearereasonstobelievethat theoptimizationspacecontainsmorethanjustone extreme, optimization should be run repeatedly with different startingconditions(thatis,eachtimeitbeginsfromadifferentnode).Startingnodesmaybe allocated evenly within the optimization space, or they may be selectedrandomly. Although reaching the global maximum is still not guaranteed, theprobabilityoffindingitcanbebroughtuptoanacceptablelevel.Certainly,themorestartingpointsthatareemployed,thehighertheprobabilityisthatatleastoneofthemwillleadtothehighestextreme(however,timecostsalsoincreaserapidly). The broader the optimization space is, the more starting points areneeded.The second drawback is that the solution selected by applying one of the

directsearchmethodsdoesnotcontaintheinformationaboutobjectivefunctionvaluesinnodesadjacenttothenodeoftheoptimalsolution.Consequently, thedeveloperisunabletodeterminethepropertiesoftheoptimalareasurroundingtheextremethathasbeenfound.Hence, therobustnessof theoptimalsolutioncannotbeestimated.Aswerepeatedlyoutlinedearlier,robustnessisoneofthemain properties that defines optimization reliability. Inability to assess the

Page 151: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

robustness may challenge the validity of optimal solution. However, thisproblem can be solved by calculating objective function values in all nodessurrounding the optimal solution. After that the robustness can be estimatedusingthemethodsdescribedinsection2.5.

2.7.1. A Review of the Key Direct Search Methods Alternating-Variable AscentMethod

Theessenceofthealternating-variableascentmethod(theword“descent”isusuallyusedinthenameofthismethod,but,asnotedearlier,itispreferabletosolve theproblemofprofitmaximization inoptimizationof trading strategies)consists inasuccessivesearchbyeachparameterwhen theyare taken in turn.Thealgorithmofthismethodisthefollowing:

1.Selectthestartingnodefromwhichtheoptimizationprocessbegins(the selection of the starting point is required for initiation of anydirect searchmethod).Theselectionmaybe random,deliberate (thatis,basedonpriorknowledgeofthedeveloper),orpredetermined(forexample,ifmanyiterativeoptimizationsareanticipated,startingnodesmaybedistributedintheoptimizationspaceevenly).2. Since the parameters are optimized successively rather thansimultaneously, the order should be determined. In most cases theorder is not of big importance. However, if one parameter is moreimportantthantheothers,theoptimizationshouldstartwithit.3.Beginningfromthestartingpoint,thebestsolutionisfoundforthefirstparameter(valuesofallotherparametersarefixedatthestartingnode values). The search is performed using any one-dimensionaloptimization method. If the number of nodes to be calculated isrelativelylow,wecanevenusetheexhaustivesearchmethod.4. When the best solution for the first parameter is found, thealgorithm passes on to the optimization of the next parameter. Theone-dimensional optimization is performed once again; values of allotherparameters are fixed at valuesof thenode that hasbeen foundduringoptimizationofthefirstparameter.5. When one optimization cycle (successive one-dimensionaloptimization of all parameters) is completed, the procedure isreiteratedstartingfromthelastnode.Theprocessstopswhenthenextoptimization cycle does not find the solution that prevails over thesolutionfoundduringtheprecedingcycle.

Wewilldemonstratethepracticalapplicationofthisalgorithmbyconsidering

Page 152: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

an example of optimization of basic delta-neutral strategy. The optimizationspaceofthisstrategyobtainedusingtheprofit-basedobjectivefunctionisshownin Figure 2.2.2. To present the search procedure visually, we will limit thepermissible ranges of parameter values to 2 to 80 for the “number of days tooptions expiration” parameter and 100 to 300 for the “HV estimation period”parameter.Thealgorithmisexecutedinthefollowingway:

1. The starting point is selected. Suppose that the node withcoordinatesof60and130wasselectedrandomly.Thisnodeismarkedwithnumber1inFigure2.7.1.

Figure2.7.1.Graphicalrepresentationofoptimizationperformedusingthealternating-variableascentmethod.

2.Withthe“numberofdaystooptionsexpiration”parameterfixedat60, we compute the objective function for all values of the “HVestimationperiod”parameter (one-dimensionaloptimizationusinganexhaustivesearch).3.Thenodewith themaximumobjective functionvalue is found. Inthiscaseitisthenodewithcoordinatesof60and250(pointnumber2inFigure2.7.1).4.Thevalueofthe“HVestimationperiod”parameterisfixedat250,and the objective function for all values of the “number of days tooptionsexpiration”parameter iscalculated.Theobjective function ismaximalatthenodewithcoordinatesof40and250(thirdpoint).

Page 153: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

5. The number of days to options expiration is fixed at 40 and theobjective function for all values of the HV estimation period iscalculated.Inthiswaywegettothenextnodewithcoordinatesof40and170(fourthpoint).6.TheHVestimationperiodisfixedat170andtheobjectivefunctionfor all days to options expiration is calculated. The fifth point withcoordinatesof30and170is,thereby,obtained.7.Thenumberof days to expiration is fixed at 30 and theobjectivefunction is calculated for allHV estimation periods. The sixth pointhascoordinatesof30and105.8.TheHVestimationperiodisfixedat105andtheobjectivefunctionis calculated for all days to options expiration. It turns out that theobjective function does not improve any further and, hence, thealgorithm stops. The last node (number 6) represents the optimalsolution.

Thealternating-variableascentmethod,despitebeingsimple in its logicandeasy to implement, is not very efficient. Imagine the situation when two-dimensionaloptimization surfacehas theoptimalarea in the formofanarrowridge stretching from “northwest” to “southeast.” If the height of the ridgeincreasestowardeitherthesoutheastorthenorthwest,thisalgorithmwillclimbtothecrestoftheridgeanditwouldbeimpossibletoimprovethispositionsincetwoparametersmustbeamendedsimultaneouslyforthat.Thisrestrictsheavilytheapplicabilityofthealternating-variableascentmethod.Hook-JeevesMethod

The Hook-Jeeves method was developed to avoid situations in which thealternating-variable ascent method stops prematurely without finding thesatisfactory optimal solution. It consists in consecutive execution of twoprocedures—exploratorysearchandpattern-matchingsearchreiterateduntiltheunimprovableoptimumisfound.Ascomparedtothealternating-variableascentalgorithm, the Hook-Jeeves method significantly lowers the possibility of thealgorithm stopping without finding the extreme. The sequence of actions forimplementingtheHook-Jeevesmethodisasfollows:

1.Selectthestartingnode.Beginningfromthisnode,theexploratorysearchprocedureisperformed.Thisprocedureconsistsinexecutionofseveralcyclesofthealternating-variableascentmethod.Onecycleofexploratorysearchconsistsofncyclesofalternating-variablesearch(nisthenumberofparameters).Fortwo-dimensionaloptimizationspace,

Page 154: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

therearetwocyclesofalternating-variableascentthatresultinfindingsub-optimalnodesinadditiontothestartingnode.2. Execute the pattern search procedure. For this, determine thedirection from the starting node to the node found as a result of thefirst cycle of exploratory search.Thevalueof theobjective functionincreases in thisdirection,and itwouldbereasonable toassume thatmovingfartherinthisdirectionwillbringaboutfurtherimprovement.3. Continue the search in the direction determined in the precedingstage.Incontrasttothealternating-variableascentmethod,thissearchis performed under the simultaneous changes in all parameters.Whereas in the alternating-variable ascent method the search isallowed only in the horizontal or the vertical directions (in the two-dimensionalcase), thepattern-matchingsearchallowsmoving inanydirectionwithintheoptimizationspace.4. Having found the best node in this direction, the cycle of theexploratory search is repeated, after which the pattern search isexecuted again. These altering cycles continue until the node thatcannotbeimprovedanyfurtherisfound.

LetusconsidertheapplicationoftheHook-Jeevesmethodusingbasicdelta-neutralstrategyasanexample(optimizationisperformedbyapplyingtheprofit-basedobjectivefunction).Similartothepreviousexample,theacceptablevaluesofparameterswillbelimitedtothesameranges(2to80for“numberofdaystooptionsexpiration”and100to300for“HVestimationperiod”).Thealgorithmisexecutedinthefollowingway:

1.Thestartingpointisselectedrandomly.Supposethatthisisthenodewith coordinates of 68 and 300 (marked with number 1 in Figure2.7.2).

Page 155: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure2.7.2.GraphicalrepresentationofoptimizationperformedusingtheHook-Jeevesmethod.

2.Theprocedureofexploratorysearchconsistsoftwocycles(equaltothe number of parameters) of alternating-variable ascent method.Havingthe“numberofdaystooptionsexpiration”parameterfixedat68, the objective function is calculated for all values of the “HVestimation period” parameter. The maximum value of the objectivefunction falls at the node with coordinates 30 and 225 (the secondpointinFigure2.7.2).3. The value of “HV estimation period” is fixed at 225, and theobjectivefunctioniscalculatedforallvaluesofthe“numberofdaystooptions expiration” parameter. The maximum function valuecorresponds to the node with coordinates of 36 and 225 (the thirdpoint).4.Thepattern-searchprocedure isperformed.Thedirectionfromthestarting node to the third node is determined (the arrow in Figure2.7.2), and a one-dimensional optimization procedure is executed inthisdirection.Thevaluesoftheobjectivefunctionarecalculatedatallnodescrossedbythelinedrawninthegivendirection.5. The nodewith themaximum objective function value (the fourthpointwith coordinates of 30 and 210) is selected. Starting from thisnode,theexploratorysearchcycleisrepeated.

Page 156: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

6.The“numberofdaystooptionsexpiration”parameterisfixedat30,and the objective function is calculated for all values of the “HVestimationperiod”parameter.Themaximumfunctionvaluefallsatthenodewithcoordinatesof30and105(thefifthpoint).7. The “HV estimation period” is fixed at 105, and the objectivefunctioniscalculatedforalldaystooptionsexpiration.Sincethereisnofurtherimprovementfortheobjectivefunction,thealgorithmstops.Thenodenumber5isselectedastheoptimalsolution.

RosenbrockMethod

TheRosenbrockmethod,alsocalled“themethodofrotatingcoordinates,”isastepfurtherintheelaborationofthealternating-variableascentmethod.ThefirststageoftheRosenbrockalgorithmcoincideswiththealternating-variableascentmethod. Then, similar to the Hook-Jeeves method, we find the direction inwhich theobjective function improves.However,apart from thisdirection,wecreate(n-1)moredirections,eachofwhichisorthogonaltothefounddirectionand all of which are orthogonal to each other. Thus, instead of the originalcoordinate system, defined by the parameters, a new coordinate system isestablished.Relativetotheinitialcoordinatesystem,itisrotatedsothatoneofitsaxescoincideswiththedirectioninwhichtheobjectivefunctionimproves.Inthe new coordinate system, we perform the next alternating-variable ascentcycle,theresultofwhichisusedfordeterminingthenewimprovementdirectionfollowedby thenew rotationof the coordinate system.For a two-dimensionaloptimizationspacetheRosenbrockalgorithmcanbepresentedinthefollowingway:

1.Selectthestartingnodewherethecycleofexploratorysearch(thatis,twocyclesofalternating-variableascentsearch)begins.2.Determinethedirectionfromthestartingnodetothenodefoundatthestageofexploratorysearch,andperformtheprocedureofpattern-matchingsearchinthisdirection.3.Havingfoundthebestnodeoutofthosesituatedonthelinedrawninthisdirection,buildthenewdirectionorthogonaltotheoriginalone.4.Usingthealternating-variableascentmethod,performthesearchintheorthogonaldirectionand find thenodewith thehighestobjectivefunctionvalue.5. Repeat all procedures beginning from the node found in theorthogonaldirection.

Page 157: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Nextwe illustrate theapplicationof theRosenbrockmethod tooptimizationofthebasicdelta-neutralstrategy.Theobjectivefunctionandthelimitsimposedonacceptablerangesofparametervaluesarethesameasinpreviousexamples.Thealgorithmisexecutedinthefollowingway:

1. Select the starting point randomly. Suppose that the node withcoordinates of 72 and 180 was chosen (point number 1 in Figure2.7.3).

Figure2.7.3.GraphicalrepresentationofoptimizationperformedusingtheRosenbrockmethod.

2. Begin the exploratory search procedure, which consists of twocycles of the alternating-variable ascent. The “number of days tooptionsexpiration”parameterisfixedat72andtheobjectivefunctionis calculated for all values of the “HVestimationperiod”parameter.Thenodewiththemaximumobjectivefunctionvaluehascoordinatesof72and240(pointnumber2inFigure2.7.3).3.Havingfixedthevalueofthe“HVestimationperiod”parameterat240,theobjectivefunctioniscalculatedforallvaluesofthe“numberof days to options expiration” parameter. The maximum of thefunction falls at the node with coordinates of 36 and 240 (pointnumber3).4. The pattern-search procedure is executed. The direction from thestarting node to the third node is determined (the top-right arrow in

Page 158: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure2.7.3),andvaluesoftheobjectivefunctionarecalculatedforallnodescrossedbythisdirection.5. The node with the maximum objective function value is found(point number 4 with coordinates of 40 and 230), and the directionorthogonaltotheonefoundearlierisestablished.6.Thesearchinthenew(orthogonal)directionisperformedusingthealternating-variable ascent method, and the node with the highestobjectivefunctionvalue(pointnumber5withcoordinates34and215)isselected.7. Starting from this node, the exploratory search cycle is repeated.The “number of days to options expiration” parameter is fixed at avalue of 34, and the objective function for all values of the “HVestimation period” parameter is calculated. The maximum functionvalue turnsout tobeat thenodewithcoordinates34and140 (pointnumber6).8. The “HV estimation period” is fixed at 140 and the objectivefunctioniscalculatedforalldaystooptionsexpiration.Thefunction’smaximumfallsatthenodewithcoordinates30and140(pointnumber7).9. The pattern-search procedure is repeated. The direction from thefifthpointtotheseventhpointisestablished(thebottom-leftarrowinFigure2.7.3)andthevaluesoftheobjectivefunctionarecalculatedatallnodescrossedbythisdirection.Itturnsoutthattherearenonodesin thisdirectionforwhichtheobjectivefunctionvaluewouldexceedthevaluepossessedbytheseventhnode.

10. The direction orthogonal to the one shown by the left arrow isestablished (not shownon theFigure), and the search is performed alongthisdirection.Itturnsoutthatthereisalsononodeforwhichtheobjectivefunctionvaluewouldexceedtheseventhnode’svalue.11.Thecycleofexploratorysearchisrepeated.Thevalueofthe“numberof days to options expiration” parameter is fixed at 30, and the objectivefunction is calculated for all values of the “HV estimation period”parameter.The function’smaximum falls at thenodewith coordinates30and105(pointnumber8).12.As this has already been demonstrated in the previous examples (theHook-Jeevesmethod),nofurtherimprovementispossibleatthispoint,andhence, the algorithm stops. The eighth node is selected as the optimal

Page 159: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

solution.The Rosenbrock method is a refinement of the alternating-variable ascent

methodandtheHook-Jeevesmethod.Insomecasesitcansignificantlyimprovethe search effectiveness, though it is not always the case. Under certaincircumstances, depending on the shape and the structure of the optimizationspace,thesearcheffectivenessmayevendecreaseduetotheapplicationofthismethod.Nelder-MeadMethod

The Nelder-Mead method (also called the deformable polyhedron method,simplex search, or amoeba search method) has two modifications: originalvariant(basedonrectilinearsimplex)andadvancedmodification(whichutilizesdeformablesimplex).Inthissectionwewilldiscusstheadvancedmodification.Using the term “simplex” may be misleading to some extent since there is awidely known simplexmethod of linear programming developed to solve theproblemofoptimizationwithlinearobjectivefunctionandlinearconstraintsthathas nothing to dowith the describedmethod. In theNelder-Meadmethod thesimplexrepresents thepolyhedroninn-dimensionalspacewithn+1vertices. Itcanbeconsideredasageneralizationofatriangleinthemultidimensionalspace.Thetriangleisanexampleofthesimplexintwo-dimensionalspace.Figuratively speaking, during optimization the simplex rolls over the

parameters space, gradually approaching the extreme. Having calculated theobjective function values in the vertices of the simplex, we find theworst ofthemandmovethesimplexsothatallotherverticesstayattheirplacesandthevertexwiththeworstvalueissubstitutedwiththevertexthatissymmetricaltotheworstonerelativetothesimplexcenter.Thiscanbeimaginedvisuallyinthetwo-dimensionalcasewhenthesimplex(representedbythetriangle)rollsoveritssidethatisoppositetotheworstapex.Byrepeatingsuchcycles,thesimplexapproachestheextremeuntiltheobjectivefunctionisnolongerimproved.Thebest of the obtained apexes is accepted as the optimal solution. When thesimplexisintheimmediatevicinityoftheextreme,sothatthedistancefromitscenter to the extreme is less than the simplex side, it loses the capability toapproachtheextremeanycloser.Inthiscasewecandecreasethesimplexsize,whilemaintainingitsinitialshapeandcontinueoursearchbyrepeatingthesizedecreaseeachtimewhenwelosethecapabilitytogetclosertotheextreme,untilthesidelengthbecomessmallerthantheoptimizationstep.Besides rolling over the optimization space, the deformable simplex may

change its shape (whichexplainsanother term—“amoebamethod”).While the

Page 160: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

methodof rectilinear simplexhasnootherparametersexcept the lengthof thesimplex edge, the deformable simplex method involves the system of fourparameters: reflection coefficient α, expansion coefficient σ, contractioncoefficient γ, reduction coefficient ρ. As experience has shown, the choice ofcoefficientvaluesmaybecriticalforobtainingsatisfactoryoptimizationresults.ThealgorithmoftheNelder-Meadmethodconsistsofthefollowingsteps:

1. Select n+1 points of the initial simplex x1, x2... xn+1. In the two-dimensional case, when the simplex represents the triangle, it issufficientthatthreepointsarenotlocatedonthesamestraightline.2. Range points by the objective function values (given that thefunctionhastobemaximized):

f(x1)≥f(x2)≥f(x3)≥...≥f(xn+1)3.Calculatepointx0,whichisthecenterofthefigurewhoseverticescoincidewithsimplexvertices,excepttheworstonexn+1:

For two-dimensional optimizationx0 is located in themiddleof thesegmentconnecting thebestand intermediatevertices (asestimatedbythevaluesoftheobjectivefunction)ofthetriangle.

4.Reflectionstep.Calculatethereflectedpoint:xr=x0+α(x0–xn+1).

If the objective function value at the reflected point is betterthanatthesecond-worstpointxn,butisnotbetterthanatthebestpoint x1, then the reflected point substitutes in the simplex theexcludedworstpointandthealgorithmreturnstostep2(simplexrolls over from the worst point toward the point with a higherobjective function value). If the objective function value at thereflected point is better than at all initial points, the algorithmmovestostep5.

5. Expansion step.Calculate the expansion point. It is located alongthe line passing through the worst simplex point and the simplexcenter.Itspositionisdeterminedbytheexpansioncoefficient:

xe=x0+σ(x0–xn+1).

Theessenceofthisoperationisthefollowing:If thedirectionin which the objective function increases is established, the

Page 161: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

simplex should be expanded in this direction. If the expansionpointisbetterthanthereflectionpoint,thelatterissubstitutedinthe simplex by this expansion point and the simplex becomesexpandedinthisdirection.Afterthatthealgorithmreturnstostep2. If the expansion point is not better than the reflected point,there is no sense in expansion, the reflected point is left in thesimplexanditsshapedoesnotchange.Thealgorithmalsoreturnstostep2.

6. Contraction step. The algorithm gets to this step if the reflectedpointisnotbetterthanatleastthesecond-worstpoint.Thecontractionpointiscalculatedas

xc=x0+ρ(x0–xn+1).If the contraction point is better than the worst point, the

algorithm substitutes the former for the latter and passes on tostep2.Asa result, thesimplexcontracts in thisdirection. If theobtainedpointisworsethantheworstpoint,itmaytestifytothefactthatwearealreadyintheimmediatevicinityoftheextreme,andtofinditthesimplexsizehastobedecreased.Thealgorithmproceedstostep7.

7. Reduction step. The point with the best objective function valuekeepsitsposition,whileallotherpointsarepulleduptowardit.

xi=x0+γ(xi–x1),∀i∊{2,...n+1}.Ifthesimplexsize(consideringitsirregularshape,weneedto

defineitspecially,forexample,astheaveragedistancefromthecentertoallvertices)turnsouttobelessthanthespecifiedvalue,thealgorithmstops.Otherwise,itgoestostep2.

Let us consider the practical application of the Nelder-Mead method foroptimizationof thebasicdelta-neutral strategy.Theobjective function and thelimits imposed on acceptable ranges of parameter values are the same as inpreviousexamples.Thealgorithmisexecutedinthefollowingway:

1. Select three points of the initial simplex.Assume that nodeswithcoordinates 12 and 105, 18 and 110, 18 and 100 are selected assimplexvertexes.2.Calculatethevaluesoftheobjectivefunctionforthethreepointsofthe initial simplex and find the node with the worst function value.Thisnodeismarkedwithnumber1inFigure2.7.4.

Page 162: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure2.7.4.GraphicalrepresentationofoptimizationperformedusingtheNelder-Meadmethod.

3.Calculatethecenterofthesegmentwithcoordinates18and110,18and100.Thecenteristhenodewithcoordinates18and105.4.Executethereflectionstepusingthereflectioncoefficientα=1.Thereflectedpoint(markedwithnumber2inFigure2.7.4)hascoordinatesof24and105.Sincetheobjectivefunctionvalueinthereflectedpointisbetter than inallpointsof the initialsimplex, thealgorithmpassesontotheexpansionstep.5.Calculatetheexpansionpointusingtheexpansioncoefficientσ=2.Itisfoundbydoublingthedistancebetweenthesimplexcenterandthesecondpoint.Thenodecorrespondingtotheexpansionpoint(number3inFigure2.7.4)hasahigherobjectivefunctionvalueascomparedtonodenumber2andhencesubstitutesforthelatterbecomingthenewvertexofthesimplex.6.Executeanotherreflectionstep.Thereflectedpointcorresponds topointnumber4 inFigure2.7.4.Since theobjectivefunctionvalue inthe reflected point is lower than in the second-worst point of theprevioussimplex,thealgorithmpassesontothecontractionstep.7.Calculatethecontractionpointusingthecontractioncoefficientγ=0.5(thisisnodenumber5).Sincethisnodeisbetterthantheworstoneintheprevioussimplex,butisnotthebest,thealgorithmpassesontothereflectionstep.

Page 163: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

8. Having executed the reflection step, node number 6 is obtained.Since the objective function value in this node is lower than in allpoints of the previous simplex, the algorithm passes on to thecontractionstep.9.Havingcalculatedthecontractionpoint,pointnumber7isobtained.Sincethispointfallsbetweentwonodes,furtherexecutionofstandardNelder-Mead algorithm for this optimization space is impossible. Toselect the final optimal solution, we can go several ways. Theobjectivefunctionofpoint7canbecalculatedbyinterpolationasthemeanofobjectivefunctionsofadjacentnodes(withcoordinatesof32and100,34and100).Thenthestandardalgorithmcanberesumed(bytreatingallpointsfallingoutsidethenodesinthesameway).Another,simpler approach consists in selecting the optimal solution amongvertices of the last simplex (the one having the highest objectivefunctionvalue).

This algorithm proves to be rather effective in solving different kinds ofoptimizationproblems.Itsmaindrawbackisalargenumberofcoefficients,thechoice among which may affect optimization effectiveness significantly. Asshown in the next section, accurate selection of coefficient values andpreliminary information about optimization space properties are necessary toapplytheNelder-Meadmethodeffectively.

2.7.2. Comparison of the Effectiveness of Direct Search Methods In theprecedingsectionwedescribedfourdirectsearchmethods.Eachofthemhasitsspecificfeatures,advantages,anddrawbacks.Thefirstmethod(thealternating-variableascentmethod)isthemostbasicandthesimplest.Allothersaremorecomplex and each one is more complex and more sophisticated than thepreceding ones (according to the order of their description in section 2.7.1).However,ourexperienceshowsthatmorecomplexmethodsarenotnecessarilymoreeffective. Ingeneral,wecanstate that theeffectivenessofanyparticularmethoddependson the shapeof theoptimization space towhich it applies.Amethod that has been proved to be quite effective for a given type ofoptimizationspacemaybeinappropriateforaspacewithadifferentstructure.Inthissectionwetesteffectivenessofthefourmethodsdescribedearlierand

analyze thedependenceof their effectivenesson the shapeof theoptimizationspace.Forthatpurpose,eachofthefoursearchmethodswillbeappliedtotwooptimization spaces (corresponding to the basic delta-neutral strategy) withdifferentshapes.Oneofthespaceshasasingleoptimalareaofarelativelylarge

Page 164: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

size(itisformedbyapplyingtheprofit-basedobjectivefunction;seethetop-leftchart of Figure 2.3.1). The second space (formed by applying the objectivefunctionthatisbasedonthepercentageofprofitabletrades;seethebottom-leftchartofFigure2.3.1)hasatotallydifferentshape—amultitudeofsmalloptimalareas.To obtain statistically reliable results, we executed 300 full optimization

cyclesforeachmethodandforeachofthetwoobjectivefunctions.Thecyclesdiffered fromeachotheronlyby the initialpointwhere the search foroptimalsolution starts. The comparative analysis of effectiveness of differentoptimizationmethodswillbebasedonthefollowingfivecharacteristics(ineachcasetheyarecalculatedonthebasisof300inputdata):

• Percentage of hitting the global maximum—The percentage ofoptimal solutions coinciding with the global maximum (when theoptimization algorithm stops at the node with the highest objectivefunctionvalue).•Percentageofhittingtheoptimalarea—Thepercentageofoptimalsolutionsfallingwithintheoptimalarea.Theobjectivefunctionvaluesof these solutions are higher than or equal to the predeterminedthresholdlevel.• Percentage of hitting the poor areas—The percentage ofunsatisfactory optimal solutions. The objective function values ofthesesolutionsarenotexceedingsomepredeterminedthresholdlevel.• Average value of optimal solutions—Average of the objectivefunction values of all optimal solutions. The average is calculatedusingthedataof300optimizationcycles.• Average number of computations—Average number ofcalculations necessary to execute one complete optimization cycle.Theaverageisbasedon300optimizationcycles.

Table2.7.1showsvaluesoffiveeffectivenesscharacteristicscorrespondingtofoursearchmethods.Whentheobjectivefunctionisbasedonprofit,theHook-Jeeves method demonstrates the highest effectiveness. In 69% of 300optimization cycles, the node corresponding to the global maximum wasselected as the optimal solution (accordingly, in 31% of cases the algorithmstopped without finding the node with the highest value of the objectivefunction). This method also considerably surpassed other methods by thepercentageofhitting theoptimalarea(72%ofcases)andaveragevalueof theoptimal solution (6.43). The only ratio by which the Hook-Jeeves method is

Page 165: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

slightlyworse than the alternating-variable ascentmethod is the percentage ofhitting the poor areas (15% and 14%, respectively). However, the significantdrawbackof thismethod is that it ishighly time-consuming.Oneoptimizationcycle requires 1,279 calculations on average, which is much more than thenumberofcalculationsneededforothermethods.

Table2.7.1.Effectivenesscharacteristicsoffouroptimizationmethodsbasedonthedirectsearchofoptimalsolutions.

Thealternating-variableascentmethodtakessecondplacebytheeffectivenessof optimizing the unimodal profit-based objective function. Although it isinferior to theHook-Jeevesmethodbyall indicators (except thepercentageofhittingthepoorareas),itsindisputableadvantageistherelativelylownumberof

Page 166: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

calculationsrequiredtocompleteoneoptimizationcycle(319onaverage,whichisone-fourthofthenumberfortheHook-Jeevesmethod).The effectiveness of theRosenbrockmethod is inferior to the two previous

methods.Onlyin11%ofthe300trialsdidthismethodmanagetodiscovertheglobal maximum, and in 41% of the trials the algorithm stopped at nodessituatedinareascharacterizedbylowvaluesoftheobjectivefunction.Besides,the number of calculations required to find optimal solutions using theRosenbrock method turned out to be quite high—835 on average, which isslightly better than the value obtained for theHook-Jeevesmethod andmuchworsethanthefiguresrelatingtoothermethods.Theworst resultsweredemonstratedby theNelder-Meadmethod.Although

the number of calculations required by this algorithm was superior to othermethods,allindicatorscharacterizingitseffectivenesshaveverylowvalues.Inonly7%ofalltrials,theoptimalsolutionsfoundbythismethodcoincidedwiththeglobalmaximum;andinonly15%ofcases,theoptimalsolutionwaslocatedintheoptimalarea.Thesolutionswereunsatisfactoryinasmuchas60%ofthetrials.Whenapplied toanotheroptimizationspace(constructedusingtheobjective

functionbasedonthepercentageofprofitabletrades),theeffectivenessratesofthe alternating-variable ascent method, the Hook-Jeeves method, and theRosenbrockmethodwere approximately the same (except for the fact that thelastmethodwas slightlyworse by the percentage of hitting the optimal area).Again, the Nelder-Mead method showed the worst results. Such loweffectivenessofthisalgorithmisquitesurprising.Perhaps,thereasonisthattheinitialconditions(thesimplexsize)and thevaluesof itsnumerouscoefficients(reflection,contraction,reduction,andexpansion)shouldbethoroughlyselectedto implement thismethod effectively.We selected the simplex size arbitrarilyand applied commonly used values for the coefficients. To obtain satisfactoryresults,weshouldprobablydefinethecoefficientsmoredeliberatelyandselectthe initial simplex on the basis of some a priori assumptions about theoptimizationspaceproperties.The effectiveness of all four optimization methods was lower for the

optimization space corresponding to the objective function based on thepercentageofprofitabletrades(ascomparedtothespaceconstructedusingtheprofit-based function). This finding supports our supposition that the shape oftheoptimizationspaceinfluencestheeffectivenessofoptimizationgreatly.Mostlikely, unimodal spaces with a relatively broad optimal area are easier to

Page 167: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

optimizebydirectsearchmethodsthanpolymodalspaceswithalargenumberofscatteredoptimalareas.

2.7.3.RandomSearchUptoherewediscussedtwoapproachestooptimization—exhaustivesearch,

requiring calculationof theobjective function in all optimization spacenodes,anddirect search.There isanotherapproachconsistingof randomselectionofoptimizationspacenodes.Certainly,randomsearchisthesimplestoptimizationmethod. To implement it, one has to select the specified number of nodesrandomlyandcalculate theirobjectivefunctionvalues.Thenthenodewith themaximumvalueisselectedastheoptimalsolution.Thismethodissoprimitivethatitisoftennotevenconsideredasanappropriatealternative.Nevertheless,inmany cases (and by many characteristics) random search may ensure rathereffectiveresultsnotinferiortodirectsearchmethods.Themainandtheonlyfactoraffectingtheeffectivenessoftherandomsearch

is thenumberofnodes tobeselected.Themoretrials thataremade, themoreprobableitisthattheoptimalsolutionwillcoincidewiththeglobalmaximumorlieintheclosestvicinitytoit.Thenumberoftrialsshoulddependonthesizeoftheoptimizationspace.Inallourexamplesoptimizationspaceconsistsof3,600nodes.Ifweexecuteonly100trialsinsuchaspace,lessthan3%ofthenodeswill be tested,which is apparently insufficient to select a satisfactory optimalsolution.However, ifoptimizationspaceconsistsofonly500nodes,100 trialscover20%ofthespace,whichmaybequitesufficient.Inthissectionwewillanalyzethreeaspectsofrandomsearcheffectiveness:

1. The relationship between search effectiveness and the number ofrandomlyselectednodes.Theeffectivenesswillbetestedfor100,200,...,1,000trials(intotal,10variantsoftheselectednode’squantities).2. The influence of the optimization space shape on searcheffectiveness.Asintheprecedingsection, therandomsearchmethodwillbeappliedtotwodifferentoptimizationspaces—oneconstructedusing the profit-based objective function and another one relating tothefunctionbasedonthepercentageofprofitabletrades.3.Comparisonof random search effectivenesswith the effectivenessoftwodirectmethods—thealternating-variableascentmethodandtheHook-Jeevesmethod (in thepreceding section these algorithmswereprovedtobethemosteffectiveamongotherdirectsearchmethods).

To analyze the effectiveness of the random search, we will use the same

Page 168: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

characteristicsasforcomparingfourdirectsearchmethods(seeTable2.7.1).Asonewouldexpect,valuesofallcharacteristics increaseas thenumberof

randomlyselectednodesrises(seeFigures2.7.5and2.7.6).However, theratesof these increasesvary fordifferentcharacteristics.Moreover, theshapeof therelationship between search effectiveness and the number of trials is alsocharacteristic-dependent. The percentage of optimal solutions coinciding withthe global maximum increases linearly as the number of selected nodesincreases.Ontheotherhand,thepercentageofoptimalsolutionslocatedintheoptimalareaandtheaveragevalueofobjectivefunctionincreasenonlinearlyasthe number of trials increases: Initially the growth in values of thesecharacteristics is rapid,buta further increase in thenumberof trialsaddsonlyslightlytothesearcheffectiveness.

Figure2.7.5.Therelationshipbetweentheeffectivenessofrandomsearchandthenumberofselectednodes(trials).Objectivefunction:profit.The

left-handchartshowstherelationshipfortwocharacteristics:percentageofhittingtheglobalmaximumandpercentageofhittingtheoptimalarea.Theright-handchartshowstheaveragevalueoftheoptimalsolution(anothereffectivenesscharacteristic)anditsvariabilityintheformofstandarderror.

Page 169: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure2.7.6.Therelationshipbetweentheeffectivenessofrandomsearchandthenumberofselectednodes(trials).Objectivefunction:percentageof

profitabletrades.Theleft-handchartshowstherelationshipfortwocharacteristics:percentageofhittingtheglobalmaximumandpercentageofhittingtheoptimalarea.Theright-handchartshowstheaveragevalueoftheoptimalsolution(anothereffectivenesscharacteristic)anditsvariability

informofastandarderror.

Random search effectiveness is higher for the optimization spacecorresponding to the profit-based objective function than it is for the spaceconstructed using the function based on the percentage of profitable trades(compare the left-hand charts of Figures 2.7.5 and 2.7.6). This fully complieswith the results obtained in the preceding section for direct search methods.Besides, the variability of optimal solutions estimated for the profit-basedobjectivefunctiondecreasesasthenumberoftrialsincreases(seetheright-handchartofFigure2.7.5).Howeverthistrendwasnotobservedfortheoptimizationspaceconstructedusinganotherobjectivefunction,thepercentageofprofitabletrades(seetheright-handchartofFigure2.7.6).Whensearcheffectivenessismeasuredbythepercentageofhittingtheglobal

maximum, random search is inferior to the alternating-variable ascent and theHook-Jeevesmethods. However, when a sufficiently large number of trials isexecuted, random search becomes more effective with two other indicators.When effectiveness is expressed through the average value of the optimal

Page 170: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

solutionsorbythepercentageofhittingtheoptimalarea,randomsearchismoreeffective than the alternating-variable ascent method, provided that theoptimizationspacewasconstructedusingtheprofit-basedobjectivefunctionandthatthenumberoftrialsisequaltoorgreaterthan400.When500trialsareused,the random method becomes better than the Hook-Jeeves method (compareFigure2.7.5andTable2.7.1data). Ifoptimizationspacewascreatedusing theobjectivefunctionbasedonthepercentageofprofitabletrades,randomsearchismoreeffectivethanthealternating-variableascentmethodandtheHook-Jeevesmethod,providedthateffectivenessismeasuredbythepercentageofhittingtheoptimal area and the number of trials is equal to or greater than 600. Wheneffectivenessismeasuredbytheaveragevalueoftheoptimalsolution,randomsearch is better than these two methods beginning from 700 trials (compareFigure2.7.6andTable2.7.1data).This analysis brings about a number of important conclusions regarding the

applicabilityofrandomsearchforoptimizationoftradingstrategies.Ingeneral,we should admit that as the number of trials increases to a certain level, theprobabilitythattheoptimalsolutionobtainedwillbecloseenoughtotheglobalmaximumbecomessufficientlyhigh.Inparticular,randomsearchmaybeusedif(1) optimization space size allows analyzing around 20%of its nodes and (2)preliminary knowledge indicates that optimization space is unimodal. Theinformationconcerning the spacemodalitymightbeavailable if anexhaustivesearchhasalreadybeen implementedduring thepreparatory stagesof strategydevelopment. If the space shape (as determined during the preliminaryinvestigation) is similar to the one pertaining to the profit-based objectivefunction (see Figure 2.2.2), random search can be used in further strategyimprovementsandoptimization.

2.8. Establishing the Optimization Framework: Challenges andCompromisesSettingupaframeworkforoptimizationoftradingstrategies,ingeneral,and

option strategies, in particular, is a challenging task. This requires makingnumerousdecisionsthatinfluenceboththequantityofcomputationalresourcesneeded to implement all necessary procedures and the reliability of the finalresults. The main difficulty consists in finding the trade-off betweenminimizationofcalculation timeandmaximizationof informationvolume thatcanbeobtainedinthecourseofoptimization.In particular, the construction of the optimization space requires making

several compromise decisions. The first one is about the dimensionality of

Page 171: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

optimization,which is determined by the number of parameters.Although theset of parameters requiring optimization depends on the strategy logic, thedecisionastowhichofthemaretobeoptimizedbytechnicalmethods(similarto thosedescribed in thischapter)andwhichshouldbefixedon thebasisofaprioriassumptions (or scientificmethods) iscertainlyamatterofcompromise.Thefewerparametersthatgetoptimized,thelesscomplexthewholeprocessisandthelowertheriskisofoverfitting.Ontheotherhand,ignoringoptimization(byfixingparametervalues) increases therisk tomiss theprofitablevariantofthe strategy.The next decision consists of choosing the permissible parameterranges and optimization steps. Here, the trade-off is only between the timeconsumed and the volume of information obtained. Therefore, these decisionsdependmostlyoncomputationalfacilitiesavailabletothestrategydeveloper.Reduction of calculation time is essential but it is not the only challenge

arisingfor thestrategydeveloper.Another fundamentally importantdecision isthecomposition,quantity,andrelativeimportanceofobjectivefunctionsutilizedintheoptimizationprocess.Werecommendbasingthisdecisionontheextentofcorrelationsbetweendifferentobjectivefunctionsandonthescopeofadditionalinformationcontainedinthem.Afterthesetofobjectivefunctionsisdefined,weneed to chooseamulticriteria analysismethod,which isnot a trivialproblem.Thechoiceofparticulardirectsearchmethodisalsooneofthemaintrade-offs(solvedonthebasisofanalysisofoptimizationspaceproperties)thatinfluencethereliabilityofoptimizationresults.In this chapter we used the example of the basic delta-neutral strategy to

demonstrate general approaches to resolving trade-offs and making keydecisionsintheprocessofoptimization.Whilediscussingthemainelementsofoptimization frameworkof the delta-neutral strategy,we strove to put them inthe general context of option strategies optimization. Since each optimizationproceduredependson specificpropertiesofaparticular strategy,wecouldnotprovideuniversalsolutionsthatwillbeequallysuitableforall typesofoptionsstrategies. Instead,we tried to develop a systemof recommendations thatwillenable thedeveloper toconstructa reliablesystemsuitable foroptimizationofdifferentoptionstrategies.

Page 172: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Chapter3.RiskManagement

Asoftoday,thereisnouniversaldefinitionthatwouldembraceallaspectsofsuch a complex and versatile concept as “risk.”Actually, wemust admit thatmillionsof people—journalists, businessmen, scientists, professional investors,and financial services consumers who use this term daily—are still unable togiveastrictanduniversaldefinitionofthematterinquestion.Thisisespeciallystriking considering that the notion of risk is the cornerstone of economics,finance, and many other related disciplines. Moreover, the same situation isobservedintwoother,undoubtedlyfundamental,areasofscientificcognitionofthe material world: biology and physics. In biology, there is no universaldefinition of “species,” while this notion is the basis for the wholemacroevolution theory—thesignalachievementof this science.Physicists alsodid not arrive at a common opinion regarding a unique and comprehensivedefinition of “energy.” Without precise understanding of this key element,neitherthedevelopmentofthequantumtheoryatthemicrocosmiclevelnorthecreation of the “final theory of everything,” pretending to describe the origin,evolution,andfuturefateoftheuniverse,ispossible.Isn’t it strange that the three basic areas of human knowledge—biology,

economics, and physics—erect their theories on the basis of core elementslacking strict and unambiguous scientific definitions? We leave this questionunanswered since even the slightest attempt to straighten out this confusingsituationwilldistractusnotonlyfromthemaintopic,butalsofromthesystemofrationalreasoningthatwerigorouslyadheretointhisbook.

3.1.PayoffFunctionandSpecificsofRiskEvaluationAllfinancialinstrumentscanbeclassifiedaslinearornonlinearaccordingto

their payoff function. The former category includes stocks, commodities,currencies,andotherassetswhoseprofitsandlossesaredirectlyproportionaltotheirprice.Nonlinearassetsincludederivativefinancialinstrumentswithpricesdependingonthepricesoftheirunderlyingassets.Therelationshipsbetweentheprofits and losses of these instruments and the underlying asset prices are notlinear.Optionsrepresentoneofthemaincategoriesofthenonlinearinstruments.The approaches used to evaluate the risks of linear and nonlinear instrumentsdifferfundamentally.

3.1.1.LinearFinancialInstrumentsThegroundsforriskmanagement theory

Page 173: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

wereestablishedwhenderivativeshadnotyetbeguntheirfull-scaleadvanceonthe financial markets. As a result, all classical risk evaluation models weredevelopedforlinearinstruments.Thegeneralconceptstatingthat“theriskofaspecificasset isproportional tothevariabilityofitsprice”wasacceptedasthebasicparadigmforriskquantification.Theobjectiveestimationofpricevariabilitycanbederivedonlyfromthepast

pricefluctuations(otherestimates,forexample,thosebasedonexpertopinions,cannotbecompletelyobjective).Suchanapproachhasasignificantdrawback,sinceitrequiresextrapolationofhistoricaldataandisbasedontheassumptionthatprobabilitiesoffutureoutcomesareproportionaltothefrequencyofsimilaroccurrences that have been realized in the past. Although in many areas (forexample, in car insurance) this method is widely accepted, it was repeatedlyproved that with regard to financial markets it is, to say the least, imperfect.Nevertheless, despite all the drawbacks and inaccuracies that arisewhen risksare estimated on the basis of historical data, this approach is widely appliedbecausetherearenobetteralternativesasoftoday.It was suggested to use the standard deviation of asset returns (or their

dispersion)as themeasureofpricevariability,which isusuallydenotedby theterm “historical volatility.” Usually, historical volatility is calculated asannualizedmean-squaredeviationofdailylogarithmpricereturns.Thelengthofthehistoricalperiodusedtocalculatevolatilityisakeyparameterinmeasuringthe riskof linearassets. If timeseriesare too long, theestimateof thecurrentrisk is based on outdated data having no direct relation to the actual marketdynamics. Such a valuation cannot be reliable.On the other hand, using timeseries that are too short brings about unstable risk estimates reflecting onlymomentarymarkettrends.Thus,thechoiceofthehistoricalhorizonlengthisaproductof compromiseand shouldbedefinedwithin the contextof thewholeriskmanagementsystem(while taking intoaccount thespecific featuresof thetradingstrategyunderdevelopment).Although standard deviation by itself reflects the risk, it is also used to

calculate more complex indicators that express risks in a form that is moreconvenient for practical application. The well-known example of such anindicatorisValueatRisk(VaR),whichestimatesanamountoflossthatwillnotbeexceededwithagivenprobabilityduringacertainperiod.Thehistoryofemergenceandbroadacceptanceofthisindicatordatebackto

the stockmarket crash of 1987,when the failure of existing riskmanagementmechanisms became evident. The search for new approaches to risk

Page 174: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

measurement led to quick development and an extensive application of theinnovativetechnology,expressingtheriskthroughestimationofcapitalthatmaybe lost with a given probability, rather than by calculation of some statisticalindicators (like standard deviation). In the 1990s VaR became the universallyrecognized standard of riskmeasurement, and in 1999 it obtained the officialinternational status set in the Basel Agreements.With the lapse of time, VaRbecame the compulsory indicator appearing in the accounting reports of themajorityoffinancialinstitutions.Although from a practical point of view, VaR is more informative than

standarddeviation, these indicatorsdonotdiffer fromeachotherconceptually.ThiscanbedemonstratedbyconsideringtheVaRcalculationmethod.TherearethreemainapproachestoVaRcalculation:analytical,historical,andtheMonte-Carlo method. The analytical method is based on using the parameters ofspecific return distribution. Despite its numerous drawbacks, lognormaldistribution isusedmostoften.Since themainparameterof thisdistribution isthestandarddeviation(thesecondparameter,expectedprice,isusuallysettobeequal to the current asset price), one can claim that VaR is just a secondaryindicatorderivedfromthestandarddeviation.Thehistoricalmethodisbasedonusingassetpricechanges thatwereobservedduringapredeterminedperiod inthepast.Sincethestandarddeviationiscalculatedonthebasisofthesamedata,bothindicatorsstronglycorrelatewitheachotherand,infact,expressthesameconcept.TheMonte-Carlo method generates a multitude of random price (orreturn) outcomes. The algorithm of price generation utilizes the probabilitydensityfunctionofacertaindistribution.Andagain,thelognormaldistribution(with the standard deviation as its main parameter) is used most frequently.Thus, theemergenceofVaRaddedmoreconveniencefor itsusers,butdidnotleadtothedevelopmentofnewriskevaluationprinciples.There is nothing particularly complicated in risk evaluation for portfolios

consistingoflinearassets.InmostcasesthestandarddeviationandVaRofsuchportfolioscanbecalculatedusingsimpleanalyticalmethods.Theminimalinputdata required for these calculations include the standard deviation of eachinstrument,itsweightintheportfolio,andthecovariancematrix.Thematrixisnecessarytoaccountfortheeffectofdiversification(adecreaseinportfolioriskasaresultofincludinglow-correlatedassetsorassetswithnegativecorrelationsin it). Conversely, the risk for a portfolio containing at least some nonlinearinstruments cannot be calculated analytically. In this case we need to applydifferentsimulationmethods,ofwhichtheMonte-Carloisthemostcommon.

3.1.2.OptionsasNonlinearFinancialInstrumentsTraditionalriskevaluation

Page 175: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

methodsthatarecommonlyusedforlinearassetsareinappropriateforfinancialinstruments with a nonlinear payoff function. The reason is that the returndistributionofnonlinearassetsisnotnormal.Forexample,acalloptionhasanunlimited profit potential which implies that the right tail of its returndistribution is unlimited.At the same time, itsmaximum possible loss cannotexceed the premium paid at the position opening. Hence, the left tail of thedistributionislimitedtothisamount,whichmeansthatthereturnsdistributionisasymmetricandcannotevenroughlybeconsideredasnormal.Thenonnormalityis so pronounced that the application of logarithmic transformation does notsolve the problem, as this is the case for linear assets. (Although logarithmictransformation brings the return distribution of linear assets closer to normaldistribution, there are many evidences of deviation of logarithm returndistribution from normality. Nevertheless, in this case we speak only aboutdeviations,whilefornonlinearassetsthedistributiondoesnotevengetclosetothenormality.)Despite theaforesaid,methodsdevelopedfor riskmeasurementof linear assets can be applied to some nonlinear instruments, provided thatcertain conditions are observed. For example, although the VaR of an optioncannot be calculated analytically, it can be estimated using the Monte-Carlomethod.However, thesemethodscanbeusedonlyasauxiliaryinstrumentsforthe risk evaluation of automated option trading strategies. Dedicatedmethodswith due regard to the specifics of nonlinear assets in general and options inparticularshouldbegivenpriority.The common tools for risk evaluation of separate options are the “Greeks”

that express the change in option price given the small change in a specificvariable. These indicators can be interpreted as the sensitivity of an option tofluctuationsinavariablevalue.Thevariablesincludeanunderlyingassetprice,volatility,time,andtheinterestrate.Thesevariablesmaybeseenasriskfactorsthatgiverisetoinstabilityofoptionprices.TheGreeksarecalculatedanalyticallyaspartialderivativesoftheoptionprice

with respect to the given variable. One of the option pricing models (forexample,theBlack-Scholesformula)isusedtocalculatethesederivatives.Deltais thederivativeof theoptionpricewith respect to theunderlying asset price.The derivativewith respect to volatility is called vega,with respect to time—theta—andwithrespecttotheinterestrate—rho.Derivativesofthesecondandhigher orders can also be used (for example, gamma—the second orderderivativewithrespecttoprice).TheGreeksrepresentaconvenientandratheradequateinstrumentofoptions

risk evaluation. The risk of combination, consisting of options related to one

Page 176: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

underlying asset, can be estimated by summing up the correspondingGreeks.However,problemsdoariseinmeasuringtherisksofcomplexstructuresratherthan separate options. Inclusion of option combinations, related to differentunderlyingassets, in theportfoliomakes it impossible toevaluatecertain risksbymeresummation.SomeGreeks,suchasthetaandrho,areadditiveforoptionspertaining to different underlying assets. Thus, the sensitivity of the complexportfoliototimedecayortheinterestratechangeiseasilycalculatedasthesumof thetasand rhosof separateoptions.Thingsgetmorecomplicatedwithnon-additiveriskindicators,suchasdeltaandvega(thesetwocharacteristicsarethemostimportantforriskmanagement).Iftheportfolioconsistsofoptionsrelatingtoseveralunderlyingassets,thesummationofseparatedeltasandvegasmakesnosense.Thesecharacteristicsarenotappropriateforcomplexportfoliossincetheyexpress changes in theoptionpricedependingon thechanges inpriceorvolatilityofonespecificunderlyingasset.Differentiatedanalysisofpositionsinseparate underlying assets is not efficient since the whole portfolio must beevaluatedasasinglestructure.TheproblemofGreeksnon-additivitycanbesolvedbyexpressingthedeltas

ofalloptionsasthederivativeswithrespecttosomecommonindexratherthanto their corresponding underlying assets. Similarly, vegas of different optionscanbecalculatedasthederivativewithrespecttothevolatilityofthesameindexrather than to the volatilities of separate underlying assets. Such proceduresimpartadditivitypropertiestodeltaandvega,whichallowsforthecalculationofrisk indicators for thewholeportfolioasasingleentity.S&P500oranyotherindexconstructedbythesystemdeveloper(forexample,anindexbasedonthepricesofonlythosestocksthatareunderlyingassetsforcombinationsincludedintheportfolio)canbeusedasacommonindex.Theselectionorconstructionofthecommon index representsa separatecomplex task; its solutiondependsonthe relationships between the portfolio elements and the chosen index and onmanyriskmanagementparameters.Index delta is undoubtedly one of the most important instruments for

measuringtheriskofoptionportfolios.However,apartfromthisindicator,risksof automated options trading strategies should and must be evaluated usingadditionalcomplementarycharacteristics(inthischapter,apartfromindexdelta,we discuss three other indicators: VaR, loss probability, and asymmetrycoefficient).Thisenablesustoputtogetheracompletepictureofdifferentriskaspectsthatarepeculiartothestrategyunderdevelopment.

3.2.RiskIndicators

Page 177: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

The risks of option portfoliosmaybe estimated using traditional indicators,suchasVaR,andspecificcharacteristicsdevelopeddeliberatelyforthispurpose.Althoughtheriskevaluationofoptionportfoliosbymeansofindicatorsthatareusually used for linear assets is technically possible, one should be extremelycarefulininterpretingtheobtainedresults.Theseindicatorscanbeusedonlyasauxiliary instruments of risk management. The main indicators should bedevelopedsubject tooptionspeculiarities.Togeta thoroughcomprehensionofdifferent risks of theportfolio under construction, several indicators shouldbeapplied simultaneously.Moreover, these indicators should correlate with eachother as little as possible. This will allow us to form a set of unique riskindicators, each ofwhichwill complement, but not duplicate, the informationcontainedinotherindicators.Four risk indicators are discussed in this section. We begin with VaR and

explainhowthis indicatorcanbecalculated for theoptionportfolio.Then,wedescribe three indicators developed specifically for risk evaluation of complexoptionportfolios.Particularattentionisfocusedontheindexdelta.

3.2.1.ValueatRisk(VaR)Asdefinedearlier,VaRisanestimateofalossthatwillnotbeexceededwith

a given probability over a certain period (in further exampleswewill use the95%probability).Foraportfolioconsistingofnonlinearassets,theMonte-Carlosimulation has to be applied for aVaR calculation.Amultitude of underlyingasset price outcomes is generated using the probability density function oflognormal (or another) distribution (constructed on the basis of standarddeviationderivedfromhistoricaldata).Then,foreachpriceoutcometheoptionpayoff is estimated. Finally, these values are used to calculateVaR.The samemethod(withanallowanceforcorrelationsbetweendifferentunderlyingassets)isusedtocalculatetheVaRoftheoptionportfolio.Despiteallitsadvantagesandpracticalutility,VaRhasanumberofsignificant

drawbacks(Tsudikman,Izraylevich,Balishyan,2011),whichbecomeespeciallyapparentwhenitisappliedtoassesstherisksofnonlinearassets.Thefollowingarethemaindrawbacks:

• Lack of reliable technology to derive robust parameters of returndistributionfromhistoricaldata.Consequently,theprobabilitydensityfunctions used for VaR estimation fail to forecast severe economicshocks. For complex portfolios that include options relating todifferent underlying assets, the possibility of obtaining reliable androbustVaRestimatesisevenmorequestionable.

Page 178: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

•Besidesunderestimatingthemagnitudeandthefrequencyofextremeoutcomes, VaR may also overestimate both unsystematic(diversifiable)andsystematicrisks.•VaRisapointestimateandthusdoesnotreflectthewholerangeofpotential outcomes. Since it is calculated for only one or severalprobability values, the general properties of the distribution left tail(containingalladverseoutcomes)remainvague.•AnestimatedVaRvaluecanbeeasilymanipulatedbychangingthelength of the historical price data. This issue becomes especiallyproblematic if the portfolio includes less liquid securities (likemanyoptions)lackingaverifiedpricehistory.•Likemanyotherindicatorsdevelopedforestimatingtheriskoflinearassets,VaRrelies, toacertainextent,oneffectivemarkethypothesisand,hence,inheritsitsnumerousdrawbacks.Thisbecomesespeciallyapparentintimesofextrememarketfluctuations.

UntilrecentlyitwaswidelybelievedthatVaRadequatelydescribestheriskofallinvestmentportfoliosregardlessoftheircompositionandstructure.However,the global financial crisis that erupted in 2007 vividly demonstrated themismatch of forecasts based on VaR and realized losses. The reason for thedivergencebetweenforecastsandrealitywasthatinthepast20yearsfinancialmarkets underwent cardinal changes, caused by the development of complexfinancialtechnologiesandtheshiftingofemphasisfromsimplelinearassetstoderivatives (manyofwhich are nonlinear).The share of nonlinear instruments(of which options are not the last) in the asset structure of large financialinstitutions grew steadily. This impressive advance notwithstanding, riskevaluationmechanismsremainedthesameorlaggedbehindsignificantly.In the development of option-based trading strategies, the use of a risk

forecastingsystembasedsolelyonVaRorsimilardispersion-relatedindicatorsisinadmissible.Afullyfledgedriskmanagementsystemshouldincludethewholepackageofevaluationalgorithmsbasedonvariousprinciplesand takespecificoptionpropertiesintoaccount.

3.2.2.IndexDeltaThe index delta characterizes the sensitivity of an option portfolio to broad

market fluctuations. This indicator expresses quantitatively the change in theportfolio value under a small index change. The index delta can be used toevaluate and manage the risk of complex portfolios in the same way as an

Page 179: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

ordinarydeltadoes(whenappliedforportfoliosconsistingofoptionsrelatedtoasingleunderlyingasset).Besides,theindexdeltacanbeappliedtocreatedelta-neutral portfolios (as described in Chapter 1, “Development of TradingStrategies”) and to restructure existing positions in order to maintain delta-neutralityoverthewholeperiodofportfolioexistence.TheAlgorithm

The algorithm for calculation of the index delta can be presented as asequenceofthefollowingsteps:

1.Buildregressionmodelsfortherelationshipsbetweenthepricesofallunderlyingassets (optionsonwhichare included in theportfolio)and the index. To build these models, the length of the historicalhorizonhastobespecified.2.Usingtheregressionmodelscreatedatstep1,calculatethepricesofallunderlyingassetsas impliedby theone-pointchange in the indexvalue(orbyacertainpercentageindexchange).3.Determinethefairvalueofeachoptionintheportfoliogiventhatitsunderlying asset price is equal to the value obtained at step 2. Thisprocedure is executed by substituting the price obtained at step 2(ratherthanthecurrentprice)intotheselectedoptionpricingmodel.4.Foreachoption in theportfolio,calculate theprice increment thatwouldtakeplaceifitsunderlyingassetpricechangesbyonepoint(orby the other value defined at step 2). The price increment is thedifferencebetweenthevaluecalculatedatstep3andthecurrentoptionmarketprice.5. Calculate the value of the index delta by summing up all theincrementsobtainedatstep4.

AnalyticalMethodofCalculatingIndexDelta

Consider a portfolio consisting of options related to different underlyingassets.Let{O1,O2,O3,...,ON}beasetofoptionsincludedintheportfolio,whilethe underlying asset of optionOi isAi. If different options relate to the sameunderlying asset (that is, assetsAj andAk coincide under j ≠ k), these optionsformastructurethatmaycorrespondtooneofthestandardoptioncombinations(strangle, straddle, calendar spread, and so on) or may be of any arbitrarycomposition.Formally,thecombinationmayconsistofanunlimitednumberofdifferentoptionsrelatingtooneunderlyingasset,andtheportfoliomayincludeanunlimitednumberofcombinations.

Page 180: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

For any optionOi included in the portfolio, its delta can be expressed as

where ∂Oi and ∂Ai denote small changes in the price of the option and itsunderlyingasset,respectively.Thisexpressioninterpretsdeltaasthespeedoftheoptionpricechangerelativetopricechangesofitsunderlyingasset.ComputingdeltaΔiofaseparateoptionisarathertrivialtask.Itisrealizedin

many software programs based on the Black-Scholes and other, moresophisticated, models. The delta of the portfolio consisting of options ondifferent underlying assets cannot be computed as the sum of all deltas sincethey are derivatives of premiumswith respect to different variables (prices ofdifferent underlying assets). As noted previously, this problem is solved bycalculating the sensitivity of the option price relative to the changes of indexratherthantochangesinthepricesofseparateunderlyingassets.Followingthisapproach,wedefineindexdeltaasaderivativeoftheoptionpricewithrespect

totheindexvalue:Thisindexdeltaofaseparateoptioncanbeexpressedasfollows:

Inthisequationthevalueexpressedas representsthechangeinthepriceof the underlying asset in response to the index change. In this respect it issimilartotheconceptofbeta.Thedifferencebetweenthesetwocharacteristicsisthat the index delta is dimensional, whereas beta is a nondimensionalcharacteristic(expressedastheratioofrelativepricechangestoarelativeindexchange). Beta is commonly used to evaluate the relationship between thechanges in the index and a separate asset. For our purposes, it would be

convenienttoexpressitasthefollowingratio:Aftersimpletransformationsweobtain

By substituting this expression into equation 3.2.1, we get the formula forcalculating the index delta of a separate option,

Page 181: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

where Δi is the ordinary delta of optionOi. Let us denote the quantity ofoptionOiintheportfolioasxi.TocalculatetheindexdeltaofthewholeportfolioIDPortfolio, the indexdeltasofseparateoptions includedin thisportfolioshouldbe summed considering their quantities:

The index delta calculated using equation 3.2.3 can be interpreted as thechange in the portfolio value in response to the index change byone point. Itmightbemoreconvenient toexpress theportfoliovaluechange in response tothe percentage index change. This allows evaluating portfolio sensitivity torelative indexchanges.Forexample,asimple transformationofequation3.2.3allows calculating the index delta for a 1% index change:

ExampleofIndexDeltaCalculation

Letusconsideranexampleofcalculatingtheindexdeltaforasmallportfolio,consisting of options on seven stocks. The S&P 500 will be used in thecalculations,thoughotherindexescouldbeequallyappropriatehere.Table3.2.1shows theportfolioconsistingof sevenshort straddles.Thequantitiesof thesecombinations are approximately inversely proportional to the prices of thecorrespondingunderlyingstocks.TheportfoliowascreatedonJanuary2,2009,usingoptionswith the nearest expirationdate (January 16, 2009).The currentindexvalueonJanuary2,2009,was931.8.Betacoefficientsofthestockswerecalculated on the basis of daily closing prices using the 120-day historicalhorizon. Ordinary deltas of separate options were derived using the Black-Scholesmodelwitharisk-freeinterestrateof3.3%andthevolatilityestimatedatthesamehorizonofpricehistory.Table3.2.1.Datarequiredtocalculatetheindexdelta(relativetotheS&P

500index)oftheportfolioconsistingofsevenshortstraddles.

Page 182: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Thenext-to-lastcolumnofTable3.2.1showsindexdeltasofseparateoptionscalculated by equation 3.2.2. For example, the index delta of one call optionrelatedtoVLOstockiscalculatedasIDi=(23.24×1.58×0.63)/931.8=0.0248.Theproductof indexdeltaofoneoptionanditsquantityintheportfoliogivestheindexdeltaofthepositioncorrespondingtothiscontract(thelastcolumnofthetable).Thus,theindexdeltaofthepositioncorrespondingtothecallofVLOstockisIDi=–400×0.0248=–9.93.Summingtheindexdeltasofallpositions(thatis,allvaluesshowninthelastcolumnofthetable)givestheindexdeltaoftheportfolio,whichcorrespondstoequation3.2.3.InthisexampleIDPortfolio=–0.61.Usingequation3.2.4, theportfolio indexdeltacaneasilybeexpressed inpercentage terms: , which means that theportfoliovaluewilldecreaseby5.69%iftheS&P500changesby1%.AnalysisofIndexDeltaEffectivenessinRiskEvaluation

Toestimatetheeffectivenessoftheindexdelta,weusedadatabasecontainingeightyearsofthepricehistoryofoptionsandtheirunderlyingassets.Theindexdeltas were estimated relative to the S&P 500 index. Accordingly, stockscomposingthisindexwereusedasunderlyingassetsforoptionsincludedintheportfolio.

Page 183: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

To estimate the influence of portfolio creation timing on the index deltaeffectiveness,weconstructedaseriesofportfoliosforeachexpirationdatefromthe beginning of 2001 until the beginning of 2009. These portfolios differedfrom each other in the number of trading days between the time of portfoliocreationandtheexpirationdate.Foragivenexpirationdate,themostdistantofthe portfolioswas constructed 60 days before the expiration; the next one, 59days before the expiration; and so on, right up to the last portfolio that wascreatedonly1daybeforetheexpiration.Thus,59portfolios(differentfromeachother in terms of time left until options expiration)were constructed for eachexpirationdate.Intotal,from30(for60days)to90(for1day)portfolioswerecreated for each value of the “number of days left until options expiration”parameter.Eachportfolioconsistedofshort straddles forall500stocks included in the

index.The straddleswerecreatedusing the strikes closest to thecurrent stockprice.Thequantityofoptionscorrespondingtoeachstockwasdeterminedasxi=10000 /Ai,where10000represents theequivalentof thecapitalallocated toeach straddle (seeChapter 4, “CapitalAllocation and Portfolio Construction,”fordetails),andA is thepriceof thestock i.Thebetaof each stock,deltasofseparateoptions,andindexdeltaswerecalculatedusingthesametechniquesandparameters as in the preceding example (see Table 3.2.1). In addition, thefollowingcharacteristicswereestimatedforeachportfolio:

Percent change of the index from the time of portfolio creation until theexpirationdate:I%=100.(Ie–It)/It,whereItistheindexvalueatthetimetofportfoliocreation,andIeistheindexvalueattheexpirationdate.Percentchangeoftheportfoliovaluefromthetimeofitscreationuntiltheexpirationdate:wherePt isthemarketvalueoftheportfolioatthetimet,andPe is the

valueoftheportfolioattheexpirationdate.Thischaracteristicreflectstherealizedportfoliorisk.Expected percent change of the portfolio value:

This characteristic represents the estimate of portfolio risk given theindexchange.The difference between the actual and the expected change of portfoliovalue:

Page 184: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Thecloser thischaracteristic is tozero(that is, thelesser thedifferencebetweentheactualandtheexpectedchanges),themoreaccuratetheindexdeltaisinforecastingportfoliovaluefluctuations.

Figure3.2.1 shows the average differences between the realized changes inportfolio values and the changes that were expected given the portfolio riskestimatedbytheindexdelta.Differencesoftheportfolioscreatedlongbeforetheexpiration(30to60days)wereclosetozero,thoughtheirvariability(shownonthe chart as standard deviations) was substantial. Therefore, these portfoliosallowed for the most accurate estimation of the risk with relatively highdispersion of individual outcomes. For portfolios created shortly before theexpiration (up to 20days), thedifferencebetween the actual and the expectedvalue changes were high, positive, and rather stable (low dispersion). Thisimplies that the index delta underestimates the risk of such portfolios and themagnitudeofthisunderestimationisstable.

Figure3.2.1.Relationshipbetweentheeffectivenessoftheindexdelta(expressedthroughthedifferenceoftheactualandtheexpectedportfoliovaluechanges)andthenumberofdaysleftuntiloptionsexpirationatthe

momentofportfoliocreation.Pointsdenoteaveragevalues;horizontalbars,standarddeviations.

Positivedifferences implythatactualchangesintheportfolio

Page 185: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

valuewerehigherthanexpected.Thismeansthattheindexdeltaunderestimatedthe risk of these portfolios (since the loss of short positions is incurredwhenoptions values increase . Correspondingly, negative differences

imply that actual changes in the portfolio value were smallerthan expected (risk was overestimated). Bars depicting the variability ofoutcomesaresituated inboth thenegativeand thepositiveareas forportfolioscreated far from their expiration dates (see Figure 3.2.1). This indicates thatsomeoftheseportfolioswereoverestimatedandsomewereunderestimated.Overall,wecanconclude thatat themomentofportfoliocreation, themore

days that remain until the expiration date, themore accurate the average riskestimateis.Atthesametime,theprobabilitythatagivenestimatewillturnoutto be inaccurate increases as well. For portfolios created shortly before theexpiration date, the risk is underestimated, though the magnitude of thisunderestimation is relatively stable (the standard deviation of the averagedifferenceisratherlow).Therefore,forportfolioscreatedalongtimebeforetheexpiration, the effectiveness of the index delta can be increased by applyingadditionalriskindicators,whileforportfolioscreatedjustbeforetheexpirationdate, the introductionofadjustingcoefficientsseemstobesufficient(since thevariabilityofresultsislow).Delta isa local instrument indicating thechange in theoptionpriceundera

smallchangeinitsunderlyingassetprice.Thismeansthatthehighertheactualunderlyingpricechange,thelessaccuratetheforecastoftheoptionpricechangebasedontheordinarydeltais.Hence,thenextissueaddressedinourstudyistotest whether and by howmuch the effectiveness of the forecast based on theindex delta deteriorates when index changes are considerable. To answer thisquestion,wewillexaminetherelationshipbetweentheeffectivenessoftheindexdelta(expressedthroughdifferencesbetweenactualandexpectedchangesintheportfoliovalue)andthemagnitudeoftheindexchange.AsitfollowsfromFigure3.2.2,bigindexchangesindeedinduceconsiderable

differences between realized and expected changes in portfolio values. Therelationshipsarestatisticallysignificantinbothcaseswhentheindexgrowsandwhenitfalls(intheformercasethecorrelationwaslowerthaninthelattercase).The most interesting fact in the context of evaluation of the index deltaeffectiveness is that considerable index changes (regardless of whether itincreases or decreases) correspond to positive differences, and small indexchangescorrespond tonegativeones(seeFigure3.2.2).Thismeans thatundersignificant index fluctuations, the index delta tends to underestimate the risk,

Page 186: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

whereas under small and moderate index moves, the risk turns out to beoverestimated.Theindexdeltademonstratesthehighesteffectivenesswhentheamplitudeofmarketfluctuationsiswithinthelimitsof3%to5%.

Figure3.2.2.Relationshipbetweentheeffectivenessoftheindexdelta(expressedthroughthedifferenceoftheactualandtheexpectedportfoliovaluechanges)andthepercentageindexchange.Emptypointscorrespond

topositiveindexchanges;filledpoints,tonegativeindexchanges.AnalysisofIndexDeltaEffectivenessatDifferentTimeHorizons

Theresearchpresentedintheprecedingsectionwaslimitedtothecaseswhenrisk is estimatedonlyonce—at the timeofportfoliocreation.Theaccuracyofthis estimate was also verified only once—at the expiration date of optionsincludedintheportfolio(forsimplicity’ssakeweassumethatalloptionsexpiresimultaneously). In this section we will study the situations in which risk isestimatedrepeatedlyduring theportfolio lifespanand theeffectivenessof thisestimateistestedatdifferenttimeintervals.Contrarytothepreviousstudy(inwhich59portfolioswereformedforeach

expiration date), in this study a single portfolio was constructed for eachexpirationdate.The timeof eachportfolio creationwas50 tradingdays away

Page 187: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

from thegiven expirationdate.Thenumberof portfolios totaled90.All otherparametersof the tradingstrategyandthealgorithmusedforportfoliocreationwerethesameasinthepreviousstudy.Theeffectivenessoftheindexdeltainforecastingportfolioriskwasevaluated

using the method that was applied in the preceding section (the differencebetweenriskestimatedonthebasisoftheindexdeltaanditsrealizedvalue).Toassess thequality of risk forecast at different stages of portfolio existence,wehadto(1)calculatevaluesoftheindexdeltadailythroughthewholelifespanoftheportfolio,and(2)estimatethechangesintheportfoliovalueduringdifferenttimeperiods(wewill refer to theseperiodsas“testinghorizons”).Allperiods,fromtheshortest(1day)tothelongestones(49days)hadtobetested.Thisdataallowsus toperformadetailedevaluationof thedifferencesbetweenforecastsandreality.Table 3.2.2 presents an example of one of the portfolios and shows the

evolutionofitscharacteristics.Atthetimeofportfoliocreation(August7,2008;first row of the table), therewere 50 trading days until the options expirationdate (October 17, 2008).The second rowof the table shows characteristics ofthis portfolio the day after its creation. Accordingly, the third row shows itscharacteristicsafterthreedays,andsoon,untiltheexpirationdate(only20firstdays of portfolio existence are included in Table 3.2.2). The table shows thevalues of the following characteristics that are necessary to estimate theeffectivenessoftheindexdeltaatdifferenttimehorizons:

• d—The number of days from the valuation moment until theexpirationdate.Thischaracteristicisusedforindexingthemomentsofvaluationandtesting.• IDd—The index delta calculated at themoment of valuation usingequation3.2.3.• —The percentage of index delta (expresses the change in theportfoliovalueiftheindexchangesby1%)calculatedatthemomentofvaluationusingequation3.2.4.• I%—Thepercentageof index change calculated as I%=100·(Id–j –Id)/Id,whereIdistheindexvalueatthemomentofvaluation,Id–jistheindex value at the moment of testing, and j is the testing horizon(numberofdaysbetweenthevaluationdateandthetestingdate).• —Thepercentageofchangeoftheportfoliovaluecalculatedas

, where Pd is the market value of the

Page 188: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

portfolio at themoment of valuation d, andPd–j is the value of theportfolio at the moment of testing. This characteristic reflects thechange in the portfolio value that occurs during j days. Therefore,

represents the risk of the portfolio that was realized at thespecifiedtimehorizon.

• —The expected percentage change of portfolio valuecalculated as . This characteristic estimatesthe portfolio risk under the condition that during j days the indexchangesbyI%.•Difference—A reflection of the divergence between the actual and

theexpectedchangeintheportfoliovalue .Apositivedifferencemeansthattheindexdeltaunderestimatestherisk,whereasanegativedifferencepointstotheriskoverestimation.Thecloserthedifferenceistozero,themoreaccuratetheindexdeltaisinforecastingtheportfoliorisk.

Table3.2.2.Characteristicsoftheoptionportfoliomeasuredduring20daysfromthetimeofitscreation(August7,2008).Valuespresentedinthetableareusedtoevaluatetheeffectivenessoftheindexdeltaatdifferent

timehorizons.

Page 189: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

ThecharacteristicsshowninTable3.2.2correspond to two testinghorizons,one and five days. Let us consider as an example the 41st day to optionsexpiration(d=41,highlightedingrayinthetable).Thefollowingisastep-by-stepdescriptionofthecalculationsnecessarytoestimatethedifferencebetweenrealizedandexpectedrisks.Theindexdeltacorrespondingtothisdateisequalto

For the one-day testing horizon (j = 1) the percentage index change isestimatedas

I%=100·(I40–I41)/I41=100·(1278–1275)/1275=0.2%.

Thepercentagechangeoftheportfoliovalueiscalculatedas

Page 190: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

andtheexpectedpercentagechangeoftheportfoliovalueis

Thedifferencebetween theactual and theexpectedchanges in theportfoliovalueisequaltoDifference=–0.3–(–0.2)=–0.1%,whichindicatesthatonthe41stdaytheriskwasslightlyoverestimated(whentheestimateistestedjustonedayafterithasbeenmade).Forafive-daytestinghorizon(j=5),thepercentageindexchangeis

I%=100·(I36–I41)/I41=100·(1282–1275)/1275=0.6%.

Thepercentagechangeoftheportfoliovalueisequalto

andtheexpectedportfoliovaluechangeis

Thedifferencebetween theactual and theexpectedchanges in theportfoliovalue ismuchhigher:Difference=–6.7–(–0.5)=–6.2%,which implies thatwhen the risk is tested five days after the forecast, it becomes highlyoverestimated.Characteristicsofallportfolioscreated fromthebeginningof2001until the

beginningof2009werecalculatedusingthesamemethodology.Theindexdeltaof each portfolio was estimated daily during the whole period of portfolioexistence. The effectiveness of these estimateswas tested at all time horizons(from1to49days).Graphical presentation of the relationship between the realized and the

forecast changes in the portfolio value provides a visual insight into theeffectiveness of the index delta. Figure 3.2.3 shows such relationships for theinitial stage of the portfolio life (from the 50th to the 40th days until optionsexpiration).Thehighestcorrelationwasdetectedfortheone-daytestinghorizon.Inthiscasethecloudofpoints(eachofwhichrepresentsanindividualportfolio)isblurredtothesmallestextent(thehighestdeterminationcoefficientR2=0.29wasobtainedinthiscase).Theextensionofthetestinghorizonto5,10,and20daysleadstoagradualdeteriorationinthepredictingqualityoftheindexdelta.An analysis of the data presented in Figure 3.2.3 suggests that the higher thetesting horizon, the weaker the relationship between the risk forecast and itsactualrealization,rightuptoitsfullabsence.Thisconclusionfollowsbothfroma comparison of correlation coefficients (R2 = 0.04 for 20 days) and from thepatternsofpointsscatteringovertheregressionplane.Besides,theextensionof

Page 191: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

the testing horizon results in the decrease of the slope coefficients ofcorresponding regression lines. This also supports our observation that theforecastingqualitiesoftheindexdeltaweakenatlongertimehorizons.

Figure3.2.3.Therelationshipsbetweenrealizedandexpected(onthebasisofindexdelta)changesinportfoliovalue.Fourtestinghorizonsare

shown.

Regressionanalysis,similartothatpresentedinFigure3.2.3, isasimpleandintuitivelycomprehensible toolforqualitativeevaluationof the indexdelta.Atthe same time, it does not provide a strict quantitative characteristic formeasuringtheeffectivenessofthisriskindicator.Forthatpurpose, itwouldbepreferabletousethedifferencebetweentherealizedandtheexpectedchangesinthe portfolio value. Since short option positions generate losses when theirvaluesincrease ,positivedifferences indicatethattheriskisunderestimatedbytheindexdelta.Accordingly,negativedifferencesimplythattheriskisoverestimated.Figure3.2.4showstheaveragedifferencesandstandarderrors(expressingthe

extentofresultsvariability)fordifferenttestinghorizons.Fortheshortesttesting

Page 192: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

horizon(oneday),thedeviationsoftherealizedchangesintheportfoliovaluesfrom expected ones were close to zero through the whole period, right fromportfolio creation up to about 20 days until options expiration.After the 20thday, the closer the portfolios approached the expiration, the more the riskbecameunderestimated.Thismeansthattheindexdeltacanforecastriskratheraccurately,butforashortperiodandonlyattheearlystagesoftheportfoliolife(during 30 days from its setup). A 5-day testing horizon gives similar resultswith the only difference that in this case the underestimation of risk beginsearlier (from the 30th day until expiration) and reaches higher values. Furtherincreasesinthetestinghorizonmakethesetendenciesevenmorepronounced—theunderestimationofriskbeginsearlierandreachesgreaterextents(seeFigure3.2.4). Besides, it would be worth noting that for short testing horizons, therelationships between the difference and the number of days left until optionsexpirationarenonlinear.Atthesametime,forthelongertestinghorizonstheserelationships gradually become more linear and steeper. This steepnesscharacterizesthespeedoftheforecastqualitydeteriorationoccurringduetothepassageoftime(approachingtheexpirationdate).

Figure3.2.4.Thedependenceofthedifferencebetweentherealizedandtheexpectedchangesintheportfoliovalueonthenumberofdaysleftuntiloptionsexpiration.Seventestinghorizonsareshown.Pointsdenoteaverage

values;horizontallines,standarderrors.

Complete information on the effectiveness of the index delta and itsdependence on the two parameters under examination—the valuationmoment

Page 193: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

(relative to the expiration date) and the testing horizon—can be gathered bypresenting the data in the form of a topographicmap. In the two-dimensionalcoordinate system we will plot the number of days left to options expiration(which corresponds to different moments of risk valuation) on the horizontalaxis, and the testing horizon on the vertical axis. The height marks of thistopographicsurfacereflect theaveragedifferencebetween therealizedand theexpected changes in the portfolio value. The topography of such a surface isshowninFigure3.2.5.Theareacorresponding to thehighest efficiencyof theindexdelta issituatedat thebottom-rightcornerof thesurface(highlightedbythebrokenlineonthechart).Ingeneral,wecanconcludethat(1)duringthe30days from the moment of portfolio creation (which covers the period fromportfoliocreationup to thedaywhenonly20daysare leftuntil theexpirationdate),theindexdeltacanestimatetheriskquiteeffectively,and(2)theprecisionof theseestimatesholdsduringapproximately25daysfromthe timewhentheestimates were made. The triangular shape of the area where the index deltademonstrates itshighestefficiencyindicates that forecasting theriskfor longerperiods is possible only at an early stage of the portfolio existence. As theexpirationapproaches,theforecasthorizonshouldbeshortened.

Figure3.2.5.Dependenceofdifferencebetweentherealizedandthe

Page 194: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

expectedchangesintheportfoliovalueonthenumberofdaysleftuntiloptionsexpirationandonthetestinghorizon.Thebrokenlinehighlightsthe

areawheretheriskwasestimatedbytheindexdeltaefficiently.ApplicabilityofIndexDelta

Theindexdeltarepresentsaconvenientandeasilycalculableinstrumentthatcanbeappliedtodifferenttypesofoptionportfolios.However,itseffectivenessmayvary inquiteawiderangedependingonseveral factors. Inparticular, thepredictingpowerofthisriskindicatorcanbeaffectedbythetimelefttooptionsexpiration.Whenaportfolioisconstructedusingoptionswitharelativelylongexpirationdate,riskforecastsobtainedonthebasisoftheindexdeltaarequitereliable. Conversely, if a portfolio consists of options that expire shortly, theapplicability of the index delta is limited (the risk may turn out to beunderestimatedsignificantly).Besides,wehavedetectedthattheeffectivenessofforecastingtheriskbythe

instrumentalityoftheindexdeltadependsonthemagnitudeofexpectedmarketfluctuations.This indicatordemonstrateshigh forecastingabilitiesduringcalmand moderately volatile periods. However, when extreme conditions areprevailingoverthemarkets,theindexdeltaisunsuitableforassessingtheriskofoptionportfolios.Other things being equal, applying the index delta for risk measurement is

quite effective during the initial stage of a portfolio’s existence. However, itseffectiveness deteriorates as the portfolio ages and the expiration dateapproaches.Besides, the indexdelta is able to produce a reliable risk forecastonlyforrelativelyshorttimeintervals.Thereisadirectrelationshipbetweenthenumberofdaysleftuntiloptionsexpirationandtheforecasthorizon—theclosertheexpirationis,theshortertheforecastshouldbe.Otherwise,theriskmayturnouttobeunderestimatedsignificantly.

3.2.3.AsymmetryCoefficientThis indicator expresses the skewness of the payoff function of the option

portfolio. The idea underlying this concept consists in the fact that moststrategies based on selling naked options are built on the market-neutralityprinciple.If theportfolioisreallymarket-neutral, itspayofffunctionshouldbesufficiently symmetrical relative to thecurrentvalueofan index reflecting thebroadmarket.Suchsymmetryimpliesthatthevalueoftheportfoliowillchangeroughly equally regardless of the market direction. If market-neutrality isviolated, the payoff function is biased and the asymmetry coefficient canmeasurethisbias.

Page 195: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Since theportfoliovalueP is the sumofoptionsvalues that it includes, therelationship between P and changes of the index I can be expressed as

whereOiisthevalueoftheoption,Aiistheunderlyingasset,xiisthequantityof option i in the portfolio, and δ is the index change (for example, δ = 0.07means that the index rose by 7%). The value of function Ai(I,δ) can beestablishedusingbetaβi,estimatedasaslopecoefficient ina linear regressionbetweenthereturnsoftheunderlyingassetandtheindex.Ifweknowbeta,wecan roughly estimate the value of the underlying asset given that the indexchangesbyaspecifiedamount:By applying the Black-Scholes model, we can estimate the values of all

options included in the portfolio under the assumption that prices of theirunderlying assets are equal to the values obtained using equation 3.2.6.Summing allOi values, we get the portfolio value corresponding to equation3.2.5. TwoP values have to be calculated in order to estimate the degree ofportfolioskewness—forthecaseofindexgrowthbyδ×Iandforthecaseofitsdecline by the same value. These values will be denoted as P(Ai(I, δ+)) andP(Ai(I, δ–)), respectively. Knowing these two values, the portfolio asymmetrycoefficient can be calculated as

Ifwepresenttheportfoliopayofffunctionbyplottingtheindexvaluesonthehorizontal axis and theportfoliovalueson thevertical axis, thenAsym canbevisualizedastheslopeofthelineconnectingthetwopointswithabscissasX=I·(1+δ)andX=I·(1–δ)andordinatescorrespondingtothepayofffunction.The higher the absolute value of the slope, the more asymmetric the payofffunction(iftheslopeiszero,thepayofffunctionisperfectlysymmetric).Table 3.2.3 contains the interim data required to calculate the asymmetry

coefficientfortheportfolioconsistingoftenshortstraddles.Thisportfoliowascreatedon July 21, 2009 (all options expire onAugust 21, 2009; the risk-freerateis1%;thequantityofeachoptionisxi=1).Forexample,thepriceofEDstock,providedβ=0.23thatandthattheindexrisesby10%(δ=0.1),is37.92·(1+0.23 · 0.1)=$38.79. Substituting this value into the Black-Scholes formula(instead of the current stock price) gives us the prices of call and put options($1.89and$3.06,respectively).Havingcomputedthevaluesofalloptionsinasimilar way, we sum them up to obtainP(Ai(I,δ+)) andP(Ai(I,δ–)). The table

Page 196: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

showsthat if the indexrises, theportfoliowillbeworth$46.66,and if it falls,$31.46.Substitutingthisdataintoequation3.2.7andtakingintoaccountthatonthedateoftheportfoliocreationtheS&P500was954.58,wecancalculatetheasymmetrycoefficient:Asym=(46.66–31.46)/(2·954.58·0.1)=0.08.

Table3.2.3.Datarequiredtocalculatetheasymmetrycoefficientfortheoptionportfolio.

3.2.4.LossProbabilityAs it follows from the name, the loss probability indicator reflects the

probability that the portfolio will yield a loss. For a portfolio that containsoptions, the probability of this negative outcome can be estimated only by asimulationsimilartotheMonte-Carlo(asdescribedearlierforVaRcalculations).Toapply thismethod,a randompriceshouldbegeneratedforeachunderlyingassetforapredefinedfuturemoment(forexample,at theexpirationdate).The

Page 197: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

pricesaregeneratedonthebasisofprobabilitydensityfunctions(selectedbythesystemdeveloper)withparametersderivedfromhistoricaldataorpredeterminedby the system developer according to his personal consideration (scientificmethod).Then profits and losses of options are calculated for generated stockprices.Thesumofthesevaluesrepresentsanestimationoftheportfolioprofitorloss. This cycle represents one iteration. By repeatedly performing manyiterations,wecanobtainareliableestimateoftheportfoliolossprobability.Table 3.2.4 shows two iterations performed for the portfolio used in the

precedingexample(seeTable3.2.3).Thestockpricesweregeneratedusingthelognormaldistributionwithhistoricalvolatilityestimatedonthebasisofa120-day period (correlations of stock prices were taken into account). The firstiterationgeneratedthepriceof$31.04forEIXstock,whichimpliesaprofitof30+1.74–31.04=$0.70,whiletheseconditerationperformedforthesamestockincurredalossintheamountof$1.28.Forthewholeportfolio,thefirstiterationyielded a loss of $2.74, while the second one turned out to be profitable by$5.87.Table3.2.4.Anexampleoftwoiterationsperformedtoestimatetheprofit

orthelossoftheoptionsportfolio.

Afullsetofiterationsperformedforagivenportfoliorepresentsasimulation(inthecorrelationanalysisconsideredinthenextsection,wegenerated20,000iterations foreachsimulation).Theestimateof theportfolio lossprobability isobtainedbydividingthenumberofunprofitableiterationsbytheirtotalquantity.

Page 198: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

For example, if 7,420 out of 20,000 iterations used are unprofitable, the lossprobabilityis0.37(7,420/20,000).

3.3.InterrelationshipsBetweenRiskIndicatorsAn effective risk management system should involve a multitude of

alternative indicators based on different principles.Their application areamayinclude initial portfolio construction, assessment, and restructuring of theexisting portfolio and generation of stop-loss signals. Different risk indicatorsshouldbeuniqueand,asfaraspossible,interdependent(thatis,theyshouldbeuncorrelated).Thiswouldensurethateachofthemsupplementstheinformationcontained in the other indicators instead of duplicating it. In this section weexamine the interrelationships between the four risk indicators—VaR (thecommonlyusedindicator,appliedprimarilytolinearassets)andthreeindicatorsthat were developed specifically for assessing the risk of an options portfolio(indexdelta,asymmetrycoefficient,andlossprobability).

3.3.1. Method for Testing the Interrelationships Testing the extent ofinterrelationshipsbetween the four risk indicators is basedon thepresumptionthat if different indicators are unique (not duplicating each other), theperformancesofportfolioscreatedontheirbasisshouldbeuncorrelated.Totestthe correlation between the risk indicators, we used the database containingprices of options and their underlying assets from January 2003 until August2009.For each expiration date,we created 60 series of portfolios (each serieswascomposedof1,000portfolios)correspondingtodifferenttimeintervalsleftuntil the expiration. The most distant series was set up 60 days before theexpiration,thenextone59daysbeforeit,andsoon,rightuptothelastseries.Thus, each number-of-days-to-expiration was represented by 1,000 portfolios,whichgives60,000portfoliosforeachexpirationday.Each portfolio consisted of ten short straddles relating to stocks that were

randomlyselectedfromtheS&P500index.Eachstraddlewasconstructedusingthe strike closest to the current stock price. The quantity of optionscorresponding to each stockwas determined as xi = 10000 /Ai, where 10000represents theequivalentof thecapitalallocated toeachstraddle,andAi is thestockprice.Within each series the values of the four risk indicatorswere calculated for

each of the 1,000 portfolios. Subsequently, the best portfoliowas selected foreachindicator(thereby,4portfolioswerechosenfromeveryseries).Thereturnsoftheselectedportfolioswererecordedontheexpirationdate.Thereturnswere

Page 199: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

expressed in percentage terms and normalized by the time spent in a position(fromportfoliocreationuntiltheexpirationdate).

3.3.2.CorrelationAnalysisAs expected, the returns of portfolios selected on the basis of the four risk

indicators were interrelated to a certain extent. However, apart from a singleexception, the correlations turned out to be relatively low—in five of the sixcases thedeterminationcoefficient (squaredcorrelationcoefficient)waswithintherangeof0.3to0.4(seeFigure3.3.1).Thisimpliesthatinformationcontainedin our risk indicators is duplicated by only 30% to 40%. Therefore, theintroductionofanadditionalindicatortotheriskevaluationsystemthatisbasedon a single criterion can enrich this system with about 60% to 70% of newinformation.Theexceptionwasrepresentedbyonepairofindicators—VaRandlossprobability.Theirhighcorrelationcanbeinterpretedasanindicationofthesimilarity of the basic ideas underlying these indicators. Therefore, theirsimultaneous application is inexpedient because it will not add a sufficientvolumeofnewinformationtothewholeriskmanagementsystem.

Page 200: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure3.3.1.Correlationofreturnsofportfoliosselectedonthebasisofthefourriskindicators.Eachchartshowsthepairofindicatorsandthe

correspondingdeterminationcoefficient.

Letusconsiderthefollowingissue.Canthedegreeofcorrelationbetweenriskindicatorsvarydependingoncertainfactors?Twofactorsshouldbeanalyzedinthefirstplace:thetimeintervalfromthemomentofportfoliocreationuntiltheoptions expiration date and the market volatility at the moment of portfoliocreation.Withinoneday,theextentoftheinterdependencebetweentheriskindicators

can bemeasured by the variance of returns of the four portfolios selected bythese indicators on that day. The higher the variance, the lower the

Page 201: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

interrelationship between the risk indicators. If the indicators are perfectlycorrelated,eachofthemchoosesthesameportfolio,inwhichcasethevarianceiszero.Figure 3.3.2 shows the inverse nonlinear relationship between variance and

thetimeintervalleftuntiltheexpiration.Thismeansthatclosetotheexpirationdate, risk indicators areweaklycorrelatedand,hence, allof them (or, at least,someofthem)carryaconsiderableloadofadditionalinformation.Ontheotherhand,thevarianceofreturnsoftheportfolioscreatedlongbeforetheexpirationis rather lowwhichmeans that risk indicators are strongly interrelated duringthis period (hence, the information contained in these indicators overlapssignificantly).

Figure3.3.2.Relationshipbetweenthevarianceofreturnsofportfoliosselectedonthebasisofthefourriskindicatorsandthenumberofdayslefttooptionsexpiration.Highervariancepointstolowercorrelationofrisk

indicators.Dotsdenoteseparatevariancevalues;diamondsdenoteaveragevalues.

Market volatility also influences the interrelationships between the riskindicators,thoughthiseffectismuchstrongershortlybeforetheexpirationthanfurther away from this date. Thus, for portfolios created two days before theexpiration, the correlation coefficient between variance and volatility was r =0.62forhistoricalvolatilityandr=0.68forimpliedvolatility(seeFigure3.3.3).Yet,forportfolioscreated60daysbeforeexpiration,thecorrelationcoefficientsweremuchlower(r=0.24andr=0.28,respectively).Theseresultsindicatethatduringvolatileperiods,risk indicatorscontainadditional information,provided

Page 202: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

thattheportfolioisformedofoptionswithacloseexpirationdate.Ontheotherhand, under calm market conditions, different risk indicators carry lessnonduplicatinginformation(regardlessofthetimelefttooptionsexpiration).

Figure3.3.3.Relationshipbetweenthevarianceofreturnsofportfoliosselectedonthebasisoffourriskindicatorsandmarketvolatility(historicalandimplied).Thefigureshowsonlyportfolioscreatedtwodaysbefore

optionsexpiration.

3.4. Establishing the RiskManagement System: Challenges andCompromisesThesetofriskindicatorsdescribedinthischapterrepresentsanexampleofan

evaluation tool that can be used to develop a multicriteria risk managementsystem.These four indicators by nomeans exhaust potential opportunities forcreatingadditionalriskforecastinginstruments.Theeffortsinthisdirectionarecontinuingbyboththeoreticiansandpractitioners,whichwillundoubtedlyleadtothedevelopmentofmanyusefulinstrumentsallowingforaversatileanalysisof potential risks threatening option portfolios. The developers of automatedtradingsystemsparticipateactivelyinthiscreativeprocessofconstructingnewandelaboratingexistingriskmanagementtools.Theever-wideningspectrumofavailablevaluationalgorithms turns the selectionof appropriate indicators thatcorrespondtospecificfeaturesofthetradingstrategyunderdevelopmentintoa

Page 203: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

difficultchallenge.This task is further complicated by the fact that the effectiveness of any

particularriskindicatormayvarydependingonmanyfactors.Thisfeaturewasclearlydemonstratedbyanexampleoftheindexdelta,oneofthemostuniversalindicators that is suitable forassessing the riskofmostoptionsportfolios.Thepredicting power of the index delta was shown to change depending on thetimingoftheriskevaluation(relativetotheexpirationdate),onthelengthoftheforecasting horizon, and on the magnitude of expected market fluctuations.Therefore,awiseapproachtoformingthesetofriskindicatorsforaparticulartradingstrategyconsistsofincludingamultitudeofthemintoariskmanagementsystemanddevelopingaswitchingmechanismthatallowsthemtobeturnedonand off (depending on the favorability of different factors prevailing at thatspecificmoment).With all that in mind, there is still a necessity to avoid the inclusion of

redundant items in the risk evaluation model. This is an important issue, forwhichacompromisesettlementisneeded.Aneffectiveriskmanagementsystemshould not involve too many indicators. Otherwise, this would overburdencalculations and lower the efficiency of the evaluation procedures.While theintroduction of any additional indicator into the existing risk managementsystemisbeingconsidered,theiruniquenessshouldbethoroughlyestimated.Allpotential candidatesmust carry really new information not contained in othergauges. Two of the four indicators analyzed in this chapter turned out toduplicateeachother:VaRand lossprobability.Hence,whencreatinga tradingstrategy,foundedontheprinciplesthataresimilartothoseusedinourexamples,the developer should include only one of them in the multicriteria riskmanagementsystem.The results of our study suggest that the number of indicators needed for

effective risk measuring may change depending on the timing of portfoliocreationandontheprevailingmarketconditions.Inparticular,themulticriteriaapproach to riskevaluationcouldbe themost appropriateonewhenportfoliosare formed close to the expiration date and when the market volatility isrelativelyhigh.Undertheseconditions,evaluationtoolsarelesscorrelatedand,hence, each of them introduces a substantial amount of additional informationinto the complex riskmanagement system.Undoubtedly, further researchwillreveal additional factors that influence the extent of interrelationshipsbetweendifferent risk indicators and determine the necessity for introducing additionalgauges.

Page 204: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Chapter 4. Capital Allocation and PortfolioConstruction

Regardlessofthetypeoffinancialinstrumentsusedintheinvestmentprocess—futures, stocks, currencies, or options—capital management represents animportantandcomplexprocess.Itssignificanceandinfluenceontradingresultsis hard to overestimate. The general system of capital management can beviewedattwolevels.The first level represents the distribution of funds among risk-free money

marketinstrumentsandtheriskyassets.Theprinciplesofcreatingthefirstlevelof a capital management system do not depend on the trading instrumentsinvolved and are universal for both options and stock portfolios. There is amultitudeofpublicationson thatsubject.Oneof themostusefulandcompletehandbooks on developing the first level of a capital management system is abookbyRalphVince(Vince,2007).Wewillnotdiscussthedetailsof thefirstlevelhere.Thesecond levelof thecapitalmanagementsystemrepresents theallocation

of funds assigned at the first level of the capital management system amongseparateriskyassets.Thisresultsintheconstructionofacertainportfolio.Theprinciples of the second level of capitalmanagement are specific for differentfinancialinstruments.Therefore,thedevelopmentofacapitalallocationsystemrequiresconsiderationofmanypeculiaritiesthatarespecifictooptions.Thisisthetopicofthischapter.

4.1.ClassicalPortfolioTheoryandItsApplicabilitytoOptionsWe begin our discussion of the capital allocation procedures with a brief

overviewoftheclassicalportfoliotheory.Itwillbeshownthatoptionportfoliocannot be constructed using the basic form of this fundamental theory.At thesametime,itsuniversalprincipleofbalancingriskandreturnisapplicabletoallinvestmentassets,includingoptions.

4.1.1.ClassicalApproachtoPortfolioConstructionTheproblemofoptimalcapitalallocationintheprocessofportfolioconstructionarises,sinceinvestmentin risky assets requires observing the balance between expected return andforecast risks.Capital allocation among different investment assetsmay lowerthe total riskwithout entailing a significant return decrease. Risk reduction is

Page 205: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

possiblebecausereturnsofseparateassetsmaybeuncorrelatedormayhavelowcorrelation.Negativecorrelationsoffer evenmorepossibilitiesof lowering therisk.Besides,ifshortpositionsareallowed,correlatedassetscanalsobeusedtocontrol the risks (longpositionsareopened inoneof thecorrelatedassets; theshortposition, inanotherone).Althoughdiversificationachievedbyallocatingcapitalamongdifferentassetsinevitablyleadstoacertaindecreaseinexpectedreturn(ascomparedtoasingleassetwiththehighestexpectedreturn),inmostcasesthiseffectisovercompensatedbyadisproportionallygreaterreductionofrisk.Capital allocation represents a probabilistic problem. In the process of

portfolio construction, the investor strives to adapt it to future conditions thathavenotbeenrealizedyetandthatcanbedescribedonlyintermsofprobability.Inmostcasesthefuturepricedynamicsareassumedtofollowthesamepatternsthatwereobserved in thepast.Even if this assumption is notmade explicitly,probabilitiesoffuturepricemovementsareestimatedonthebasisofpastpricemovements or using parameters that were derived from historical time series.This approach was widely criticized, with numerous examples of events thatwere realized in spite of their negligibly small probabilities (estimated on thebasis of past statistics) presented to support this criticism.Nevertheless, apartfromhistoricaltimeseries,therearenootherreliableinformationsourcesatourdisposal for producing probabilistic forecasts (except various expert estimates,which aremostly subjective and hardly formalizable). This problem is solvedpartially by applying enhanced mathematical models to the construction ofprobabilitydistributions. Inparticular,significanteffortsaremade tosubstitutelognormaldistributionwithothersdescribingthedynamicsofmarketreturnsandprobabilitiesofrareeventsmoreprecisely.ModernportfoliotheoryisbasedontheclassicalworkbyHarryMarkowitz.

Construction of Markowitz’s optimal portfolio is based on the estimations ofexpected return and risk.All possible variants of capital allocation among thegiven setof riskyassets are considered.Portfolioswith the lowest risk for thegivenreturnandthehighestreturnforthegivenlevelofriskaredeemedtobeoptimal.Thecompletesetofoptimalportfoliosformsanefficientfrontier.Theselection of a specific portfolio at this frontier is determined by individualpreferences of each investor (their risk aversion, forms, and positioning ofindifferencecurves).For plain assets with linear payoff functions (stocks, index, or commodity

futures),theestimationofreturnandriskisstraightforward.Theexpectedreturnof each underlying asset can be estimated on the basis of the risk-free rate,

Page 206: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

marketpremium,andbeta (CAPMmodel).Sincereturnsofseparateassetsareadditive, the portfolio return is calculated as the weighted sum of separatereturns(weightsareequaltosharesofcapitalallocatedtoeachasset).Theriskofeachunderlyingassetisexpressedthroughthestandarddeviationofitspricereturns calculated on the basis of historical time series. The portfolio risk iscalculated analyticallyusing individual standarddeviationsof each asset, theirweights,andthecovariancematrix.

4.1.2. SpecificFeatures ofOptionPortfoliosClassical portfolio theory in itsbasic form is not applicable to option portfolios. Expected returns of optionscannot be estimated on the basis of CAPM or other similar methods. Thisrequires the application of special valuation models. Many of the criteriadescribed by Izraylevich and Tsudikman (2010) can be used as indicatorsexpressingexpectedreturnandriskindirectly.The payoff function of options is not linear. Therefore, the distribution of

option returns is not normal and cannot be described properly with theprobabilitydensityfunctionsoflognormalandmoststandarddistributions.Theextent of deviation from the normal distribution in this case is incomparablygreaterrelativetodeviationsthatareusuallyobservedforlinearassets.Althoughin the latter case these deviations are negligible (although many authorsconvincinglydemonstrate that theycannotbeneglected, lognormaldistributionis stillwidelyused for linearassets), theydocause significantproblemswhenlognormal distribution is applied to options (though the probability densityfunctionofthisdistributionisstillusedtodescribeunderlyingassetsreturnsinoptionspricingmodels).The risk of the option cannot be estimated with the standard deviation (or

dispersion) of its price as is done in the classical portfolio theory. Using thestandard deviation of the underlying asset price does not solve this problem,sinceitdoesnotaccountforspecificrisksrelatingtoaparticularoptioncontract.It is generally accepted to describe risks associated with options in terms ofspecialcharacteristicscalled“theGreeks.”The riskof theoptionpricechangeoccurring due to the change in the price of its underlying asset is expressedthroughdelta.Thischaracteristicisnotadditive—itcannotbecalculatedfortheportfoliobysummingweighteddeltasofoptionsrelatedtodifferentunderlyingassets. However, using the index delta concept described in Chapter 3, “RiskManagement,”cansolvethisproblem.Another peculiarity of optionportfolios relates to the periodof options life.

Since, unlike with many other assets, the lifetime of any option contract is

Page 207: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

limitedby the expirationdate, thehistorical datanecessary to analyze agivenoptionarerathershort.Besides,theforecasthorizonislimitedaswell.Whereasforplainassets theexpectedreturn isusuallyestimatedonaone-yearhorizon,foroptionstheforecasthorizoncannotexceedtheexpirationdate.Atthesametime, the limitation of options life has its own advantages. In particular, thevalidityoffairvalueestimatehasanunambiguousverificationdate(asopposedtoeternalassetsforwhichthedateofconvergencebetweenestimatedfairvalueandmarketpricecannotbedeterminedobjectively).After the share of each asset is determined, capital allocation within the

portfolio consisting of linear assets becomes a trivial task (in contrast to theoptions portfolio). The only requirement to be observed is that the totalinvestmentinallassetsisequaltotheamountoffundsallocatedatthefirstlevelofthecapitalmanagementsystem.Whenoptionportfoliosarebeingconstructed,the funds assigned at the first level of the capitalmanagement system are notinvestedinfull.Openingtradingpositionsinsomeoptioncombinationsrequiresputtinginmoney(theyarereferredtoas“debitcombinations”),otherpositionsresultincapitalinflows(“creditcombinations”),andbothmayrequireblockingacertainamountoffundsatthetradingaccount(marginrequirements).Margin requirements are the amountof capital necessary tomaintainoption

positions.Theyareoftenconsideredasanequivalentoftheinvestmentvolume.As a matter of fact, this is not entirely true, since margin requirements maychangeintime(dependingonchangingmarketpricesoftheunderlyingassets).Furthermore, there is no standardized algorithm to determine marginrequirements.Their calculationmethods vary frombroker to broker, and eventhe same broker can change margin requirements depending on marketconditions.The amount of funds assigned at the first level of the capital management

systemmaybeusedonlyasa referencepointwhencapital isallocatedamongportfolioelements.Oneshouldaimattwoobjectivesconcurrently:Firstly,totalmargin requirements should not at any point in time exceed this referenceamount, and, secondly, assigned capital should be sufficient to fulfill futureobligationsarisingwhenoptionsareexecutedorexpired.

4.2.PrinciplesofOptionPortfolioConstructionIn this section we discuss two technical aspects of the capital allocation

process. First we examine the number of indicators the developer uses in theprocessofportfolioconstruction.Nextweconsider twoalternativeapproachestotheevaluationofoptionportfoliosforcapitalallocationpurposes.

Page 208: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

4.2.1. Dimensionality of the Evaluation System In the classical portfoliotheory capital is allocated on the basis of two indicators: expected return andrisk.Wesuggestconsideringthistwo-dimensionalsystemasaspecialcaseofamoregeneralapproachnotlimitedtoaspecificnumberofindicators.Theremaybemoreorfewerthantwoindicators.One-DimensionalSystem

Under the one-dimensional system funds assigned at the first level of thecapital management system are allocated among portfolio elementsproportionallytovaluesofacertainindicator.Suchasystemmayappeartobeincomplete, since it is limited to only one indicator—either return or riskestimate. However, for options this approach may be justified, since manyindicators used for their evaluation combine forecasts of both return and risk.Thiscanbeillustratedbytheexampleofexpectedprofitcalculatedonthebasisoflognormaldistribution.Itiscalculatedbyintegratingthepayofffunctionofanoption(orcombinationofseveraloptions)overtheprobabilitydensityfunctionof lognormal (or another) distribution. Two parameters, mean and standarddeviation, are necessary to construct the density function. Therefore, thiscriterion combines forecasts of both return (first parameter) and risk (secondparameter).Certaintradingstrategiesmayuseaone-dimensionalcapitalallocationsystem

thatisnotdirectlyrelatedtotheevaluationofeitherreturnorrisk.Forexample,quantities of different combinations in the portfolio may be determineddependingontheamountofpremiumsreceivedorpaidupontheircreation.Thisapproachmaybeappropriateifthetradingstrategyisbasedontheideathatallshort positions should generate the same amount of premium and all longpositions should be equal in price. If the premium of one combination is, forexample,$600and thatof theother is$400, the idea is realizedbybuying(orselling)twocontractsofthefirstcombinationsandthreecontractsofthesecondcombination. This method allows opening fewer positions for combinationsconsistingofmoreexpensive(andhence,inmostcases,morerisky)options.Tosomeextentthisenablesthestrategydevelopertobalanceportfoliopositionsintermsofrisk.A one-dimensional system that does not hinge on return and risk estimates

may also be based on the principle of stock-equivalency of options positions.Thismethodofcapitalallocationamongcombinationsincludedintheportfolioisanalogoustothemethodappliedforlinearassets(whentheamountoffundsinvested in each asset is equivalent to position volumes). When stock-

Page 209: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

equivalency of option positions is used for capital allocation, the volume ofpositionsopenedforeachunderlyingassetisinverselyproportionaltoitsprice.Suppose that long positions with the same stock-equivalency value should beestablishedfortwooptions.Thismeansthatwhenoptionsexpire,theamountofinvestmentinbothunderlyingassetsmustbeequal(providedthattheyexpirein-the-money).Assumethatthestrikepricesofthesetwooptionsare$50and$40.Thenwecanopen20contracts(eachoneconsistingof100options)forthefirstoptionand25contractsforthesecondone.Inthisexampleweusedareferenceamount of $100,000 for both combinations (which is the stock-equivalentamountthatwewouldneedtoinvestineachunderlyingassetwhenoptionsareexecuted).Theabsolutevalueofthisreferenceamountmaybedifferentandnotnecessarilythesameforallportfolioelements.Thetotalamountrequiredtobeinvestedatoptionsexpirationshouldnotexceedthecapitalallocatedtothegivenposition, and the relative ratio of all positions should correspond to the targetparametersofthetradingstrategy.Itshouldbetakenintoaccountthatusingthismethodiscomplicatedforcombinationswithdifferentquantitiesofcallandputoptions.Sinceitcannotbeknowninadvancewhichoftheoptions(callorput)willexpirein-the-money,thestock-equivalencyamountcannotbedeterminedatthe moment of position opening. Besides, it is preferable to have coincidingstrikepricesofputandcalloptions.Failuretocomplywiththisconditioncausesuncertainty when choosing the strike price to calculate the stock-equivalencyvalue. The calculation of aweighted-average strike price (calculated using allstrikes included in the combination) or application of the current price of theunderlyingassetmaybeacompromisesolutiontothisproblem.MultidimensionalSystem

Themultidimensional evaluation system isbasedon twoormore indicatorsexpressing estimates of return and risk. The usual practice of portfolioconstruction, originating from the classical work by Markowitz, is based oncapitalallocationon thebasisof two indicators—expected returnandstandarddeviation. However, nothing prevents the strategy developer from introducingadditionalindicators,ifhehassufficientreasonstobelievethatthiswillimprovethecapitalallocationsystemandthatpotentialadvantagesoutweighthecostsofemployingadditionalcomputationalresources.Whenseveralindicatorsareusedforportfolioconstruction,theParetomethod

may be applied in order to identify the best alternative for capital allocation.However,inmostcasesthisresultsintheselectionofnumerousportfolios,eachof which represents an equally optimal method of capital allocation. Theproblemofselectingoneportfoliofromthesetofoptimalvariantsisdifficultto

Page 210: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

solve without making subjective judgments. Later we will discuss how toapproachthisproblem.The alternative approach to implementation of the multidimensional

evaluation system consists in using the convolution of several indicators. Thesum of values of the indicators represents an additive convolution. Differentweight coefficients may be applied for different indicators. The product ofindicatorsisamultiplicativeconvolution.Inthiscaseweightsareintroducedbyraising indicators to a certain power—the higher the power, the higher theimportanceofthecoefficient.Multiplicativeconvolutionisappropriateonlyfornonnegativevalues(otherwise,multiplyingtwonegativevalueswouldresultinpositiveconvolutionvalue).Whencalculating theconvolutionvalue, itshouldbe takenintoaccount that

differentindicatorscanbemeasuredindifferentunitsandhavedifferentscales.Thereareseveralmethodsofreducingsuchindicatorstoauniformmeasurementsystem.Inparticular, thenormalizationmethodcanbeusedfor thispurpose—thedifferencebetweentheindicatorvalueanditsmeandividedbythestandarddeviation.Analternativemethodconsistsindividingthedifferencebetweentheindicator value and its minimum by the difference between maximum andminimumvalues(inthiscasethecriterionvaluewillliewithintheintervalfromzero toone).Theformerof thesemethods ismoreappropriate for theadditiveconvolution;thelatter,forthemultiplicativeconvolution.

4.2.2.EvaluationLevelThe classical portfolio theory is based on characteristics of return and risk,

evaluatedfortheportfolioasasinglewhole.Thisapproach—wewillcallitthe“portfolio approach”—while being logical and highly reasonable, is still notexhaustive. There are many option strategies for which the capital allocationapproachbasedonthevaluationofseparateportfolioelements—wewillcall itthe“elementalapproach”—seemstobemoreappropriate.The undisputable advantage of the portfolio approach is the possibility of

takingintoaccountthecorrelationsbetweenseparateportfolioelements.Atthesametime,thisdoesnotmeanthattheelementalapproachdoesnotallowtakingassetcorrelations intoaccount. Inparticular, theaveragecorrelationcoefficientofagivenassetwitheachof theotherassets included in theportfoliomaybeused as one of the indicators involved in the capital allocation system.Nevertheless, we have to admit that accounting for correlations under theportfolioapproach ismoreproper fromthe technicalandmethodologicalpointofview.

Page 211: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Another advantage of the portfolio approach is that there is no need todetermineinadvancethefinalsetofassetstobeincludedintheportfolio.Theportfolio can potentially consist of all available assets, but its specificcompositionisdeterminedduringtheprocessofportfolioformation,whenassetswithzeroweightsareexcludedfromtheportfolio.Thus,thesubjectivejudgmentinselectingthequantityandthestructureofassetsintheportfolioisdiminishedto a great extent. Under the elemental approach all assets satisfying certainconditions(forexample,thevalueofanindicatormustexceedthepredeterminedthresholdvalue) are included in the portfolio.The selectionof such indicatorsand threshold values requires making decisions based largely on subjectiveestimates.Ontheotherhand,capitalallocationbasedontheelementalapproachmaybe

preferable and, for some trading strategies, the only possible method. In theprecedingsectionwedescribedtwoexamplesofcapitalallocationbasedontheone-dimensionalsystemof indicators thatarenot relateddirectly to returnandrisk estimates. In both cases the capital is allocated using the elementalapproach.Inthefirstexample,whencapitalisallocatedaccordingtotheamountofoptionpremiums,implementationoftheportfolioapproachisimpossiblebydefinition (since capital is allocated by premium amounts relating to eachspecificcombination).Theportfolioapproachisalso inapplicablewhencapitalisallocatedaccordingtotheprincipleofequivalencyofpositionsinunderlyingassets(sincethepositionvolumeisacharacteristicofeachseparateunderlyingasset).Certain valuation criteria thatmay be used as indicators for the purpose of

capital allocation are applicable only at the combination level (since theircalculation for the whole portfolio is impossible). For example, accuratecalculation of the “IV/HV ratio” for the whole portfolio is unfeasible, sincehistoricalvolatilityrelatestoaspecificunderlyingassetandimpliedvolatilityisa characteristic of a specific option contract. This problem can be solvedpartiallybysubstitutingIVandHVrelatingtoseparateoptionsandunderlyingassets,withmarket indexesorvaluesderivedfromtheseindexes.Inparticular,IV can be replaced byVIX (index estimating implied volatility of options onstocksincludedintheS&P500index),whereasHVcanbesubstitutedwiththehistoric volatility of the S&P 500 index. However, such substitutions willinevitably reduce the indicator accuracy,unless theportfolio structurematchesexactlytheemployedindexes.Manyindicatorsusedforcapitalallocationmaybeappliedforbothseparate

combinations and the whole portfolio. In these cases the choice between the

Page 212: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

elementalandtheportfolioapproachesisbasedonpeculiaritiesofeachspecifictradingstrategy.

4.3.IndicatorsUsedforCapitalAllocationAgreatvarietyofindicatorscanbedevelopedforcapitalallocationpurposes.

Althoughmostofsuchindicatorswillexpress,eitherdirectlyorindirectly,riskandreturncharacteristics, this isnotanindispensablecondition.Indicators thatarenotexplicitlyrelatedtotheestimationofriskandreturnmayturnouttobeusefulintheprocessofportfolioconstruction.

4.3.1. IndicatorsUnrelated toReturnandRiskEvaluation In section 4.2.1we discussed, in brief, indicators that are not related to return and riskevaluation.Herewedemonstratethemethodofportfolioconstructionusingtwooftheseindicatorsandshowthatoneofthemmaystill(indirectly)expressrisk.CapitalAllocationbyStock-Equivalency

In thecontextofcapitalallocation,weuse thenotionofequivalent to relatethe amount that will be required at the expiration date with the volume of acertain optionposition.Wedefine the “stock-equivalent of optionposition” astheamountofcapitalrequiredattheexpirationdateoratanyotherfuturedate,whenoptionsareexecuted.Forexample,thetradingstrategymayrequirethatattheexpirationdatetheequalamountofcapitalbeinvestedineachstock.To formalize the notion of equivalent, we designate by C a combination

consisting of different options on the same underlying asset. Assume that theportfolioiscreatedofmcombinations{C1,C2,...,Cm}.LetaibethequantityofcombinationCiincludedintheportfolio.IfUiisthepriceoftheunderlyingassetof combination Ci, then for this combination the equivalent is calculated asproductaiUi.LetMbethetotalequivalentoftheportfolio(thatis,theamountofcapital that will be required when all the options included in the portfolioexpire). The following equality must hold:

Thismeansthatthesumofequivalentsofallcombinationsisequaltothetotalportfolioequivalent.Let us consider the example of the trading strategy that uses the capital

allocationmethod requiring an equal amount of capital to be invested in eachunderlyingasset.SupposethatM=$1,000,000andthattheportfolioconsistsof20shortstraddles related tostocksbelonging to theS&P500 index(seeTable4.3.1).Eachstraddleisconstructedusingonecallandoneputoptionandstrikes

Page 213: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

thatarenearesttothecurrentstockprices.TheportfoliowascreatedonAugust28,2010,usingoptioncontractsexpiringonSeptember17,2010.

Table4.3.1.Capitalallocationamong20shortstraddlesaccordingtothestock-equivalencyandinversely-to-the-premiummethods.

The equality of equivalents means that akUk = ajUj for each pair ofcombinations k and j. The following formula follows from equation 4.3.1:

Table4.3.1showsthepositionvolumeforeachstraddlecorrespondingtothecapital allocation according to the equal equivalent principle. These volumeswere calculated subject to satisfying the following two requirements of thestrategy:(1)allcombinationsmusthavethesamestock-equivalent,and(2)the

Page 214: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

total equivalent of the portfolio equals $1,000,000. For example, for DELLstock, knowing thatm = 20 and the stock price isU7 = 11.75, the number ofstraddlesiscalculatedasa7=1,000,000/(20×11.75)=4,255.32.Forthesakeofsimplicity,weroundnumbersandignorelotsthatarecommonlyusedinrealtrading.AllocatingCapitalInverselytothePremium

Allocatingcapitalusingthismethodmeansthatthepositionvolumeforeachoption combination is determined on the basis of its premium amount. Let usconsider the trading strategy that uses the capital allocationmethod requiringtotalpremiumsreceivedfromsellingallcombinations tobeequal.Thismeansthatthehigherthepremiumofagivencombination,theloweritsquantityintheportfolio(thatiswhythisapproachisreferredtoasinverse).LetpiandaibethepremiumandthequantityofcombinationCi.Theequality

ofpremiumsintheportfolioajpj=akpkmeansthatnumbers{a1,a2,...,am}areinversely proportional to premiums {p1, p2, ..., pm}. Formally, the quantity ofeach combination in the portfolio is determined as

Thismethodofcapitalallocationcanbeillustratedusingthesameportfolioofcombinationsasintheprecedingexample.InTable4.3.1thesumofstockprice-

to-premium ratios is . Combination premiums and theircorresponding quantities are shown in the table. For example, the number ofcombinations for AAPL stock, with the straddle premium p2 = $14.65, iscalculatedasa2=1,000,000/(14.65×349.25)=195.44.

ComparisonoftheTwoCapitalAllocationMethods

Both capital allocationmethods have produced proximate results (seeTable4.3.1).Ontheonehand,themoreexpensivethestock,thelowerthenumberofoptions tobeexercised inorder togenerate thegivenstockequivalent.On theother hand, the option premium value usually correlates with the stock price,and, thus, for more expensive stocks fewer combinations should be sold toreceivethegivenpremiumamount.Althoughthenumberofcombinationsinportfolioscreatedonthebasisoftwo

different methods is close, it is not identical. This can be observed in Figure4.3.1,inwhicheachpointrepresentsoneofthe20combinationsincludedinthe

Page 215: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

portfolio.Thehorizontalaxisshowsthevolumesofpositionscorrespondingtothestock-equivalencymethodofcapitalallocation,and theverticalaxis showspositionvolumescalculatedonthebasisofpremiums.If theresultsof the twomethodswerethesame,allpointswouldliealongtheindicatedline.However,wecanseethatpointsarewellscatteredaroundit.

Figure4.3.1.Relationshipbetweenthevolumeofthepositioncorrespondingtothestock-equivalencymethodofcapitalallocation

(horizontalaxis)andthevolumeofthepositioncalculatedonthebasisofpremium(verticalaxis).Eachpointinthefigurerepresentsaspecificoption

combination.

Imperfectcorrelationbetween thepremiumand thestockprice is thereasonfor divergence between two capital allocation methods. The underlying assetprice is not the only factor influencing the option premium.One of themainfactors determining the option price is the extent of uncertainty regarding thefuturepriceofitsunderlyingasset(whichisusuallyexpressedthroughimpliedvolatility).Thatiswhythepremiumsoftwooptionsrelatingtodifferentstockswiththesamepricemaydiffer.Hence,otherthingsbeingequal,thecombinationwith a higher premium is fraught with higher risks and, thus, receives lesscapital.Thisreasoningallowscreatinganindicatorindirectlyexpressingtheextentof

combinationriskiness.WecanstatethatpointssituatedbelowthelineinFigure

Page 216: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

4.3.1 correspond to riskier combinations with a higher premium. This can beexpressed through the ratio of the quantity of combinations obtained usingformula4.3.2 to thecorrespondingquantityobtainedusingformula4.3.3.Thisresults in creation of the following risk indicator:

Thisformulapresentsriskastheproductoftheratioofthe i-thcombinationpremiumtothepriceofthei-thstockandtheaverageratioofthestockpricetothepremium.Thisindicatorhasaconvenientthreshold:Forriskiercombinations(relative to the whole portfolio) its value exceeds one, whereas for less riskycombinationsitislessthanone.Iftheriskinessofthecombinationisclosetotheaverageriskinessoftheportfolio,thisindicatorconvergestoone.Inthepreviousexamplestheaverageratiooftheunderlyingassetpricetothepremiumis17.5.UsingdatafromTable4.3.1,wecanshowthatforAAstockriskiness=(0.74/10.01)×17.5=1.28,andforIBMstockriskiness=0.77.Thisindicatesthattheformercombinationisriskierthanthelatter(andriskierthantheportfolio).The risk indicator calculated using equation 4.3.4 may be used for capital

allocation,whichensures that,apartfromthepremiumandthestockprice, theriskinessofthecombinationwillalsobetakenintoaccount.However,wemustoutlinethatwhilethisindicatorisbasedontherelativeexpensivenessofoptions,it does not evaluate its appropriateness (from the standpoint of historicalvolatility or anticipated events). Therefore, it cannot be viewed as acomprehensiveandall-embracingriskindicatorandshouldratherbeusedasanauxiliaryinstrumentofcapitalallocation.

4.3.2. Indicators Related to Return and Risk Evaluation There are manydifferentindicatorsexpressingestimatesoffuturereturnandriskinavarietyofforms.Herewelimitourdiscussiontotwoindicatorsofreturn(expectedprofitandprofitprobability)andthreeindicatorsofrisk(delta,asymmetrycoefficient,andVaR).Intheprevioussectionweestimatedthequantityofeachcombinationinthe

portfolio on the basis of the parameters of a specific combination or itsunderlyingasset.Forindicatorsrelatedtoevaluationofreturnandrisk,amoregeneral approach, based on the calculation of weights for all combinations,seemstobemoreappropriate.Toapplysuchanapproach,weneedtodefineaweight function with specified indicator(s) used as argument(s). The value ofthisfunctionistheweightofeachcombinationintheportfolio.

Page 217: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Theweightfunctioncanbeappliedtotwotypesofindicators,whichwewillcall“positive”and“negative.”Thehighvaluesofpositiveindicatorscorrespondtomoreattractivecombinations;thelowvalues,tolessattractiveones.Positiveindicatorsincludeexpectedprofitandprofitprobability,aswellasallindicatorsrelated to forecasting return potential. The high values of negative indicatorscorrespond to a less attractive combination.Most indicators that estimate riskbelong to the negative type. For example, the VaR estimating the amount ofpotential loss has higher values for riskier and, hence, less attractivecombinations.Foragivenfunctionφ(C)theweightofthei-thcombinationintheportfoliois

determinedas

andmustsatisfytwoconditions:wi≥0and .

Themethod of calculating the quantity of combinationsCi in the portfoliodepends on the approach used at the first level of the capital managementsystem.Ifcapitalassignedfor investment in theoptionportfolio is theamountthatwillberequiredinthefuture,whenoptionsareexercised,thenthiscapitalrepresents the equivalent of portfolio M (see explanations in the precedingsection). In this case the quantity of the combinations is calculated as

orwiththeconstantμ:

IfcapitalFassignedfortheinvestmentintheoptionportfoliorepresentstheamount of investment that is required at themoment of portfolio creation (forexample, the total amount of margin requirements), then the quantity of

combinationCiis

In the following sections we will use the approach based on the portfolioequivalentprinciple(seeequation4.3.7).ExpectedProfitandProfitProbability

Page 218: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Thesetwoindicators,calculatedonthebasisofthegivendistribution(forthesake of simplicity, we will use lognormal distribution in the followingexamples), represent evaluation criteria that are commonly used for optioncombinations.Detailed description and calculation algorithms of these criteriacanbefoundinthebookbyIzraylevichandTsudikman(2010).Bothindicatorsarepositive as their highervalues correspond tomore attractive combinations.Weightfunctionφ(C)forthei-thcombinationisequalsimplytothevalueoftheindicator corresponding to this combination. Table 4.3.2 shows the values ofboth indicators and weights calculated using equation 4.3.5. Examples in thetableinvolvethesameoptioncombinationsasinsection4.3.1.

Table4.3.2.Capitalallocationamong20shortstraddlesusingfiveindicatorsexpressingreturnandriskestimates.

Page 219: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Thequantities of all combinations shown in the tablewere calculatedusingformula4.3.7.For example,whencapital is allocatedby the “expectedprofit”indicator,theweightandthequantityofthecombinationrelatingtoCATstockare estimated as follows. Using stock prices from Table 4.3.1, we calculate

. It follows from Table 4.3.2 that . If M =1,000,000,thenμ=1,000,000×0.1196/11.338=10,550.ConsideringthatforCATstockφ(C4)=0.001,weobtain theweightw4=0.001 /0.1196=0.0085andthequantityofcombinationa4=10,550×0.0085=89.78.Whencapitalisallocated by the “profit probability” indicator, the same algorithm is used to

Page 220: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

calculate the weight and the quantity of this combination (w4 = 0.0472, a4 =580.01).Delta,Asymmetry,andVaR

Deltaexpressesthesensitivityoftheoptionpricetochangesintheunderlyingasset price.For options relating to the sameunderlying asset, delta is additive(thedeltaof the combination is equal to the sumofdeltasof separateoptionsincludedinthiscombination).Thedeltaofthecalloptionvariesfrom0to1andtheputoptiondeltavariesfrom–1 to0.Accordingly, thedeltaofonestraddlemay range from –1 to 1. Since the portfolio considered in our examples (seeTable 4.3.2) consists of short straddles, the neutrality of combinations to theunderlyingassetdynamics isa favorable factor.Thismeans that thecloser thecombination delta to zero, the lower the risk of the position. Hence, for thecapital allocation purpose the absolute value of delta should be treated as anegative indicator. The weight function can be defined in the following way:φ(C)=1–|δ(C)|,whereδ(C)isthedeltaofcombinationC.Asymmetrycoefficientisanothernegativeindicator.Forasimplecombination,

likestraddleorstrangle,itrepresentsthenormalizedabsolutedifferencebetween

thepremiumsofcalloptioncandthoseofputoptionp:The idea underlying this indicator is the following.Most trading strategies

based on shorting of option combinations rely on the expectation that thepremiumreceivedasaresultofoptionssellingwillexceedtheliabilitiesarising(at the future expiration date) due to underlying asset price movements. Thepremiumconsistsoftwocomponents:timeandintrinsicvalues.Atthemomentwhen a position is entered, the future liability of the option seller equals theintrinsic value (based on an unrealistic, but practically the only possible,assumption that the underlying asset price will not change). Accordingly, theprofitpotentialishigherwhentheintrinsicvalueislowerandthetimevalueishigher.Thisconditionissatisfiedwhenthestraddlestrikeapproachesthecurrentunderlyingassetprice as closely aspossible.Thecloser the strikeprice to thecurrent price, the more symmetrical the combination. Since high asymmetrycoefficientvaluesareundesirableforshortstraddles,theweightfunctioncanbedefinedasφ(C)=1–A(C).Value-at-Risk(VaR)istheamountoflossthat,withacertainprobability,will

not be exceeded (we will use a 95% probability). In our example (see Table4.3.2) we use the Monte-Carlo simulation to calculate VaR (C) of optioncombinations. Twenty-thousand paths of future underlying asset movements

Page 221: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

were simulated (assuming that the underlying asset price is distributedlognormally) for each stock. By substituting the simulated outcomes into thecombinationpayofffunction,wehaveobtained20,000payoffvariants.Thenwediscarded5%of theworst values and selected from the remainingvariants analternativewiththelowestpayoff.Subtractingtheinitialcombinationpremiumfrom this value gives an estimated VaR(C) for one combination. Since VaRexpresses risk (combinations with lower VaR values are preferable), capitalallocation among combinations should be done inversely proportional to thisindicator.Theweightfunctioncanbedefinedasφ(C)=1/VaR(C).Table4.3.2showsweight functionvaluesandcorrespondingweights for the

threeriskindicators.Italsoshowsvariationcoefficients(theratioofthestandarddeviation to the mean) of weights calculated for each stock and for eachindicator.Amongstocks,thehighestvariationcoefficientisobservedforORCL(0.93).Thismeansthatamongallthe20underlyingassets,theamountofcapitalinvestedinORCLcombinationdependstothegreatestextentontheselectionofa particular indicator used for capital allocation. Indeed, it follows fromTable4.3.2 that if capital is allocated by expected profit, the share ofORCL in theportfolio is less than 2%. However, if VaR is used to allocate capital, ORCLmakesup10%oftheportfolio.ThelowestvariationcoefficientwasdetectedforMSFT stock (0.17). This means that, relative to other underlying assets, theamount of capital invested in MSFT hardly depends on the selection of aparticularindicator.Whicheverindicatorisusedtoallocatecapital,theshareofMSFTintheportfoliowillvarywithinaverynarrowrange(from5%to7%).Thecomparisonofvariationcoefficientscalculatedforweightscorresponding

toeachindicatorhasalsogiveninterestingresults.Weightsobtainedonthebasisof the profit probability indicator were the least variable (the variationcoefficient is 0.07,which is far lower than the coefficients obtained for otherindicators). Thismeans that when this indicator is used for capital allocation,each stock receives approximately the same capital share. Hence, profitprobabilityishardlyapplicableforcapitalallocation,atleast,inthoseconditionsandforthetradingstrategythatweusedinourexample(however,thisdoesnotmeanthatitcannotdemonstratehigheffectivenessinothercircumstances).Deltarankedsecond in termsofweightvariability (0.13),andasymmetrycoefficientoccupies the third position (0.18). VaR and expected profit have the mostvariable weights, leading by a huge margin (0.74 and 0.8, respectively). It isinterestingthatoneofthetwoindicatorscharacterizingreturn(profitprobability)allocates capitalmost evenly (it has the lowest value of variation coefficient),whereas application of another return indicator (expected return) leads to the

Page 222: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

mostvariablecapitalallocationscenario.

4.4.One-DimensionalSystemofCapitalAllocationAllocationofcapitalusingaone-dimensionalsystemisrelativelysimple.This

allowsthestrategydevelopertoexamineindetaildifferentfactorsthatinfluenceportfolio under construction. Here we demonstrate the effects of three suchfactors.Nextwedescribe themethodologyformeasuring thedegreeofcapitalconcentration within option portfolios and provide several approaches thatenablethemanipulationofthecapitalconcentrationdependingonthestrategy-specificrequirements.

4.4.1.FactorsInfluencingCapitalAllocationInthissectionweinvestigatetheinfluence of various factors on the capital allocation process. While in theprevious sections we merely demonstrated the technique of portfolioconstruction using a limited and predetermined number of combinations, hereweconsiderthelong-termfunctioningofacomprehensivetradingsystem.The procedure of portfolio construction is simulated for the duration of an

eight-year historical period (2002–2010) using the database of stocks andoptions prices. Stocks included in the S&P 500 index are used as underlyingassets for option combinations.Daily close prices are used for stocks and lastbids,andasksforoptions(theaverageofthespreadisconsideredtobethelastoptionprice).Moving through market history, on each trading day a set of option

combinations is created for each stock by applying the following rules. Wedeterminethethreenearestoptionexpirationdates.Foreachexpirationdatealloptionsonagivenstockwithstrikesdistantfromthecurrentstockpricebynomore than 10% are selected. These contracts are used to generate all possiblealternatives of short “straddle” and “strangle” combinations (all combinationsconsistofequalamountsofputandcalloptions;onlycombinationsforwhichtheputstrikeislessthanthecallstrikeareallowed).As a result, on each successive day a wide set of option combinations is

obtainedforeachofthethreenearestexpirationdates.Forallcombinationswecalculate the expected profit on the basis of lognormal distribution.Combinations,forwhichthiscriterionexceeds1%oftheinvestmentamount,areselected. The portfolio is constructed by allocating $100,000 (the volume offunds assigned at the first level of capital management system) among thesecombinations.Thecapitalisallocatedbyoneofthesevenindicatorsdescribedintheprevioussections:

Page 223: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

1.Stock-equivalencyofoptionpositions2.Inverseproportionalitytothepremium3.Expectedprofit4.Profitprobability5.Delta6.Asymmetrycoefficient7.VaR

Profitorlossofeachportfolioisrecordedattheexpirationdate.Comparative analysis of these indicators will focus on the following issue.

Whether and to what extent do portfolios created on the basis of variousindicators differ fromeachother?Toput it inmoreprecise terms,weneed todeterminetheextenttowhichtheportfolioprofitabilitydependsontheindicatorusedtoallocatecapitalamongportfolioelements.In the preceding section we used variation coefficient of combinations’

weightstoassessthedifferenceintheinternalstructureofportfoliosconstructedusing different indicators. Since in the examples discussed in the precedingsectionallweightswerepositive,usingthevariationcoefficienthasnotresultedinanyproblems.However, in this sectionwecompare thevariousmethodsofcapitalallocationbyportfolioreturns,whichmaybeeitherpositive(ifprofitisrealized)ornegative(if loss is incurred).Accordingly, thevariationcoefficient—which is the ratio of the standard deviation (always positive) to the mean(positiveornegative)—mayalsobenegative.Hence,itsapplicationtoevaluatevariability of portfolio returns is impossible. This problemmay be solved byexpressing return variability through standard deviation not normalized by themean.Whatisthisnormalizationrejectionfraughtwith?Itiswellknownfrommany

practical studies that the standard deviation is positively correlated with themean.Insuchcases,trends(oranyotherpatterns)observableinthedynamicsofstandarddeviationmayinfactreflecttrendsofthemean,notofthevariability.Normalizationeliminates thisdrawback.Therefore,beforebeginningourstudy(in which normalization is inapplicable), we should clarify whether anyrelationship between the mean and the standard deviation exists. Usingnonnormalizedstandarddeviationwillbeappropriateonlyifsucharelationshipislacking.Thevaluesof themeanand the standarddeviationwerecalculated for each

portfoliocreationdatetoassesstherelationshipbetweenthesevariables.Returns

Page 224: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

ofsevenportfolios,constructedonthebasisofsevendifferent indicators,wereusedasinputdataforthecalculationofthemeanandthestandarddeviation.Theregressionanalysis isshowninFigure4.4.1.Thefiguredemonstratesnodirectrelationship between the mean and the standard deviation.Moreover, a slightinverserelationshipisobserved.Despitethefactthatthisinverserelationshipisstatistically significant (t = 18.4, p < 0.001), we may neglect it, since thedeterminationcoefficientisverylow(R2=0.05).Thus,inourstudyitwouldbeappropriate to use nonnormalized standard deviation as the measure ofvariability.

Figure4.4.1.Relationshipbetweenthestandarddeviationandthemeanportfolioreturn.

During the entire period covered in our study, the level of returnvariabilityfluctuated within a quite broad range (see Figure 4.4.2). At certain points intime, thevariabilitywasveryhigh.Duringsuchperiods, themethodofcapitalallocationgreatlyinfluencedtheportfolioprofitability.Atthesametime,duringotherperiodsvariabilitywasquitelow,whichmeansthatthechoiceofaspecificindicator for capital allocation among portfolio elements had an insignificanteffectontheportfolioperformance.Thus, we have determined that under some circumstances the choice of a

Page 225: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

capital allocationmethodmight have a great influence on the trading results,whereasinotherconditionsthismayhaveabsolutelynoimpact.Therefore,weneedtoestablishthefactorsthatdeterminetheextentofinfluenceexertedbytheselection of the capital allocationmethod on portfolio return. In other words,which factors make the decision about the selection of the specific indicator(usedtoconstructtheportfolio)acriticalissue?Toanswerthisquestion,wewillexamine the influence of three factors (historical volatility, the timing ofportfoliocreation,andthenumberofdifferentunderlyingassetsintheportfolio)on return variability of portfolios differing from each other by the capitalallocationmethod.

Figure4.4.2.Timedynamicsofreturnvariability(expressedthroughstandarddeviation)ofportfoliosconstructedusingdifferentindicators.

HistoricalVolatility

To determine whether market volatility has an influence on the returnvariability of portfolios created using different indicators, we calculated thehistoricalvolatilityoftheS&P500indexforeachdateonwhichportfolioswereconstructed(a120-dayhistoricalhorizonwasused).Allreturnvariabilityvaluesweregroupedby the levelsofS&P500historicalvolatility.Thegroupingwasperformedwiththestepof1%.Forexample,alldates,whenhistoricalvolatilityranged between 22% and 23%, were included in the same group (and thestandard deviations corresponding to these dateswere averaged).Accordingly,standard deviations relating to dateswhen historical volatility ranged between23%and24%wereincludedinthenextgroup,andsoon.

Page 226: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

The results of the analysis are presented in Figure 4.4.3. There is a directrelationship between the volatility level and the return variability of portfolioscreated on the basis of different indicators. If themarketwas calmduring theperiodprecedingthecreationofportfolios(atthetimeofportfoliocreation,thehistorical volatility was low), the selection of the particular capital allocationmethod had no significant effect on the strategy profitability (low standarddeviationvalue).On theotherhand, ifat themomentofportfolioconstructionthevolatilitywashigh, thevariabilityof returns realizedat theexpirationdatewasalsohigh.Thissuggeststhatwhentheportfolioiscreatedduringperiodsofvolatilemarket, the choiceof the capital allocationmethod influences strategyperformancesignificantly.

Figure4.4.3.Relationshipbetweenthereturnvariabilityofportfoliosconstructedusingdifferentcapitalallocationmethods,andthehistorical

marketvolatilitymeasuredatthemomentofportfolioscreation.

Itisworthnotingthatthepatternofpointdistributionontheregressionplanetestifies to the presence of conditional heteroskedasticity in this analysis. Thisfollows from the fact that the dispersion of points (variance) observed at lowlevels of the independent variable (historical volatility) is much lower thansimilardispersionobservedatitshighlevels.Thisimpliesthatduringperiodsofvolatilemarketreturn,thevariabilityofportfoliosmayeitherbehigh(asnotedpreviously) or moderate (as follows from the properties of conditionalheteroskedasticity).

Page 227: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

NumberofDaystoOptionsExpiration

Throughout the entire eight-year historical period, seven portfolios werecreatedoneachtradingdayforthenearestexpirationdateandthetwofollowingdates. This allows dividing all portfolios generated in the course of our studyintogroupsaccordingtothenumberofdaysfromthetimeofportfoliocreationuntiltheexpirationdate.Averagingofallstandarddeviationswithineachgroupmakesitpossibletoanalyzetherelationshipbetweenthevariabilityofportfolioreturnsandthenumberofdaysleftuntiloptionsexpiration.Figure4.4.4demonstrates that themoredays left until options expiration at

themoment of portfolio creation, the higher the profit variability of portfolioscreatedusingdifferentindicators.Ifportfoliosareconstructedshortlybeforetheexpirationdate,thedifferenceintheprofitsofportfolioscreatedonthebasisofdifferent indicators isnegligible.On theotherhand, if longer-termoptions areused to formtheportfolio, theselectionofaspecificcapitalallocationmethodinfluencesfutureprofitsignificantly.

Figure4.4.4.Relationshipbetweenreturnvariabilityofportfoliosconstructedusingdifferentcapitalallocationmethods,andthenumberof

daysleftuntiloptionexpiration.

The practical conclusion following from this observation is important if thetrading strategy focuses on the utilizationof the nearest option contracts.Thistypeofstrategyisquitepopularamongoptiontraderssincethenearestcontracts

Page 228: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

are the most liquid and have the fastest time decay rate (theta). When anautomated system that is focused on trading the nearest option contracts isdeveloped,thechoiceofaparticularcapitalallocationmethoddoesnotinfluencefinal profits. Hence, the developer does not have to spend time andcomputationalresourcestosearchforanoptimalcapitalallocationsystem.NumberofUnderlyingAssets

Accordingtothealgorithmofthebasicmarket-neutralstrategy,thenumberofcombinations included in the portfolio (and, hence, the quantity of underlyingassets to which they relate) is not determined in advance and may varysignificantlyfromcasetocase.Sincethenumberofdifferentunderlyingassetsreflects diversification level, itwould be natural to assume that in the case ofpoorlydiversifiedportfolios,theselectionofaspecificcapitalallocationmethodwould influence future return more than in the case of highly diversifiedportfolios.Similarlytothepreviousstudies,wegroupedallportfoliosaccordingto the number of underlying assets. Since the source for creating optioncombinations that may potentially be included in the portfolios is limited tostocks belonging to the S&P 500 index, the maximum number of underlyingassetswas 500.Although, from a formal standpoint, theminimum number ofunderlyingassetsis1,inpracticenoneoftheportfolioscontainedacombinationrelatedtofewerthan12stocks.DatashowninFigure4.4.5provesthatourassumptionsweretrue.Thereisa

strong inverse relationship between return variability and the number ofunderlyingassets.Furthermore,thisrelationshipisnonlinear.Ingeneral,wecanstate that the higher the number of underlying assets, the lower the profitvariability.Thismeansthatwhentheportfolioconsistsofcombinationsrelatingtomanydifferentunderlyingassets,itsprofitisalmostindependentofthecapitalallocation method. However, if the portfolio is not diversified and containscombinationsrelatingtofewunderlyingassets,thecapitalallocationmethodhassignificantinfluenceonfuturereturn.

Page 229: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure4.4.5.Relationshipbetweenthereturnvariabilityofportfoliosconstructedusingdifferentcapitalallocationmethods,andthenumberof

underlyingassets.

ThenonlinearityoftherelationshippresentedinFigure4.4.5allowsdrawingcertainquantitativeconclusions.Whenthenumberofunderlyingassetsincreasesfrom dozens to a hundred, profit variability decreases very fast. However, afurther increase in the number of underlying assets does not induce anysignificantvariabilitydecrease.This implies that if thetradingstrategyfocuseson creating large complex portfolios containing combinations on 100 ormoreunderlyingassets,thetimeandcomputationalresourcesconsumedintheprocessofsearchingforanoptimalcapitalallocationmethodmaybeunjustified.Ontheotherhand,whentheportfolioconsistsofcombinationsrelatingtoalownumberof underlying assets, even a small change in their quantity may affect profitdrastically(ifaninappropriatecapitalallocationmethodwasselected).AnalysisofVariance

Thus, we determined that the effect of selecting one or another method ofcapitalallocationdependsonthreefactors.Sofarwehaveexamined(visually)these factors separately. Since in reality they have simultaneous influence onprofitvariability,weneedtoperformastatisticaltestthatanalyzestheeffectofthethreefactorswithinthecommonframework.Thisallowsverifyingwhetherthe relationships that have been detected visually are reliable and makes itpossible togiveaquantitativeexpressionof the influenceexertedby the three

Page 230: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

factors. The most appropriate statistical tests for this purpose are multipleregression and analysis of variance (ANOVA). These tests are based on theassumptionthattherelationshipsbetweenthedependentvariableandeachoftheindependent variables are linear. In our case this condition is satisfied for twoindependentvariables(seeFigures4.4.3and4.4.4)butnotforthethirdone(seeFigure4.4.5).Hence,beforeproceedingwiththestatisticalanalysis,weneedtoapply the logarithmic transformation to the “number of underlying assets”variable. This will bring the relationship shown in Figure 4.4.5 closer tolinearity.Theresultsofamultipleregressionanalysis(seeTable4.4.1)demonstratethat

coefficients expressing the influence of the three independent variables(historical volatility, number of days to options expiration, and number ofunderlying assets) are different from zero at high significance levels. Theprobabilities that these coefficients diverge from zero by random chance areextremely low (less than 0.1%). The standard approach to interpretation ofmultiple regressions gives the following formula to be used for forecastingreturn variability:Table 4.4.1.Multiple regression and analysis of variance(ANOVA) for the relationship between portfolio return variability(expressed through standard deviation) and three independent variables(historical volatility, the number days until options expiration, and thenumberofunderlyingassetsintheportfolio).

StandardDeviation = 893.11+ 14.67×Volatility – 376.4×Log (Stocks) +8.29×DaysHowever,oneshouldbeverycarefulwithinterpretingandapplying

Page 231: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

this equation. The data shown in Table 4.4.1 suggest that the intercept of theregression is different fromzero at a high significance level.Thismeans that,according to the conventional interpretation of the multiple regression, thestandard deviation of portfolio return is 893.11 (which is the intercept value),given that all three independent variables have zero values. However, such aconclusionisabsurd,becausenoneofthesethreevariablesmaybeequaltozeroin the reality. Under such conditions, extrapolation is absolutely impossible.Thus,theanalysispresentedinTable4.4.1shouldnotbeusedforforecastingtheportfolio returnvariability, butonly for revealing the statistical significanceoftheinfluenceexertedbyeachofthefactors.TheresultsofANOVAshowninTable4.4.1confirmthatthegeneralmodelof

multiple regression is statistically reliable at a high significance level. At thesametime,itisworthnotingthatthevalueofdeterminationcoefficientisratherlow(R2=0.2).Thismeansthatallthreeindependentvariables(factorsaffectingthevariabilityofportfolioreturns)explainonly20%of thedependentvariabledispersion.Itwouldbesensibletoassumethatanother80%ofthedispersionisexplained, apart from inevitable randomerror, bymany factors composing theessence of the trading strategy.That iswhy the relatively small determinationcoefficientvalueseemstobereasonableandnotsurprising.

4.4.2.MeasuringtheCapitalConcentrationinthePortfolioInthissectionwewillcomparedifferentindicatorsbytheextentofcapitalconcentrationwithintheportfolio.Suppose that, according to the trading rulesofacertain strategy, theamountMhasbeenassignedatthefirstlevelofthecapitalmanagementsystemfor investment in the option portfolio. Also, assume that there are ncombinationsthatcanpotentiallybeincludedintheportfolio.AcertainshareofcapitalMmustbeinvestedineachofthesecombinations.Intheory,therecanbetwoextremecasesforcapitalallocation.ThewholeamountMmaybeinvestedin a single combination; all other combinations get no capital (they are notincluded in the portfolio). Another extreme case consists in even capitalallocation,wheneachcombinationgetsthesameportionoffundsequaltoM/n.Inpracticebothextremescenariosarerarelyencountered.Usuallythecapital

is allocated in some interim manner, when potentially more attractivecombinations receive more capital than less attractive ones. Attractiveness isdetermined by special indicators, seven of which were discussed in sections4.3.1and4.3.2.Portfolios inwhich thebulkoffunds isallocated to justafewcombinationswillbereferredtoas“concentratedportfolios.”Portfoliosinwhichall combinations get approximately the same amount of capital will be called

Page 232: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

“evenportfolios.”The extent of capital concentration is an important characteristic for

comparison of different capital allocation methods. Earlier we repeatedlyunderlined that portfolio diversification level is extremely important for riskmanagement.Up to thispointweestimatedportfoliodiversificationby simplycountingthenumberofunderlyingassetstowhichcombinationsincludedintheportfolio relate (see Figure 4.4.5). However, even if the portfolio consists ofcombinations relating to a large number of underlying assets, it still can bepoorlydiversified, if thebulkoffundsisconcentratedincombinationsrelatingtoone(orseveral)underlyingassets.Ifcapitalisallocatedmoreorlessevenlyamong combinations relating to different underlying assets, the portfolio isdeemedtobemorediversifiedand,hence,lessrisky.Earlier we expressed the extent of capital concentration by calculating the

variation coefficient for weights of different combinations included in theportfolio(seesection4.3.2andTable4.3.2).Sinceinthecurrentstudyweneedtoprocessanextensivedataset(morethan6,000portfoliosforeachofthesevencapitalallocationindicators),itseemsreasonabletointroduceanotherindicator,whichwouldbemoreconvenientandstatisticallysound.Wewill refer to itas“portfolioconcentrationindex.”Wewill demonstrate the procedure of concentration index calculation using

thedatashowninTable4.3.2.Twoindicatorswillbeconsideredasanexample:expectedprofitanddelta.Supposethattwoportfolios(eachoneconsistingofthesame 20 combinations)were constructed on the basis of these two indicators.Theseportfolios differ fromeachother onlyby the set ofweights,w, that areused to allocate capital among combinations. To calculate the concentrationindex,allcombinationsaresortedwithineachportfoliobycapitalweights.Thenwecalculatethecumulativeproportionofcapital investedintwocombinationswith the highest weights. The same procedure has to be repeated for threecombinations,andsoon,uptothe20thcombination.Afterthatweconstructtherelationshipbetweenthecumulativeproportionofcapitalandthecorrespondingfraction of combinations used in the calculation of this cumulative proportion(thenumberofcombinationsusedtocalculatethecumulativeproportiondividedbythetotalnumberofcombinationsintheportfolio).Forexample,inthecaseofthe portfolio constructed using the “expected profit” indicator, the cumulativeproportioncorrespondingtothethreecombinationswithhighestcapitalweightsis0.34(wGE+wCSCO+wORCL=0.0907+0.0935+0.1597=0.3439).Thefractionofthesethreecombinationsintheportfoliois3/20=0.15.Thismeansthat34%ofthecapitalisconcentratedin15%ofthecombinations.

Page 233: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure 4.4.6 shows two functions of cumulative capital proportioncorrespondingtotheexpectedprofitanddeltaindicators.Usingthesefunctions,we can calculate the percentage of combinations (out of the total number ofcombinationsintheportfolio)inwhich50%ofthecapitalisinvested.Thisisthevalueoftheportfolioconcentrationindex.Fortheexpectedprofit indicatortheindex is 0.25, and for delta it is around 0.42. This means that when capitalallocationisbasedonexpectedprofit,50%ofthecapitalisinvestedin25%ofallcombinations,andwhencapital isallocatedusingdelta,halfof thefundsisinvestedin42%ofthecombinations.Hence,inthisexampletheexpectedprofitindicator leads to more concentrated capital allocation and a less diversifiedportfolio.

Figure4.4.6.Visualizationofportfolioconcentrationindexcalculationusingtheexampleoftwoindicators:expectedprofitanddelta.Thedata

comefromTable4.3.2.Explanationsareinthetext.

Usingthismethod,wecalculatedtheconcentrationindexforeachofthe6,448portfolios constructed during the eight-year historical period. To compare theextentofcapitalconcentrationinportfolioscreatedusingdifferentindicators,webuiltafrequencydistributionoftheconcentrationindexforeachindicator(seeFigure4.4.7).

Page 234: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure4.4.7.Frequencydistributionsofportfolioconcentrationindexforsixindicatorsusedtoallocatecapitalamongcombinationsincludedinthe

portfolio.

Whencapitalisallocatedonthebasisofindicatorsunrelatedtotheevaluationofreturnandrisk, theshapeof theportfolioconcentrationindexdistributionisclose tonormal (the two topchartsofFigure4.4.7).When capital is allocatedinverselytothepremium,inapproximately8%ofthecaseshalfofthefundsisinvestedin16%to17%ofthecombinations.Whentheportfolioisconstructedusing the stock-equivalency indicator, in7%of the caseshalf of the capital isconcentratedin15%to20%ofallcombinations.Extremecases,inwhich50%

Page 235: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

ofthefundsareinvestedin1%to3%ofthecombinations,wereextremelyrare(lessthan2%ofallportfolios).Forportfoliosconstructedusingexpectedprofit,frequencydistributionofthe

concentrationindexisobviouslynotnormalandresemblestheshapeofnegativebinomialdistribution(themiddle-leftchartofFigure4.4.7).Mostoften(in9%to11%ofthecases)thecapitalisconcentratedin1%to2%ofthecombinations.Portfolioswithhalfofthecapitalinvestedinmorethan15%ofallcombinationswereveryrare(lessthan4%ofallcases).Whenportfoliosareformedonthebasisoftheprofitprobabilityindicator,the

shape of the concentration index distribution approaches uniform distribution(themiddle-right chart of Figure 4.4.7). By definition, uniform distribution ischaracterizedbythesamefrequencyofalloutcomes.However,inthiscasethedistribution is not completely uniform, since the frequency of concentrationindexvalueswithintherangeof15%andhigherisdescending.Inthosecaseswhencapitalintheportfolioisallocatedbydelta(thebottom-

left chart of Figure 4.4.7) and the asymmetry coefficient (not shown on theFigure), the shape of the concentration index distribution resembles thedistribution obtained for the profit probability indicator. This indicates therelativeevennessofcapitalallocationamongcombinations.However,whentheportfolio is createdon thebasisof another indicator related to risk evaluation,VaR,thedistributionisclosetonormal(thebottom-rightchartofFigure4.4.7),whichtestifiestoalowerconcentrationofcapitalintheportfolio.Tosummarize,wecandividethesevenindicatorsusedtoallocatecapitalinto

threegroups(bytheextentofcapitalconcentrationwithintheportfolio):1.Indicatorsleadingtothecreationofhighlyconcentratedportfolios.Insuchportfoliosalargeshareofthecapitalisinvestedinarelativelysmall number of combinations. In our study the expected profitrepresentsanexampleofsuchanindicator.2. Indicators leading to the construction of portfolios with mediumcapital concentration. In such portfolios the major portion of thecapital is invested in around 15% of combinations. These indicatorsincludeVaR,stock-equivalency,andpremium-inverseindicator.3. Indicators leading to the creation of portfolios with low capitalconcentration(almostevenallocationofcapitalamongcombinations).In our examples such indicators are represented by delta, profitprobability,andasymmetrycoefficient.

Page 236: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

4.4.3.TransformationoftheWeightFunctionTheweight functionφ(C) isafunctionofcompositetypeφ(C)=f(x(C)),wherex(C)istheindicatorselectedtoallocate capital among combinations included in the portfolio. Until now wehaveassumed that theweight functionsimply takesonvaluesof the indicator,which is the special case of φ(C) = x(C). In such a case the weight of eachcombinationintheportfolioisdirectlyproportionaltothevalueoftheindicatorcorrespondingtothiscombination(graphicallytherelationshipbetweenweightandtheindicatorisrepresentedbyastraightline).However,wearenotobligedto be limited to this special case, but should rather allow any type of therelationshipbetweenweightfunctionandtheindicator.Suchrelationshipshouldreflectthebasicideaofthetradingstrategy.For example, the trading system developer may test the alternative when

combinationswithhigh indicatorvalues receivemore capital than they shouldget under the proportional (linear) principle of capital allocation.Accordingly,combinationswithlowerindicatorvaluesreceivedisproportionatelylesscapital.This canbe accomplishedby transformationof the linearweight function intotheconvexfunction.The opposite scenario requires that combinationswith high indicator values

get less capital than under proportional capital allocation. In this case adisproportionately higher capital share is invested in combinations with lowindicatorvalues.Torealizesuchascenario,thelinearweightfunctionshouldbetransformedintotheconcavefunction.Differentmathematical techniquesmay be employed to solve this problem.

Herewedemonstratetheapplicationofthesimplestmethodoftransformingthelinear function into concave and convex ones. The weight function can bepresented as

wherexiisthevalueofindicatorforthei-thcombination,xministhevalueoftheindicatorforthecombinationwiththelowestindicatorvalue,andxmaxisthevalueoftheindicatorforthecombinationwiththehighestindicatorvalue.Inthefurtherdiscussionwewillassumethatymin=xmin,ymax=xmax. In this

case,ifthepowervalueinformula4.4.1is1,theweightfunctionisreducedtoasimple linear function.For alln > 1 theweight functionbecomes convex (wewilldenoteitby f+(x)),andforall0<n<1 this function isconcave(wewilldenoteitbyf–(x)).

Page 237: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Letusconsideranexampleofcalculatingthevaluesofconvexandconcaveweight functions (forn = 2 and n = 0.5, respectively) for the expected profitindicator.WewillusethedatafromTable4.3.2thatcorrespondstotheportfolioconsisting of 20 option combinations. Theminimum value of the indicator is0.0003, and its maximum value is 0.0191. The value of the convex weightfunction for AAPL stock is calculated as

Usingthepowerofn=0.5,wegetthe value of the concave function for this stock: f–(x) = 0.01373.By applyingequation4.3.5,wecancalculatetheweightofthiscombinationintheportfolio.If capital is allocated by the convex function, the weight of the AAPLcombinationis0.082,andinthecaseoftheconcavefunctionitis0.072.Havingbothvariantsoftheweightfunctioncalculatedinthesamemannerfor

all of the 20 stocks, we get two ways of capital allocation—by convex andconcaveweightfunctions.TheleftchartofFigure4.4.8showsthetwovariantsoftransformedweightfunctionsandtheoriginallinearfunctionthatwasusedasthebasisforthetransformation.Thepeculiarityoftheconvexfunctionisthatallitsvalues(exceptfor theextremes)are lower than thecorrespondingvaluesofthebasic linear function.For theconcave function theopposite is true—all itsvalues (except for the extremes) are higher than those of the basic linearfunction.

Figure4.4.8.Theleftchartshowstherelationshipsbetweenthevaluesoftransformedweightfunctionsandtheiroriginal(nontransformed)values.Therightchartshowstherelationshipsbetweenweightscorrespondingto

transformedfunctionsandtheoriginalweights.

Page 238: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

The sensitivity of transformed functions to changes in the original weightfunction is a very important characteristic.Nextwe describe the properties ofconvex and concave functions separately for low and high values of theirarguments (which are original, nontransformed functions). These descriptionsare based on the visual analysis of the left chart of Figure 4.4.8 and onderivativesoffunction4.4.1.Assumingymin=xmin,ymax=xmax,thederivativesof convex (n = 2) and concave (n = 0.5) functions are

ConvexFunction

Atarelativelyhighleveloftheoriginalfunctionvalues,theincrementoftheconvexfunctionishigherthanatlowlevelsoftheoriginalfunctionvalues.Thismeans that the difference in transformed function values between thecombinationwith the highest value of indicator and the combinationwith thenexthighestvalue isbigger than thedifference in transformed functionvaluesbetween the combination with an average or a low indicator value and thecombination with the previous value. Besides, at high levels of the originalfunction values, the increment of convex function values is larger than theincrement of the original function itself. Formally this can be expressed asfollows. Let x(Ci) be the value of the indicator of the i-th combination. Theportfolioconsistsofmcombinations{C1,C2,...,Cm}andx(Cm)>x(Cm–1),x(Cm–1)>x(Cm–2)andsoon.Thenfortheconvexfunctionthefollowinginequalities

hold:The difference in the values of the transformed function between the

combinationwiththesecondindicatorvalueandthecombinationwiththefirst(the lowest) value is smaller than the difference in values of the transformedfunctionbetweenthecombinationwithanaverageorahighindicatorvalueandthecombinationwiththepreviousindicatorvalue.Besides,atlowlevelsoftheoriginalfunctionvalues,theincrementoftheconvexfunctionissmallerthantheincrement of the original function itself. Formally, this is expressed by the

followinginequalities:ConcaveFunction

Athigh levels of theoriginal functionvalues, the increment of the concave

Page 239: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

functionissmallerthanatlowlevelsoftheoriginalfunctionvalues.Thismeansthat the difference in values of the transformed function between thecombinationwiththehighestindicatorvalueandthecombinationwiththenexthighestvalueissmallerthanthedifferenceinvaluesofthetransformedfunctionbetween the combination with an average or a low indicator value and thecombination with the previous value. Besides, at high levels of the originalfunction the increment of the concave function values is smaller than theincrement of the original function itself. Formally, this is expressed as

Thedifferenceinvaluesofthetransformedfunctionbetweenthecombinationwith thesecond indicatorvalueand thecombinationwith thefirst (the lowest)value isbigger than thedifference in the transformed functionvaluesbetweenthecombinationwithanaverageorahighindicatorvalueandthecombinationwith the previous value. Besides, at low levels of the original function, theincrement of the concave function is larger than the increment of the initialfunction itself. Formally, this is expressed by the following inequalities:

ApplicationofTransformedWeightFunctions

Afterallvaluesofthetransformedfunctionhavebeendetermined,weightsarecalculated using equation 4.3.5. The right chart of Figure 4.4.8 shows theweightscalculatedbymeansofapplicationoftheweightfunctionsshownintheleftchartof thisfigure(therowdatawere takenfromTable4.3.2; theoriginalweight function is expected profit; the convex and concave functions arecalculatedusingequation4.4.1withn=2andn=0.5,respectively).Thestraightlineonthechartshowsweightscorrespondingtotheoriginal(nontransformed)weightfunction.It follows from the rightchart inFigure4.4.8 thatwhencapital isallocated

using theconvex function, four combinationswith the highest indicator valueshave higherweights than theywould have if the portfoliowas created on thebasis of the original weight function (these combinations are situated in theintervalofhighoriginalfunctionvalues,wherethecurveoftheconvexfunctionisabovethestraightlineoftheoriginalfunction).Foroneofthecombinations,theweights obtained using both the convex and the original functions are thesame(thiscombinationissituatedattheintersectionpointoftheoriginalandthe

Page 240: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

convexfunction).Theother14combinationshave lowerweightsundercapitalallocationbasedontheconvexfunctionthantheywouldhaveifthecapitalwasallocated using the original weight function (these combinations are situatedwithin the interval of loworiginal function values,where the convex functioncurveisbelowthelineoftheoriginalfunction).Whencapital isallocatedusingtheconcavefunction, sixcombinationswith

the highest indicator values have lower weights than they would have if theportfolio was constructed on the basis of the original function (thesecombinations are situatedwithin the interval of high original function values,wherethecurveoftheconcavefunctionisbelowthestraightlineoftheoriginalfunction).Othercombinationshavehigherweightsunder thecapital allocationscenariobasedontheconcavefunctionthantheywouldhaveiftheportfoliowascreated using the original function (these combinations are situatedwithin theinterval of low original function values, where the concave function curve isabovethelineoftheoriginalfunction).These observations lead to the following conclusion:Portfolios constructed

on the basis of the convex function represent a more aggressive approach tocapital allocation, since combinations with higher indicator values receivedisproportionately more capital (and combinations with lower values getdisproportionately lesscapital) than theywouldreceiveshould theportfoliobecreatedusingtheoriginalweightfunction.Theoppositeistruefortheconcavefunction,whichrepresentsamoreconservativeapproachtocapitalallocation.Apart from that,when theconvex function isused, capital allocationwithin

theportfoliobecomesmoreconcentrated(severalcombinationsreceivethebulkof the capital). Using the concave function for portfolio construction leads tomore even capital allocation among the portfolio elements. Hence, portfolioscreated on the basis of the convex function are less diversified thanportfoliosconstructed using the concave function. This also indicates that the firstapproachismoreaggressivethanthesecondone.ComparisonofConvexandConcaveWeightFunctionsbyProfit

Usingthedatabaseencompassingtheperiodof2002–2010,wewillsimulatetwotradingstrategiesthataresimilarinallparameterstothestrategydescribedinsection4.4.1,exceptfortheprincipleofcapitalallocation.Inonecasewewillallocatecapitalusingtheconvexfunction(formula4.4.1,n=2);inanothercase,usingtheconcavefunction(formula4.4.1,n=0.5).Theexpectedprofitwillbeusedastheoriginalweightfunction.During thewhole simulation periodwe had created 6,448 portfolios for the

Page 241: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

convexfunctionandthesamenumberfortheconcavefunction.Letuscompareprofitsand lossesofportfoliosconstructedon thebasisof these twofunctions.Tobeginwith,wewillanalyzetherelationshipbetweenprofit/lossrealizedwhenthe capital was allocated using one of the transformed weight functions, andprofit/losscorrespondingtotheoriginalweightfunction.The pattern of point distribution in the two-dimensional coordinate system

(see Figure 4.4.9) demonstrates the effect of transforming the original weightfunction.To facilitate the interpretation,we added the indifference linewith aslopecoefficientof1totheregressionplane.Theprofitofportfoliossituatedatthisline(eachpointrepresentsonespecificportfolio)is thesameregardlessofthe capital allocation method applied to these portfolios (capital could beallocated using either the original or the transformedweight functionwithoutany impact on the portfolio performance). If the profit/loss realized under thecapital allocation scenario on the basis of the transformed weight function isshown on the vertical axis, and the profit/loss corresponding to the originalfunction is shown on the horizontal axis, then points situated above theindifference line denote portfolios for which application of the transformedfunctionhasledtohigherprofitsorlowerlosses(ascomparedtosituationswhencapitalwasallocatedusingtheoriginalfunction).

Figure4.4.9.Relationshipbetweenprofit/lossofportfoliosconstructedusingthetransformedweightfunction(theleftchart,convexfunction;therightchart,concavefunction)andprofit/lossofportfolioscreatedonthe

basisoftheoriginal(nontransformed)weightfunction.Eachpoint

Page 242: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

correspondstoaspecificportfolio.Theperformanceofportfoliossituatedatthelight-coloredline(slopecoefficient=1)isindependentofthecapital

allocationmethod.Theregressionlineisblack.

Whencapitalwasallocatedusingtheconvexweightfunction(theleftchartinFigure4.4.9)andtheportfoliowasprofitable(forboththetransformedandtheoriginalweightfunctions),themajorityofpointslieabovetheindifferenceline.Thismeansthatapplicationoftheconvexfunctionincreasesprofit.However,inthosecaseswhentheportfolioturnsouttobeunprofitable(forbothtypesoftheweightfunction),themajorityofpointsaresituatedbelowtheindifferenceline.This means that when adverse outcomes are realized, losses sustained byportfolios constructed using the convex function exceed losses sustained byportfolioscreatedonthebasisoftheoriginalfunction.Regression analysis enables us to quantitatively express these observations

and toverify their statistical reliability.The slope coefficient of the regressionlineis1.19,andtheslopeoftheindifferencelineisbydefinition1.Datashownin Table 4.4.2 prove that the difference in slope coefficients is statisticallyreliableatahighsignificancelevel.Therefore,ourconclusionthatapplicationoftheconvexfunctionforthecapitalallocationleadstocreatingmoreaggressiveportfolios (withhigher profit potential and a higher riskof losses) is justified.However,itshouldbeclearlynotedthatsuchanalysisisappropriateonlywhentheinterceptoftheregressionlineisclosetozero.Inourexample,althoughtheinterceptisabout$50lessthanzeroanditsdifferencefromzeroisstatisticallysignificant (seeTable4.4.2), it is still negligibly small relative to the rangeofvaluespossessedbythevariables.Therefore,wecandisregardtheinfluenceofthe intercept and reckon that theprofit/lossof portfolios constructedusing theconvex function is approximately 20% higher than performance of similarportfolioscreatedonthebasisoftheoriginalweightfunction(sincetheslopeis1.19).

Table4.4.2.Regressionanalysisoftherelationshipbetweenportfolioprofit/lossrealizedwhencapitalisallocatedusingthetransformedweightfunction(eitherconvexorconcavefunction)andprofit/lossrealizedwhen

capitalisallocatedonthebasisoftheoriginalweightfunction.

Page 243: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Whencapitalwasallocatedusingtheconcaveweightfunction(therightchartinFigure4.4.9),thepatternreversescompletely.Themajorityofportfoliosthatturned out to be profitable (for both the transformed and the original weightfunctions)aresituatedbelowtheindifferenceline.However,inthosecaseswhenportfolioswereunprofitable(forbothtypesoftheweightfunction),themajorityofpointslieabovetheindifferenceline.Thismeansthatcapitalallocationonthebasis of the concave function leads to a decrease in profit.At the same time,using the concave function diminishes losses occurringwhen trading outcomehappenstobeunfavorable.Although the slope coefficient of the regression line (0.89) is close to 1, it

differs from 1 at a high significance level (see Table 4.4.2).Hence, using theconcave function to allocate capital leads to creating more conservativeportfolios(withlowerprofitpotentialandalowerriskoflosses).ComparisonofConvexandConcaveWeightFunctionsbyCapitalConcentration

In the preceding section we compared the profitability of two tradingstrategiesthatdifferbytheshapeoftheweightfunctionsusedtoallocatecapitalamong portfolio elements. Now we pass on to a comparison of the samestrategiesbytheextentofcapitalconcentration.Earlierwedescribedthemethodof calculating the portfolio concentration index and applied it to comparedifferent indicators used in capital allocation (see Figure 4.4.7). The samemethodwillbeappliedinthecurrentanalysis—theconcentrationindexwillbecalculatedforeachofthe6,448portfoliosconstructedforeachofthetwoweightfunctionsduringtheeight-yearhistoricalperiod.Tocomparetheextentofcapitalconcentrationbetweenportfoliosconstructed

onthebasisoftwotransformationsoftheweightfunction,webuiltafrequencydistribution of the concentration index. Earlier we demonstrated that whenportfolios were created using the nontransformed weight function (expectedprofit), distribution of the concentration index was not normal and skewedsignificantly toward low index values (the middle-left chart in Figure 4.4.7).When the convex variant of the weight function was used to allocate capital

Page 244: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

among combinations, the nonnormality of the frequency distribution becameevenstronger (seeFigure4.4.10).Most frequently (>16%ofallcases),halfofthecapitalwasconcentratedinjust1%ofallcombinations.Portfolioswithhalfoftheircapital investedinmorethan15%ofthecombinationswereextremelyrare(lessthan2%ofallcases).

Figure4.4.10.Frequencydistributionoftheportfolioconcentrationindexfortwovariantsofthetransformedweightfunction.

Application of the concave weight function for capital allocation amongportfolio elements changes the distribution of the capital concentration indexfundamentally (compare the middle-left chart in Figure 4.4.7 and the light-colored bars in Figure 4.4.10). In this case the transformation of the weightfunction led to almost uniformdistributionof the concentration index.Half ofthecapitalisinvestedin1%ofallcombinations,2%ofallcombinations,andsoon,uptoabout18%ofallcombinationswithanapproximatelyequalfrequency(4%to6%).Our study demonstrates that capital allocation on the basis of the convex

function results in the constructionof highly concentratedportfolios, inwhichthe bulk of the capital is invested in a few combinations. On the other hand,usingtheconcaveweightfunctionleadstothecreationofportfolioswithmoreevencapitalallocation.Sincetheextentofcapitalconcentrationreflectsportfoliodiversificationlevel,wecanconcludethatcapitalallocationonthebasisoftheconvex function facilitates creation of less diversified and more aggressiveportfolios, while using the concave function facilitates creation of morediversifiedandconservativeportfolios.

Page 245: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

4.5.MultidimensionalCapitalAllocationSystemIn this section we describe the main methods applicable for creating

multidimensional capital allocation systems and compare the properties ofportfoliocreatedusingone-dimensional systemwith thoseof theportfolio thatwasconstructedbythesimultaneousapplicationofseveralindicators.

4.5.1.MethodofMultidimensionalSystemApplicationThemultidimensionalsystem of capital allocation is based on simultaneous application of severalindicatorsexpressingestimatesofreturnandrisk.Theintroductionofadditionalindicatorsfavorscreationofamorebalancedcapitalallocationsystem(fromthestandpointofexpected return to risks ratio).At the same time,employmentofthe multidimensional system raises an additional problem that has not beenencounteredwhencapitalwasallocatedon thebasisofa single indicator—thenecessity to select one portfolio out of several equally suitable alternatives. Insection4.2.1wewent through themainapproaches tosolving thisproblem.Inthe following example we apply the multiplicative convolution of severalindicators.Considercapitalallocationthatisbasedontwoindicators:expectedprofitand

VaR. Calculation of multiplicative convolution of these two indicators andconstruction of the weight function will be demonstrated using the data fromTable4.3.2.Since these indicatorsarescaleddifferently,weneed tonormalizetheirvalues.Thereareseveralnormalizationtechniques.Wewillusetheformulareducing values of all indicators to the interval between zero and one:

Table4.5.1showstheoriginalvaluesofindicatorsexpressingexpectedprofitand VaR (the data were taken from Table 4.3.2) and their normalized valuescalculated by equation 4.5.1. The following example demonstrates thecalculationofthenormalizedexpectedprofitvalueforAAPLstock.Maximumandminimumvaluesoftheexpectedprofitare0.0191and0.0003,respectively.Since the original expected profit ofAAPL is 0.0099, the normalized value iscalculatedas(0.0099–0.0003)/(0.0191–0.0003)=0.511.Since one indicator expresses expected profit and the other one expresses

potential loss (VaR), the multiplicative convolution should be calculated as aratio of expected profit toVaR.Consequently,we face the problemwith zerovaluesofnormalizedindicators.Wewillsolvethisproblembysubstitutingzerovalues with values calculated with the help of the equation

Page 246: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

where φ(Cmin+1) is the indicator value coming after theminimum one. Forexample,thenormalizedfunctionfortheexpectedprofitindicatoriszeroforAAstock.Usingequation4.5.2andknowing that thestockwith thenext indicatorvalueisV[φ(Cmin+1)=0.0007],wecancalculatethenormalizedvalueforAAas(0.0003/0.0007)×0.021=0.009.After values of all indicators are normalized and convolution values are

calculated, we can calculate the weight of each combination in the portfolio.Thisisdonebyapplyingequation4.3.5(theresultsareshowninthelastcolumnofTable4.5.1).

Table4.5.1.Capitalallocationamong20shortstraddlesusingtheconvolutionoftwoindicators:expectedprofitandVaR.Normalizedvaluesarecalculatedusingequation4.5.1,exceptforthevaluesofAAandGOOG

stocks(seeexplanationsinthetext).

Page 247: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

4.5.2. Comparison of Multidimensional and One-Dimensional Systems Inthis section we analyze the effect of applying the multidimensional capitalallocation system. For this purpose we should compare profits/losses ofportfolios constructed using a single indicatorwith profits/losses of portfolioscreated with simultaneous application of several indicators. The samecomparison should be made for the extent of capital concentration withinportfolios created using the one-dimensional and multidimensional capitalallocationsystems.Thecomparativeanalysiswasperformedduringthesameeight-yearhistoric

period by simulating two trading strategies. Both strategies are similar in allrespects to the strategy described in section 4.4.1, except for the capital

Page 248: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

allocationprinciple.Inonecasecapitalwasallocatedbytheconvolutionoftwoindicators (expected profit and VaR); in another case, by the single indicator(expected profit). In total, 6,448 portfolios were created during the entiresimulationperiodforeachofthetwocapitalallocationmethods.ComparisonbyProfit

By analogy with the study described in section 4.4.3, we analyzed therelationship between the profits/losses realizedwhen the capitalwas allocatedusingtheconvolutionoftwoindicatorsandtheprofits/lossesrealizedwhentheportfolioswereconstructedon thebasisofone indicator. InFigure4.5.1profitgenerated under the capital allocation scenario using convolution is on theverticalaxis,andprofitgeneratedwhentheportfoliowascreatedusingtheonlyindicator is on the horizontal axis. The profits of portfolios situated at theindifference line (with a slope coefficient of 1) were equal regardless of thecapital allocation system employed for portfolio construction. Points locatedabove the indifference line denote portfolios for which application of themultidimensionalsystemhasledtohigherprofitsorlowerlosses(ascomparedtothecasewhencapitalwasallocatedusingtheone-dimensionalsystem).

Figure4.5.1.Relationshipbetweenprofit/lossofportfoliosconstructedusingconvolutionoftwoindicators(expectedprofitandVaR)and

profit/lossofportfolioscreatedonthebasisofasingleindicator(expected

Page 249: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

profit).Eachpointcorrespondstoaspecificportfolio.Performanceofportfoliossituatedatthelight-coloredline(slopecoefficient=1)is

independentofthecapitalallocationmethod.Theregressionlineisblack.

Inthosecaseswhenportfolioswereprofitable(forboththemultidimensionaland the one-dimensional capital allocation systems), the majority of points isbelow the indifference line. This means that introduction of an additionalindicatortothesystemofportfolioconstructionhasledtoadecreaseinportfolioprofitability.Atthesametime,inthosecaseswhentheportfoliosturnedouttobe unprofitable (for both capital allocation systems), themajority of points issituated above the indifference line. This implies that losses of the portfolioscreated on the basis of the multidimensional capital allocation system weresmallerthanlossesofportfoliosconstructedusingthesingleindicator.Theregressionanalysisconfirmstheseobservations.Theslopecoefficientof

the regression line is 0.76, which is significantly lower than the slope of theindifferenceline.Althoughtheinterceptisnotzero,it isquitesmallrelativetothetotalrangeofvariables’values.Therefore,itspotentialimpactontheresultsofouranalysiscanbeneglected.Thedifferencebetweentheslopecoefficientsoftheindifferenceandtheregressionlinesisstatisticallyreliableataveryhighsignificancelevel(t=–64.4,p<0.001).Thus,wecanconcludethatapplicationof the multidimensional capital allocation system leads to creation of moreconservativeportfolioswithlowerprofitpotentialandalowerriskoflosses.ComparisonbyCapitalConcentration

Tocomparethemultidimensionalandtheone-dimensionalsystemsofcapitalallocation,weused themethod thatwasdescribed in section4.4.2. Frequencydistributions of the portfolio concentration indexwere constructed in order tocomparetheextentofcapitalconcentrationwithinportfolios.Whenportfolioswerecreatedusingasingleindicator,frequencydistribution

of the concentration index was not normal and skewed strongly toward lowindexvalues(seeFigure4.5.2).In9%and11%ofallcases,halfof thecapitalwas concentrated in just 1% and 2% of the combinations, respectively.Application of the two-dimensional capital allocation system led to afundamental change in the concentration index distribution (see Figure 4.5.2).Although the shape of the distribution is quite irregular, its mode shiftedsignificantlytowardhighindexvalues.In9%ofthecases,halfofthecapitalisconcentratedin16%ofallcombinations.

Page 250: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure4.5.2.Frequencydistributionoftheconcentrationindexforportfoliosconstructedusingtheconvolutionoftwoindicators(expectedprofitandVaR)andportfolioscreatedonthebasisofthesingleindicator

(expectedprofit).

Thus,wecanconclude that the introductionofanadditional indicator to thesystem of portfolio construction leads to more even capital allocation amongoption combinations included in the portfolio (as compared to the one-dimensional system). Since the extent of capital concentration reflects thediversification level, we can state that capital allocation based on themultidimensional system facilitates the creation of more diversified andconservativeportfolios.

4.6.PortfolioSystemofCapitalAllocationAllapproaches tocapital allocation thatwerediscussedearlier arebasedon

the evaluationof separate elements of the portfolio under construction. In thissectionweconsideranotherapproachtosolvingthecapitalallocationproblem.Thisapproachisbasedontheevaluationofreturnandriskofthewholeportfolioratherthanseparatecombinations.Themainpropertiesofportfoliosconstructedusingelementalandportfolioapproachesarecompared.

4.6.1. Specific Features of the Portfolio System The advantages of theportfolio approach include the possibility to take account of the correlationsbetween separate portfolio elements.The portfolio approach can be applied toboththeone-dimensionalcapitalallocationsystem(basedonasingleindicator)

Page 251: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

andthemultidimensionalsystem(basedonsimultaneousapplicationofseveralindicators).Theclassicalexampleoftheportfolioapproach(asappliedtolinearassets)implementedintheframeworkofthetwo-dimensionalcapitalallocationsystemis theCAPMmodelbasedon indicatorsof returnandriskestimatedattheportfoliolevel.Thefundamentallyimportantpropertyofindicatorsusedforcapitalallocation

undertheportfoliosystemisadditivityoftheirvalues.Thispropertydeterminesthe possibility of calculating the value of a specific indicator for the entireportfolio by summing up its values estimated separately for each portfolioelement. We propose the following classification of indicators constructedaccordingtotheiradditivityandapplicabilityattheportfoliolevel:

•Additiveindicators.Thevaluesoftheseindicatorscanbecalculatedfor the whole portfolio by summing their values estimated for eachseparateasset.Theexampleofsuchanindicatorisprofitexpectedonthebasisoflognormal(oranyother)distribution.•Non-additive indicators that are transformable into additive ones.Although the values of such indicators cannot be calculated for theportfolio bymere summation, they can be transformed into additiveindicators that are inherently similar to the original ones. In thepreceding chapter we described the transformation of non-additivedeltaintotheadditiveindexdelta.• Non-additive indicators that can be calculated analytically. Thevaluesofsuchindicatorscannotbecalculatedforthewholeportfoliobysimplesummation.Applicationofspecialcomputationaltechniquescoupled with additional information is required to calculate theirportfolio values. The example of such an indicator is the standarddeviation, which requires (besides standard deviations of separateassets)acovariancematrix (includingallportfolioassets) inorder tobeappliedattheportfoliolevel.•Non-additive indicators that cannot be calculatedanalytically. Thevaluesofsuch indicatorscanbecalculated for theportfolioofassetsneither by mere summation nor by analytical methods. Theseindicatorsincludevariousconvolutionsofseveralindicators.

Whentheportfoliosystemisappliedforthepurposeofcapitalallocation,weneedtodeterminesuchportfoliocompositionthatwouldmaximizethevalueofanindicator(oragroupofindicators)utilizedforportfolioconstruction.Inthecase of additive indicators used within the one-dimensional capital allocation

Page 252: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

system, the solution of this problem is trivial—the total amount should beinvested in the single combinationwith the highest indicator value. Certainly,this solution is inappropriate from the standpoint of diversification. In such acase we can set some minimum weights for all combinations (though thissolutionmay not be satisfactory either). Therefore, it is preferable not to useadditive indicators if the portfolio is constructed on the basis of a singleindicator.When capital is allocated on the basis of a non-additive indicator or

convolution of several indicators (either additive or non-additive), themaximization problem is usually not solvable by analyticalmethods. In thesecaseswehave toapplyrandomsearchmethods(forexample, theMonte-Carlomethod).Themaximizationproblemisthenstatedasfollows:Findsuchasetofweights forcombinations included in theportfolio thatmaximizes thevalueofan indicator (or group of indicators) calculated for the portfolio as a singlewhole.

4.6.2. Comparison of Portfolio and Elemental Systems In this section weanalyze how selection of the evaluation level affects the performance and thecharacteristics of the portfolio. To perform this analysis, we need to compareprofits/lossesrealizedunderthecapitalallocationscenariobasedontheportfoliosystemwithperformanceofportfoliosconstructedonthebasisoftheelementalsystem. The same comparison will be arranged for the extent of capitalconcentration.Thecomparativeanalysisisbasedonsimulationoftwotradingstrategiesthat

are similar to the strategy described in section 4.4.1, except for the capitalallocationprinciple.Atotalof6,448portfolioshadbeencreatedforeachcapitalallocation method during the entire simulation period. For both strategies thecapitalwas allocated using the convolution of two indicators—expected profitandindexdelta.Foroneofthetwostrategies,theconvolutionwascalculatedforeach separate combination and the capital was allocated according to theprinciples of the elemental system (as was done in all examples describedearlier).Foranotherstrategytheconvolutionvaluewascalculatedforthewholeportfolioandcapitalwasallocatedusing theportfolio systemprinciples.Sincevalues of index delta are directly proportional to the risk of short optioncombinations,theconvolutionofthetwoindicatorswascalculatedasaratioofexpectedprofittoindexdelta.Toimplementtheportfoliosystemofcapitalallocation,weneedtoestablish

the optimization model. The optimized function is represented by the

Page 253: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

convolutionofexpectedprofitandindexdeltacalculatedforthewholeportfolio:

The solution to the optimization problem consists in finding such a set ofweights that maximizes the value of function 4.6.1. This is a nonlinearmultiextremefunction.TheoptimizationwasperformedusingtheMonte-Carlomethod by generating randomvectors ofweights {w1,...,wn} and selecting theone thatmaximizes the value of function 4.6.1. The number of iterations (thenumber of generated random vectors {w1,...,wn}) was 10,000 for each of the6,448portfolioscreatedduringtheeight-yearperiod.ComparisonbyProfitsandLosses

Figure4.6.1showstherelationshipbetweenprofitsrealizedwhenthecapitalwas allocated using the convolution calculated for the whole portfolio andprofitsrealizedundercapitalallocationbasedontheconvolutioncalculatedforseparatecombinations.Pointssituatedabovetheindifferenceline(withaslopecoefficientof1)denoteportfoliosforwhichapplicationoftheportfoliosystemofcapitalallocationhasledtohigherprofitsorlowerlosses(ascomparedtothecase when capital is allocated by the elemental system). Accordingly, pointslocated below the indifference line correspond to portfolios for whichapplicationoftheportfoliosystemhasresultedindecreasedprofitorincreasedlosses.

Page 254: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure4.6.1.Relationshipbetweenprofit/lossofportfoliosconstructedusingtheportfoliosystemofcapitalallocationandprofit/lossofportfolioscreatedonthebasisoftheelementalsystem.Eachpointcorrespondstoa

specificportfolio.Performanceoftheportfoliossituatedatthelight-coloredline(slopecoefficient=1)isindependentofthecapitalallocationmethod.

Theregressionlineisblack.

Whenportfoliosturnedouttobeprofitable(underboththeelementalandtheportfoliocapitalallocationsystems),themajorityofpointsweresituatedbelowthe indifference line. This indicates that capital allocation based on theevaluationofthewholeportfoliodecreasesprofit.However,inthosecaseswhenportfolioswereunprofitable(underbothcapitalallocationsystems),themajorityof points were located above the indifference line. Thismeans that portfolioscreated using the elemental systemof capital allocation incurred bigger lossesthanportfoliosconstructedusingthealternativecapitalallocationsystem.Theresultsoftheregressionanalysisconformtotheconclusionsdrawnfrom

thevisualanalysisofFigure4.6.1.Theslopecoefficientoftheregressionlineis0.65,whichismuchlowerthanthecoefficientoftheindifferenceline.Althoughinthiscasetheabsolutevalueofinterceptishigh,itisstillquitelowrelativetothe range of variables’ values. Therefore, we can neglect its influence on theanalysis results (aswas thecase in thepreviousstudies).Thedifferenceof the

Page 255: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

slopecoefficientsfrom1isreliableatthehighsignificancelevel(t=–53.5,p<0.001).Thus,wecanconcludethatusingtheportfoliocapitalallocationsystemleadstoconstructionofmoreconservativeportfolioswithlowerprofitpotentialandalowerriskoflosses.ComparisonbyCapitalConcentration

As in the previous examples, we used the portfolio concentration indexdescribed in section 4.4.2 to assess the portfolio and elemental systems. Thefrequencydistributionoftheconcentrationindexwasusedtocomparetheextentofcapitalconcentrationwithinportfolios thatwerecreatedon thebasisof twodifferentcapitalallocationsystems.Whenportfolioswerecreatedonthebasisofconvolutioncalculatedforeach

separate combination (elemental system), the concentration index distributionwasskewedtowardtheareaoflowindexvalues(seeFigure4.6.2).Themodeofthedistributionfallsattheconcentrationindexvalueof2%.Thismeansthatin10% of all cases, half of the capital was concentrated in just 2% of allcombinations included in the portfolio. Application of the portfolio capitalallocationsystemfundamentallychangedtheshapeofthefrequencydistributionof the portfolio concentration index (see Figure 4.6.2). In this case thedistributionwasclose tonormaland itsmodewasshifted towardhigher indexvalues.Inabout10%to12%ofallcases,halfofthecapitalwasinvestedin19%to 22% of the combinations. Extreme cases when half of the capital wasallocated in1%to5%ofallcombinationswereveryrare(less than1%of thetotalnumberofconstructedportfolios).

Page 256: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure4.6.2.Frequencydistributionoftheconcentrationindexforportfoliosconstructedusingtheelementalandportfoliocapitalallocation

systems.

Summarizing these observations, we can conclude that relative to theelementalsystem,applicationof theportfoliosystemhas led to thecreationofportfolios with more even capital allocation. Since the extent of capitalconcentrationreflectstheportfoliodiversificationlevel,wecanstatethatcapitalallocationonthebasisoftheportfoliosystemleadstotheconstructionofmorediversifiedandconservativeportfolios.

4.7. Establishing the Capital Allocation System: Challenges andCompromisesIt is common knowledge that the choice of capital allocation system can

significantly influence the return and the risk of the trading strategy underdevelopment.Moreover,improperselectionofacapitalallocationalgorithmcanturn a promising strategy into an unprofitable one. As a result, a wonderfultradingideacanberejectedatthetestingstage.Tocreateaneffectivecapitalallocationsystem,weneedtomakeanumberof

compromisedecisions.First,weshoulddeterminethetypeofindicatorsthatwillbe used in the process of portfolio construction. Capital allocation of someoption strategies is based on indicators unrelated to return and risk evaluation(although they still indirectly reflect the riskof the createdportfolio).For thisclass of strategies, a priori fixation of the portfolio diversification level is apriority.Wehavediscussedtwoalgorithmsbasedonthistypeofindicator.Oneof themallocatescapitalon thebasisof theoptionpremiums receivedorpaidwhenpositionsareopened,andtheotheroneisbasedontheestimationsofthestock-equivalencyofoptionpositions.However,thecapitalallocationsystemofmosttradingstrategiesisbasedon

indicatorsthatdirectlyexpressreturnandriskestimates.Selectionofaspecificindicatororgroupofindicatorsdependsontheuniquefeaturesofthedevelopedstrategy and its basic ideas.We can literally state that this is themost criticalstageof thecapitalallocationalgorithmdevelopmentprocess.Althoughin thischapterwehavediscussedonlyfiveindicatorsofthistype,inpracticetheremaybemanymoreof them.Furthermore,eachindicatormayhavemanyvariationsdetermined by the selection of specific parameter values andmodifications ofdifferent functions incorporated in the computational algorithm. Wedemonstrated that the choice of a particular indicator influences the portfolio

Page 257: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

performance significantly.At the same time,wehavedetermined three factorsthatmake the trading strategy evenmore sensitive to appropriate selection ofindicators. In particular, we found out that during periods of high marketvolatility the profitability of the strategy shows greater dependency on thecapital allocation method than during calm market periods. If optioncombinations included in the portfolio relate to a small number of underlyingassets and if these combinations consist mainly of long-term options, theselectionof specific indicatorsbecomesmore critical thanwhenportfolios aremorediversifiedandconstructedusingshorter-termoptions.Afteraspecificindicator(orasetofindicators)hasbeenselected,theextent

of its influence on the capital allocation system can be modified. We haveproposed the procedure of indicator transformation (based on the convex andconcaveweightfunctions)thatleadstoconstructionofmore(orless)aggressiveportfolios,dependingonthepreferencesofthetradingstrategydeveloper.Usingthisprocedure,thedevelopercanadjustthestrategytoadesiredreturnlevel,andhe can also adapt it to the parameters determined by the risk aversion of aspecificuser.The next step in developing an algorithm of portfolio construction is the

decision concerning the dimensionality of the capital allocation system. Thesimplest one-dimensional system based on a single indicator may be rathersatisfactory.However,inmanycaseswehavetouseatleastthetwo-dimensionalsystem, in which one of the indicators expresses the return and the otherindicatorestimatesrisk.Inthischapterwehavedemonstratedthat introductionof an additional indicator into the capital allocation system may lead to thecreation ofmore conservative portfolioswith lower return and risk.However,these results should be treated with caution (only as indicative suggestions),since using other indicators (or application of the same indicators to anotherstrategy) may lead to different conclusions. In any case, defining thedimensionalityof the capital allocation system is a trade-offbetweenpotentialadvantages of additional indicators and their costs consisting of increasedconsumptionofcomputationalresourcesandtimerequiredtomakecalculations.Alongwiththeselectionofspecificindicators,anothercriticaldecisionmade

bythestrategydeveloperinthecourseofcreatingthecapitalallocationsystemisthechoiceofanevaluationlevel.Thecapitalmaybeallocatedonthebasisofestimates performed for the whole portfolio. The alternative approach is toestimateseparateelementsoftheportfoliounderconstruction.Ourstudyshowsthatevaluationsexecutedattheportfoliolevelleadtocreationoflessaggressiveandmore diversified portfolioswith lower expected profits that are, however,

Page 258: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

compensatedforbysmallerpotentiallosses.

Page 259: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Chapter5.BacktestingofOptionTradingStrategies

An automated trading system represents a package of software modulesperforming functions of development, formalization, setting up, and testing oftradingstrategies.DevelopmentandformalizationwerediscussedinChapter1.Setup of strategies,which includes parameters optimization, capital allocation,andriskmanagement,wasdescribed inChapters2,3,and4, respectively.Thecurrentchapterisdedicatedtotestingoptionstradingstrategiesonhistoricaldata(suchtestingiscommonlyreferredtoas“backtesting”).Themoduleperformingbacktestingfunctionsiscomposedofseveralobjects:

a historical database, a generator of position opening and closing signals, asimulatorof tradingordersexecution,andasystemofperformanceevaluation.Thesecomponentsareusedtomodelalong-termtradingprocessandtoevaluateitsresults.Backtesting of trading strategies has received wide coverage in financial

literature. There is a large corpus of works written at different levels ofcomplexity and elaboration. The majority of these publications describe thebacktesting system for strategies that trade linear assets, mainly stocks andfutures. In this chapter we do not contemplate giving a full and detaileddescription of a universal backtesting system—such general review may befoundinavastnumberofbooksandarticles.Instead,weconcentrateonspecificfeatureswhichmustbeconsideredwhenoptiontradingstrategiesaretested.

5.1.DatabaseHistoricaldataarethecornerstoneofanybacktestingsystem.Morethan2,000

stockswithoptionsaretradedatU.S.exchangesalone.Ifweassumethateachstockhasonaverageabout tenactively tradedstrikesandabout tenexpirationdates, thenwe get about 400,000 trading instruments. Such diversity explainsspecialrequirementstotheorganizationofthedatabasestructure.

5.1.1.DataVendorsMost brokerage firms providing online access to stock exchange data allow

observation of current option quotes. However, granting historical data ofsufficient length is not part of the usual brokerage service package. Currentquotes formost option contracts can be found at the popular free services offinance.yahoo.com, finance.google.com, and many others. Things get much

Page 260: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

morecomplicatedwithoptionspricehistory.Tocreateandmaintainahistoricaldatabase,thesystemdevelopershouldapplytospecialdatavendors.Notallofthem support a sufficient data length. Since creating backtesting systems foroption strategies is a rather complicated task, until recently, the demand forextensiveoptiondatawasquitelow.Many data vendors offer option price history only for a small range of

underlying assets (for example, basic indexes, futures, and selected stocks).Developers of some analytical platforms for option trading (such as theOptionVue system)provide access topricehistorydirectly from their softwareproducts.Thismightbeconvenientforthebacktestingofsimplestrategiesthatcanberealizeddirectlywithinthevendor’splatform.However,developmentofcomplex strategies based on a customized backtesting system is impossiblewithintheframeworkofsuchplatforms.Thefairlywiderangeofunderlyingassetsandaquiteconsiderablelengthof

price history can be found at the Internet resourceswww.historicaloptiondata.com, www.ivolatility.com, www.livevol.com,www.optionmetrics.com, and www.stricknet.com. In particular, livevol.comoffersnotonlydailyclosepricesbutsomeintra-daypricesaswell.Apartfromprice history, IVolatility.com offers a wide range of option-specific indicatorsandanalyticalmaterials.Ifthedatabaseispurchasedasaready-madeproduct,oneshouldpayspecial

attention to theproblemofomissionofunderlyingassetswhichexistedearlierbutarenolongertraded(survivalbiasproblem).Thismaybetheconsequenceofcompanyacquisition,bankruptcy,ordelisting.Asurvivalbiasproblemarisesifthe vendor provides data only for currently existing companies. If “extinct”underlying assets are omitted, strategy backtesting will overlook importantmarket eventsandbacktestingwillnotbecompleteand reliable.Forexample,whentherewererumorsaboutacompany’spossibleacquisition,thepriceofitsoptionscouldhavebeenveryhigh.Ifthevolatilitysellingstrategyhadgeneratedashortpositionopeningsignalat that time,considerablepricemovement (thatcouldhavebeenrealizedaftertheeventhastakenplace)wouldleadtoaseriouslossand,probably,resultintotalruiningofthetradingaccount.Ifthedatabaseused forbacktestingdoesnot include the tickerof theacquiredcompany, thenthis event will not be reflected in the backtesting results. Therefore, it isabsolutelynecessarytousethefullsetofallunderlyingassetsthathaveexistedduringthebacktestingperiod.

5.1.2.DatabaseStructure

Page 261: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Thedatabasemustcontaintheminimuminformationrelatedtoacertaintimeframe(inmostcases theframeisonetradingday).Regardingthepriceofanyfinancial instrument, the minimum information set includes open and closepricesoftheday,aswellasdailyhighandlowprices.Moredetaileddatabasesincludeintra-daypricesrecordedwithagivenfrequency,andthemostcompletebasesmaycontainticksdata,reflectingalldealsexecutedwithinthegiventimeframe.Historicalpricesofoptionshavetheirowndistinctivefeatures.Sinceoptions

arederivativefinancial instruments, theirpricingis inseparablefromthepricesof their underlying assets. This leads to a fundamentally important task ofsynchronization—option quotes recorded at a given moment in time must beconnectedwiththeirunderlyingassetpricerecordedstrictlyatthesamemoment.This factormustbe consideredwhen the structureof thehistoricaldatabase isset.Inviewofthewidespreadsandduetothelowliquidityofoptions,theirbid

and ask quotes contain much more information than prices of executedtransactions. It is especially important when close prices of a trading day (oranothertimeframe)aredetermined.Inmanycasesthelastoptiontransactionisexecuted before the trading is closed, while for the underlying asset the lasttransaction is usually related to the moment of market closing. Since suchmistiming is inadmissible, it is preferable to use the last bid and ask optionquotesinsteadofcloseprices.Testing most of the option strategies requires the following information

entitiestobeavailableinthedatabasestructure:•Underlyingassetspricehistory, including the standard setofopen,close,high,andlowpricesforsupportedtimeframes.•Options prices history and history of bid/ask quotes. Each optioncontract has its own ticker and transactions history. A full-fledgedbacktesting system requires maintaining a complete structuraldescription linking each option to its underlying asset and to otheroptionsrelatedtothesameunderlyingasset.•Trading volume (for both underlying assets and options) and openinterest(foroptions).• History of dividend payments, splits, and ticker changes forunderlyingassets.•Historyofquarterlyearningsreports.Thegoalofbacktesting is tosimulate the past decision-making process without looking into the

Page 262: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

future.Utilizationoftherealchronologyofquarterlyearningsreports(asprovidedbymanydatavendors)maycausefundamentalerrorsinthebacktesting.Inmostcasesthedecision-makingprocessisbasedontheexpecteddateoftheevent.Ifthebacktestingsystemisbasedonthechronology of reports (as realized), it will generate transactions thatwould never be executed in reality. To avoid such distortions, theexpecteddatesofearningsreleasesshouldbestored(inadditiontothereal dates) in the database. These data can be accumulated byautomatic daily scanning through financial sites likewww.marketwatch.com, www.earnings.com, andwww.finance.yahoo.com.•Historyof irregularcorporateevents, suchasmergers/acquisitions,bankruptcies,courtdecisions,orannouncementsofproductsapprovalor rejection. These events significantly complicate the backtestingprocess.While rumors related to such events strongly influence theimplied volatility of stock options, information about them becomesreliable only after the event has taken place. However, in thebacktesting we should use only assumptions and expectations thatprevailed in the market before the date of occurrence of the event.Collecting, storing, and using such information are all extremelydifficulttasks.Ifitisimpossibletodeterminetheinformationthatwasavailabletomarketparticipantsatagivenmomentinthepast(beforetheevent),thetransactionshouldbeexcludedfromthebacktesting.•Fundamental financial indicators, like P/E, PEG, ROE, EPS, andother multiples derived from corporate financial statements, whichformthebasisforfundamentalanalysis.Usingfundamentalindicatorsin option trading is not a common practice yet. However, theirapplication in theoptionstrategiesseems tobeapromisingdirectionin future development (especially in combination with technicalanalysis).Thedatafromquarterlyreportsshouldbeaccumulatedandlinked to estimates by the leading financial analysts (released beforethereportwaspublished).

Manydatavendorsprovideawholerangeofindicatorsalongwithpriceandvolume data. This includes different variants of volatility calculations (bothhistorical and implied), volatility indexes, the Greeks, and so forth. Althoughsuchinformationcanbeincludedinthedatabase, thetradingsystemdevelopercanusehisownmodelsandalgorithmstocalculatethesecharacteristics(astheneedarises).

Page 263: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

5.1.3.DataAccessSimulation of long-term trading requires successive processing of data

relating to thousands of trading days. Numerous historical simulations areperformed not only in the process of backtesting but also in the course ofpreliminary strategy optimization and the statistical analysis of its parameters.The data used in these procedures have a very significant volume. Access tosuchextensivedataisfraughtwithconsiderabletimecosts.Thebacktestingsystemworkssimultaneouslywithalargenumberoftrading

instruments.Theinstrumentmaybeaseparateoptionoranoptioncombination(a virtually unlimited number of option combinations can be created usingseparateoptioncontracts).Therefore,apartfromsimplenavigationintime, thesystem should ensure fast navigation through the option series structure. Inparticular,thetradingalgorithmofthetestedstrategymayrequirecreationofthefollowingdatasetoneachsimulationday:

•All options relating to a certain underlying asset andwith a givenstrikeprice(orarangeofstrikes)andexpirationdate(orseveraldateswithinthegiventimeinterval)•Allstrikesandexpirationdatescorrespondingtoagivenunderlyingasset• All actively traded options (with an average daily trading volumeexceedingthepredeterminedthresholdvalue)relatingtoagivensetofunderlyingassets• At-the-money, out-of-the money, or in-the-money optionscorrespondingtoagivenexpirationdate•Manyothermorecomplicatedsets

The system also needs to be able to determine quickly whether certainstatementsaretrueorfalse—forexample,whetherthecorporateearningsreportisexpectedbetweenthecurrentandtheexpirationdate.To perform these multidimensional tasks requiring navigation through both

timeandcombinationstructure,weneed toensureasufficientlyhighspeedofdataaccess.Theadequatedataaccessspeedcanbesecuredonlybystoringallthedatarequiredduringstrategysimulationinthemainmemory(randomaccessmemory). This means that, apart from the main database, intended foraccumulation and storage of the extensive historical data, the system shouldcreate a temporary auxiliary database that provides prompt access to thespecifieddataateachstepofsimulation.Wewillrefertosuchanobjectas“the

Page 264: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

operativehistory.”The operative history represents an object that contains only relevant

informationthatisrequiredforthebacktestingofacertainstrategy.Itisloadedat the beginning of the backtesting process and significantly diminishes theproblem of access rapidity. For example, if the strategy uses only indexes orETFs as underlying assets, there is no need to utilize the datasets related toexpected quarterly earnings reports (these data are contained in the maindatabase, but not in the operative history).The strategy can also be limited tousingjusttheseveralnearestexpirationdatesandstrikessituatedwithinquiteanarrow range around the current underlying assets prices. Even despite suchlimitations,placingtheoperativehistoryinrandomaccessmemorymayrequireapplicationofthedatacompressionalgorithms.

5.1.4.RecurrentCalculationsBacktestingofstrategieswithafocusontradingstocks,futures,orotherlinear

assets uses many technical and fundamental indicators. In the backtesting ofoption strategies, other specific characteristics are calculated in addition to thetraditional indicators—valuation criteria, implied and historical volatility, andGreeks relating to the whole range of instruments. The extensive volume ofthese data does not always allow calculation of the necessary indicatorsbeforehand and then storing them in the database. To avoid overloading thedatabasewithsuperfluousdata(whichmightonlyoccasionallybeneeded),theseindicators are calculated as the need arises. However, such an alternativeapproach (calculating instead of storing indicator values) leads to anotherproblem: excessively burdensome time and computational resource costs. Tosolvethisproblem,special techniquesofcalculationsaccelerationarerequired.One of these technologies is recurrent calculations. In particular, recurrentcalculationscaneffectivelybeappliedforhistoricalvolatility.Historical volatility is frequently used to calculate criteria that require

integrationofthepayofffunctionwithrespecttotheprobabilitydensityfunctionoftheunderlyingassetprice.Thetypicalcriteriaofsuchkindareexpectedprofitand profit probability calculated on the basis of lognormal distribution. In thecourseofstrategybacktesting, thesecriteriaarecalculatedforeachmoment intimet.Hence,valuesofhistoricalvolatilityHV(t)havetobecalculatedforeachmoment in time. It is preferable to calculate all volatility values for allunderlyingassetsandallmomentsintimebeforethesimulationbegins.Thiscanbe done by applying the recurrent calculations. Since the historical volatilitycorresponding to certain time t is

Page 265: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

whereC(t)istheclosingpriceofthet-thdayandNisthelengthofhistoricalperiodusedtocalculatevolatility,historicalvolatilitycorrespondingtothenext

dayisObviously,thecomplexityofcalculationsisalmostindependentofN,givena

sufficientlengthofthehistoricaldatabase.Usingrecurrentcalculationsenablesus to calculate the function value for each following day on the basis of theprevious value of this function. This significantly reduces the number ofcalculationsdone.Asimilarapproachcanbeappliedforanyvolatilityformula

withreversiblefunctionFofthefollowingtype:

5.1.5. Checking Data Reliability and Validity Data obtained even from themost reliable sources may contain errors. Besides primitive errors originatingfrom software bugs (for example, a decimal point is replaced by a comma, aticker is misspelled, or split information is omitted), theremay be systematicerrors related to false or missing quotes. Serious problem arises due todesynchronizationoftheunderlyingassetpriceandpricesofitsoptions.Tradingsimulated on the basis of erroneous or desynchronized data is fraught withseveredistortionsofresults.Theproblemoferroneousdatashouldbesolvedbywayoftheirdetectionand

furthercorrectionorfiltration.Thedetectionproceduresshouldbeappliedtoallnew prices and bid/ask quotes entering the database. There are two mainapproaches to detecting erroneous data: tests for availability of arbitragesituationsandanalysisofimpliedvolatilitysurfaces.Tests forarbitragesituations arebasedon the theoryofoptionspricingand

the concept of option prices parity. For European options with the sameexpirationdate,put/callparityisexpressedbythefollowingequality(provided

thatnodividendsareexpectedbeforetheexpirationdate):CandParepricesofthecallandputoptions,respectively,Xisthestrikeof

theseoptions,Sisthecurrentunderlyingassetprice,ristherisk-freerate,andtis the time left until options expiration. The parity notion is based on theprinciple that arbitrage situations cannot exist in an efficient market.Accordingly, there is no financial instrument or set of instruments thatwouldgenerate return in excess of the risk-free rate without accepting any financial

Page 266: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

risk.If parity is violated, this indicates that options prices are false or there is

information“priced in”by themarketbutdisregardedby the testingalgorithm(forexample,dividendpaymentsareexpected).Theerrormaybeinthepriceofoneofthetwooptionsorinbothofthem.Inthelattercaseweneedtofindoutwhichofthepricesiserroneous.Eachofthesetwooptionsshouldbeexaminedseparately, paired with another option that successfully passed the parity test.This other option will inevitably have a different strike price or a differentexpirationdate.Once theoptionwith theerroneouspricehasbeendetected, itshouldbeexcludedfromthedatabaseoritspriceshouldbecorrectedbysolvingtheparityequation (thepriceof theerroneousoption isset tobe theunknownandthecorrectpriceisfixedastheconstant).The significant drawback of this method is that it is applicable only to

Europeanoptions.ForAmericanoptionstheparityisexpressedbythefollowing

inequality:As it follows from the formula, there is no exact parityvalue forAmerican

options. The testing algorithm can only determine whether the differencebetween put and call prices lieswithin the permissible range.Although goingbeyondthelimitsofthisrangeindicatesparityviolation,beingwithintherangedoesnotnecessarilymeanthatthepossibilityofpricedistortionisruledout.Thepriceofoneof theoptions (orboth)maybe erroneous, butnot enough togetbeyond the range. However, prices of European options can also be distortedwithoutviolatingtheparity.Forexample,iftheputpriceisdecreasedbysomeamount,whilethecallpriceisincreasedbythesameamount,theparitywillstillholddespitethefactthatthepricesofbothoptionsareincorrect.Another method of detecting erroneous option prices is based on implied

volatilityestimations.Values of implied volatility have to be calculated for alloptions corresponding to a given underlying asset. Due to many differentreasons, these values will not coincide for options with different strikes andexpiration dates. At the same time, their divergences are not random. Inparticular, the relationship between implied volatility and the strike pricefrequentlyhas the shapeofa smile (it is called“volatility smile”)—the lowestvolatilityvaluecorrespondstothestrikethatisnearesttothecurrentunderlyingassetprice;asthestrikemovesawayinbothdirections(towardboththein-the-money and the out-of-the-money directions), the implied volatility increases.Theremaybeother formsof therelationship.However,whatever theshapeoftherelationship,itrepresentsamoreorlesssmoothcurve(or,insomecases,a

Page 267: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

straightline).Ifoneofthevolatilityvaluesfallsoutofthegeneraltrendandissituated far from its expected place on the curve, the price of the optioncorresponding to thisstrike isprobablydistorted.Asimilar relationshipcanbeestablished between implied volatility and the expiration date. Again, pricedistortionscanbedetectedbyanalyzingthesmoothnessofsucharelationship.Inmanycasesitispreferabletoanalyzethevolatilitysurface.Itisconstructed

byestablishingtherelationshipbetweenimpliedvolatility,strike,andexpirationdate. Under normal conditions this relationship has a shape of a relativelysmoothbendingsurface.Sharppeaksandlowsonthissurfacepointtopossiblyincorrectvaluesofimpliedvolatility,whichmeansthattheoptionpricemightbedistorted. The main problem with this method is that detection of anomalousprices is based on visual analysis of the volatility surface chart. This taskbecomesabsolutelyunfeasiblewhen thedatabase is regularly replenishedwiththousands of new tickers. This problem can be solved by organizing anautomatedsearchfortheoutlyingpoints,thoughcreatingsuchalgorithmsisnotatrivialtask.Within the framework of a two-dimensional linear relationship (between

volatility and strike or between volatility and expiration date), this problem issolved easily by linear approximation. Anomalous points are found bycomparingtheirresiduals(obtainedfromtheregressionmodel).Iftheresidualofsomepointdiffersfromtheaverageresidualbymorethanathresholdvalue,thismaysignalthedistortionofthecorrespondingoptionprice.Inthosecaseswhenthe relationship is nonlinear (with a different form of volatility smiles), morecomplicatedcurvefittingtechniquesshouldbeapplied.The problem becomes even more pronounced when we move on from the

two-dimensional system to the volatility surfaces. In these cases morecomplicatedmathematicalmodelsmust be applied. Themain requirements tothesemodelsincludehighprecisionindataapproximationandavailabilityoftheanalytical formula describing the volatility surface.The formula is required tocalculate the correct price in case the distorted price(s) is (are) detected. Thecorrect price is estimated by eliminating the outlier from the model andrecalculating the surface formula. Then the new value of implied volatility iscalculatedfortheoutlierbyapplyingthenewformula.Afterthevolatilityvaluehasbeencorrected,wecanuse it to correct the erroneousoptionprice (this isdonebyapplyingoneoftheoptionpricingmodels).

5.2.PositionOpeningandClosingSignalsThe algorithm of the trading strategy generates formalized decisions on

Page 268: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

opening and closing trading positions. The modeling of this decision-makingprocess requires calculation of the values of special functionals intended toevaluate profitability and the risk of potential trading variants. Furtherprocessing of functional values generates the position opening and closingsignals,whicharetransformedlaterintotradingorders.

5.2.1.SignalsGenerationPrinciples Inoptions trading,underlyingassetsandseparate option contracts form a universe of financial instruments that areavailableforimplementingdifferenttradingstrategies.Atthesametime,optioncombinationsmayalsobeconsideredastradinginstruments.Infact,wearenotobligedtoputanyconstraintsonthecomplexityofthetradinginstruments.Forexample,anysetofoptioncontractsrelatingtothesameunderlyingassetcanbetreatedasaseparatetradinginstrument.LetΩ = {K1 ,...,KN} be a set consisting ofN trading instruments. At any

momentintimet(thatis,ateachstepofsimulation),thestrategydisposesofacertain information set I(t) that is currently available.This information is verydiverse: price history of relevant trading instruments, formalized fundamentalinformation, technical indicators, profits/losses of positions that have beenopened earlier, different probabilistic scenarios, and so forth. The onlyrequirement to I(t) is thatdata fromfuturemoments in time t+1, t+2,... shouldnever be included in any form into this information set. For each tradinginstrumentthestrategyalgorithmcalculatesspecialfunctionalsΦ(Kj,I(t)),whereKjisthej-thtradinginstrument.Interpretationofthesefunctionalsistheelementofthetradingstrategy.Thefunctionalmayassumealogicalvalue.Forexample,logicalvaluesfalse

and true may have the following meaning: Φ(Kj, I(t)) = true means that thestrategyhasgeneratedasignaltoopenatradingpositionfortheinstrumentKj.Thismay be either a buy trade, if the functionalΦ(Kj, I(t)) is responsible forgenerating buy signals, or a sell trade if this functional generates sell signals.Φ(Kj,I(t))=falsemeansthatthestrategyhasgeneratednosignal.ThevalueoffunctionalΦmayberealnumbers.Inthiscasethefunctionalvaluereflectsnotonlythepresenceorabsenceofasignal,butitsrelativestrengthaswell.SupposethatfunctionalΦevaluatestheprofitabilityofpotentialtradesforN

instruments. Assume further that at step T the vector of functional values is obtained. The next step of the algorithm is the

interpretationofthesevaluesandgenerationofthevectorofsignalsthatwillbeused at the next step for generation of trading orders. Let us consider two

Page 269: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

methodsoftransformingthevectoroffunctionalvalues intothebuyandsellsignals.Thefirstmethodisbasedonusingthresholdvalues.Supposethelongposition

is entered, if the value of the functional, which is based on the profitabilitycriterion(expressedasapercentageofinvestmentcapital),exceedsthethresholdof3%(θbuy=3).Ifthiscriterionforecastslossesexceeding3%(θsell=–3),theshortpositionisentered.Accordingtothethreshold-basedmethod,theopeningsignalsaregeneratedinthefollowingway:

buyinstrumentKjifΦ(Kj)>θbuy,sellinstrumentKjifΦ(Kj)<θsell.

If these inequalities do not hold (that is, θbuy > Φ(Kj) > θsell), trades withinstrumentKjarenotinitiated.

Thesecondmethodisbasedonrankingtradinginstrumentsaccordingtotheorder of elements of the vector , where Φ(Kji) ≥Φ(Kji+1).Suchrankingenablesustopickoutacertainnumberaofsuperiorandbofinferiorinstruments:Top={Kj1,Kj2,...,Kja}andBottom={KjN–b+1,KjN–b+2,...,KjN}.Thepositionopeningsignalsaregeneratedinthefollowingway:

buyallinstrumentsbelongingtothesetTop,sellallinstrumentsbelongingtothesetBottom.

These procedures were simplified in order to demonstrate the mainapproaches to generation of trading signals. In reality, more complicatedalgorithms are used, though their core principles are very similar to ourdescription.

5.2.2.DevelopmentandEvaluationofFunctionalsDifferentvaluationcriteriadescribedby IzraylevichandTsudikman (2010) canbeusedas functionals forgenerationofpositionopeningsignals.Thesecriteriaexpressquantitativelytheattractiveness of option combinations (when they are used as tradinginstruments). Regardless of the peculiarities of any particular functional, itsapplication in the backtesting system is reduced to the evaluation of potentialprofitabilityandriskoffinancialinstruments.Continuoussearchforefficientfunctionalsisoneofthemaintasksperformed

bythestrategydeveloper.Arangeofstatisticalresearchisusedasthebasisforthe constructionofnew functionals andelaborationof existing functionals.Tocarry out such research, a multitude of trades are modeled during a certain

Page 270: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

historical period by applying the functional under investigation. Statisticalpropertiesofthissetofsimulatedtrades—averageprofit,variance,distributions,and correlations—are analyzed. On the basis of this analysis, effectivefunctionalscanbeselectedforfurtherexamination.However,havinggood statistics is anecessary,but insufficient, condition to

judge the functional as possessing high forecasting qualities. The order ofprofitableandunprofitabletradesisalsoofgreatimportanceforastrategytobesuccessful (statistical research disregards this order). Thus, a long series ofunprofitable trades may be practically unacceptable because of high capitaldrawdown or an excessive length of the unprofitable period. Furthermore, thestrategythathasperformedsatisfactorilyinthepast,buthasrecentlyturnedintoanunprofitableone,mayalsoshowgoodstatistics.Therefore,statisticalresearchmay and should be used to create functions, while historical simulations andbacktesting should be used to optimize their parameters and to evaluate theireffectiveness.

5.2.3.FiltrationofSignalsDepending on the strategy algorithm, some trading signals should be

eliminatedwithout transforming themintopositionopeningorders.Thismightbenecessaryeitherbecauseoftheupcomingcorporateeventsorduetothefactthat the values of some indicators do not satisfy specific requirements of thestrategy. These indicators are intended to filter out the most risky optioncombinations.Let us consider the example of the risk indicator whichmay be efficiently

applied for the filtration of unacceptable trading signals. The asymmetrycoefficient(describedinChapter3,“RiskManagement”)evaluatestheextentofasymmetry of the option combination relative to the current underlying assetprice.Ifexpectedprofit,calculatedonthebasisofempiricaldistribution,isusedas the functional evaluating the attractiveness of option combinations, manyasymmetrical combinationsmay turn out to be very attractive (theymayhavehighexpectedprofitvalues).Thishappenswhenempiricaldistributionalsohasan asymmetrical shape. Since expected profit is calculated by integrating thecombinationpayoff functionwithrespect to theprobabilitydensity functionofempirical distribution, the integral value is high when both functions areasymmetricaland theirmodesareskewed to thesameside.Nevertheless,suchcombinationsareinappropriateforstrategiesbasedonshortoptionselling.Dueto theirasymmetry, thepremiumreceived fromoptionssellingconsistsmainlyofintrinsicvalue,whilethetimevalueisquitelow.Hence,theprofitpotentialof

Page 271: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

such combinations is limited. Application of the “asymmetry coefficient”indicator allows filtering position opening signals that relate to suchcombinations.Filtrationthatisrequiredbecauseoftheforthcomingcorporateeventsmaybe

executedintwoways.Thedirectfiltrationmethodisappliedwheninformationconcerningtheexpectedevents isaccumulatedandmaintainedinthedatabase.The underlying assets, for which significant events are expected, may betemporarily excluded from the database (trading signals for such instrumentswill not be generated). Such events include quarterly earnings reports, sinceinformationabouttheeventdateisusuallyavailableandmoreorlessreliable.Theindirectfiltrationmethodisappliedwheninformationaboutforthcoming

events is not found in the database. In such cases we use special filters thateliminate signals generated for instruments for which an unusual event ispending.Onesuch filter is the ratioof implied tohistoricalvolatility IV /HV.HistoricalvolatilityHVofanunderlyingassetcharacterizesthevariabilityofitsprice during the period preceding the current moment. Implied volatility IVexpresses thepricevariabilityof thesameunderlyingasset that isexpectedbythe market in the future. When no important event is expected, these twovolatilities have close values (the ratio is close to 1). If this ratio deviatessignificantlyfrom1,thismayindicatethatanimportanteventwithanuncertainoutcomeispending.Ifimpliedvolatilitysignificantlyexceedshistoricalvolatility(IV/HV>1),

wemust conclude that the underlying asset price was less volatile relative tofluctuationsthatthemarketexpectsinthefuture.Forthebacktestingsystemthissuggeststhatsomeimportanteventthatmightsignificantlyinfluencethepriceisforthcoming. Among the typical examples of such events are court decisions,news on mergers and acquisitions, and approval of new products. Unless thestrategy is explicitly based on such kinds of events, these underlying assetsshouldbefilteredoutbeforethebacktestingstarts.Ifhistoricalvolatilitysignificantlyexceedsimpliedvolatility(IV/HV<1),

wemustconcludethatsomeimportanteventhasalreadytakenplaceandthatthemarketdoesnotexpectanyfurtherpricemovementsforthisunderlyingasset.Inmostcasescombinationscorrespondingtosuchunderlyingassetsdonotmatchthe basic parameters of the tested strategy and should be excluded from thebacktestingsystem.

5.3.ModelingofOrderExecution

Page 272: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

After opening and closing signals have been generated, they are convertedinto virtual trading orders. This section is dedicated to simulation of orderexecutions. Low liquidity of options may be a serious obstacle to successfulexecutionofordersgeneratedbythetradingstrategy.Inthecaseoflimitorders,thiswillleadtopartialexecution.Inthecaseofmarketorders,lowliquiditymaycause considerable price slippage resulting in a worse (than expected by thestrategyalgorithm)executionprice.Effective backtesting is possible only when simulated trades do not differ

fromexecutionsthatareattainableinrealtrading.Althoughsomedeviationsinexecutionpricesandvolumesareinevitable,thesystemdevelopershouldstriveto get them as close as possible to the reality. Tominimize the discrepanciesbetween simulated and real trades, the backtesting system should includealgorithmsformodelingpartialexecutionoftradingordersandexecutionusingprices that differ from those in the historical database. Besides, the executionprice shouldbeadjusted toaccount for feesandcommissions that arechargedfortheexecutionoftradingorders.

5.3.1.VolumeModelingIt is highly desirable for the historical database to contain bid and ask

volumes.However,theexecutionvolumeofalimitordercanhardlybeassumedtomatchthevolumeofthecorrespondingquote.Thequotevolumeappearinginthe database may aggregate volumes from different exchanges. For capturingthisvolumetheorderhastobesplitbythebrokerintoseveralpartsandsenttodifferent exchanges. Besides, the option market is based on a market-makingprinciple,whichallowsthedealer tocontinuouslychangebidandaskvolumesdependingonmanyfactors:themarketsituation,hisownholdings,andeventhecurrentstreamoftradingordersheisentrustedwith.Therefore,quotesvolumescontained in the database may be used only as one of the input componentsrequiredforestimatingtheexecutionvolumeoflimitorders.Other information thatcanbeuseful for forecasting theexecutionvolume is

the daily volume of executed trades and open interest. However, these datashouldalsobetreatedwithcaution.Tradingvolumesrelatingtospecificoptioncontractscanbeveryvariableandsporadic.Largetradesmayoccurepisodicallyand not reflect the real market depth. The same is true for the open interest,whichmaybeinflatedbyafewlargetradesthathavebeenexecutedinthepastandshouldnotbeexpectedtopersistinthefuture.Simulation of partial order execution can be realized using different

estimation methods. However, the outcome of all methods is reduced to

Page 273: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

determiningthevalueofoneparameter:thepercentageoforderexecution.Thisparametercanbeviewedasafunctionwiththefollowingarguments:thecurrentbidandaskvolumes,theaveragedailytradevolume(calculatedusingacertainnumberofprevioustradingdays),theopeninterest,bid/askspread,thedistancebetweenthestrikepriceandthecurrentunderlyingassetprice,andthenumberofdaysleftuntiloptionexpiration.The specific formula employed for calculating such a function and history

length that is used to average daily volumes may vary. For example, thedeveloper can account for the growth of option trading volumes that usuallyoccurs as the expiration date approaches or as the underlying asset priceapproachesthestrikeoftheoption.Alternatively,thedeveloperofthebacktestingsystemcansimulatevolumesof

order executions as a random variable changing according to a specificdistributionlaw.Theparametersofsuchdistributionshouldbederivedfromthesamecharacteristics (bidandaskvolume,averagedailyvolume,open interest,spread,etc.).Whentheexecutionvolumeismodeled, itshouldbe taken intoaccount that

theordergeneratedbythebacktestingsystemmustbeamultipleofthestandardlotamount.Whiletheoreticallyasingleoptioncanbeconsideredasoneseparatesecurity,inrealityoptionsaretradedinstandardlots,theamountsofwhicharedeterminedbytheexchanges.Usually,onelotofoptionsonU.S.stocksis100,on S&P 500 E-Mini futures it is 50, and on VIX futures it is 1,000. Thesemultipliers are a necessary element of the option database. The volumes ofsimulatedtradesmustalwaysbemultiplesoflots.

5.3.2.PriceModelingUnderthelowliquidityconditionsthelimitordermayfail tobeexecutedin

full (the executed volume is lower than the order volume), though its pricecannotbeworsethanthefiledlimit.Theoppositesituationistrueinthecaseofthemarket order: The execution volume usuallymatches the order, while theexecutionpricemaybeworsethanthemarketpricethatexistedatthemomentwhentheopeningsignalwasgenerated.Thisphenomenoniscalled“slippage”or“marketimpact.”Tosimulatetheexecutionprice,weneedtointroduceaparameterexpressing

the slippage magnitude into the backtesting system. By analogy with volumesimulationofthelimitorder,thisparametercandepresentedasafunctionwiththe following arguments: the bid and ask volumes, the average daily tradevolume, the open interest, the bid/ask spread, the distance between the strike

Page 274: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

price and the current underlying asset price, and the number of days left untiloption expiration. In most cases slippage is lower when the average dailyvolume is higher and the spread is lower. The closer the strike price is to thecurrent underlying asset price and the fewer the days that are left until theexpiration date, the higher the options liquidity will be (consequently, theslippageislower).When the developer constructs strategies intended for trading highly liquid

options with at-the-money strikes and close expiration dates, the impact ofslippagecanbeneglected.Whensuch strategiesarebacktested, thevolumeofpositions that can be opened during a given period of time for each contractshouldnotexceedacertainshareofaveragedailyvolume.Specificvaluesofthetimeperiodandthepercentageofaveragedailyvolumearetheparameters(theymustbesetbythesystemdeveloperdependingonhisexecutionfacilities).Ifslippageisassumedtobezero,theworstspreadsideisusuallyusedasthe

execution price for market orders (the ask price for buying, the bid price forselling). However, we can assume further that, in real trading, orders can beexecutedatbetterpricesthantheworstspreadside.Theexecutionsystemcanbeautomatic(basedonspecialalgorithms)orcanbeassignedtoa trader.Variousintermediatealternatives—whenordersareexecutedbyahumanwith thehelpof different automated algorithms—are also possible. Depending on traderqualification and the effectiveness of applied algorithms, the execution systemmaybeabletoexecuteordersatthepricesthatareinsidethespread.This possibility canbe taken into account by introducingparameterμ (with

valuesrangingfrom0to1)intothebacktestingsystem.Whenμ=0,theworstexecutionpricesareused—theaskpriceforbuying,andthebidpriceforselling.When μ = 1, the best execution prices are used—bid for buying and ask forselling.Ingeneral,

sellprice=μ·Ask+(1–μ)·Bid,buyprice=μ·Bid+(1–μ)·Ask.

Since option spreads are usually wide, the influence of parameter μ on theperformanceoftheoption-basedstrategiesmaybesubstantial.Insomecasesitsimpact may be so significant that even a slight change in μ can turn anunprofitable strategy into a profitable one (and vice versa)! Thus, it is highlyimportant to select a reasonable value for this parameter. The best solutionwouldbe tocollect real empiricaldataof tradingorderexecutions.With thesedata in hand, the developer can investigate the relationship between the realexecutionpricesandpricesthatwereusedbythebacktestingsystemtogenerate

Page 275: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

opening and closing signals. On the basis of this relationship, it would bepossible to estimate the appropriate value of the μ parameter (this value isspecificforeachparticularexecutionsystem).

5.3.3.CommissionsEvery transaction simulated by the backtesting system is recorded on the

virtualbrokerageaccountand is furtherused toevaluatestrategyperformance.Apart fromexecutionvolumeandprice, the transaction ischaracterizedby thecommissionpaidtothebroker.Thetermsofcommissionsdependonthetypeofsecurities, exchange fees, volumes and frequency of trading, and individualbrokerterms.Thereareseveralapproachestocalculatingcommissions.Usuallya client of a brokerage firm can choose the most appropriate alternative,depending on the nature of his trading operations. The following threealternativesarethemostcommon:

1.Commissionsareproportionaltothenumberofsecuritiespurchasedorsold.2.Commissionsareproportionaltothetransactionamount.3.Aflatfeeissetforacertainperiod(forexample,amonth)anddoesnotdependontradingturnover.

Commission rates usually have fixed minimum and (sometimes) maximumlimitsandmayvarydependingonthetypeofsecurities.Inanycase,theformulafor calculating the exact valueof trading commissionsmust be integrated intothe backtesting algorithm (it may vary depending on the strategy underevaluation).In option trading commissions may be very high and in some cases even

absorbupto50%ofstrategyprofit.Thereareseveralreasonsforthat.Firstly,incontrasttopositionsinstocksorfutures,theoptionpositionoftenconsistsofawhole setof instruments (acombinationofdifferentoptioncontracts), eachofwhich is a separate security requiring execution of a separate trade. Sincecommissionsmayhaveminimumlimitsforeachoperation,establishingasingleoption position may generate more commissions as compared to positions inotherfinancialinstruments.Secondly,optionpositionsinmanycasesgivebirthto positions in underlying assets, which require payment of additionalcommissions to close them. Thus, the backtesting system should provide foranalysis of the sensitivity of strategy performance relative to changes in thecommissionrate.

5.4.BacktestingFramework

Page 276: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Indevelopingabacktestingsystemthedeveloperstrugglestosolvetwomainproblems:thethoroughevaluationofthestrategyperformance(thisisexaminedinsection5.5)andevaluationofthelikelihoodthattheperformanceshownusinghistorical data will hold in future real trading. In fact, this likelihood isimpossible toevaluate in termsofprobability. Itwouldbemoreappropriate todescribethesecondprobleminthefollowingway:tomaximizetheprobabilitythat historical strategy performance will not deteriorate significantly in realtrading.To create a sound backtesting system that would ensure strategy continuity

andintegrity,thedeveloperhastoconstructasolidframeworkthatisbasedonthefollowinginterrelatedprinciples:

•Reasonableseparationof thehistoricaldatabase intoaperiodwhenthestrategyisoptimized(theperiodofin-sampleoptimization)andaperiodwhenthestrategyistested(theperiodofout-of-sampletesting)• The possibility of recurring optimizations—the optimizationprocedure should be repeated continually as the strategy advancesthroughpricehistory(adaptiveoptimization)•Adequatehandlingofpotentialoverfittingchallenges•Specialmethodsfortestingtherobustnessofthebacktestingsystem

5.4.1. In-Sample Optimization and Out-of-Sample Testing The historicalperiodcoveredby theavailabledatabase isdivided into twoparts: thestrategyoptimization period τs (in-sample) and the strategy testing period τo (out-of-sample). The positional relationship of the in-sample and the out-of-sampleperiods can be different. Period τs may precede period τo or vice versa. Thecontinuityofperiodsisalsonotobligatory.Periodτsisusedforcreatingthestrategy.Duringthisperiod,thebasicideais

tested, the set of optimized and fixed parameters is determined, and optimalparameter values are found. Different optimization techniques are used here.Afterthefinalvariantofthestrategyhasbeenselected,itsefficiencyisverifiedby running at the interval τo, which was not used in the process of strategycreation. The same indicators that have been used when the strategy wasdeveloped are measured here (these indicators reflect various forms ofprofitability, risk, stability, and other properties of the tested strategy). If thevaluesoftheseindicatorsshownosignificantdeterioration(thatis,theyremainwithinacceptablelimits),weassumethatthestrategyisstableandcanmaintainitseffectivenessinfuturetrading.

Page 277: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

The main problem associated with historical time series is theirnonstationarity.Market behavior differs dependingon theprevailing sentimentofmarketparticipants,andtheeconomicandpoliticalsituation.Phasesthatarecommonly encountered in the stock and futuresmarkets canbe classified intothreecategories:upwardtrends,downwardtrends,andperiodsofrelativepricestagnation(lackinganypronouncedtrend).Intheoptionsmarketweshouldalsoconsider phases of high and low volatility. The longer the period of strategyoptimization, the higher the probability that this period will cover differentmarketphases.Any given strategy may show different efficiency during different market

phases. Even if we do not strive for the creation of universal strategiesperformingwellunderanymarketconditions,itisstillimportanttoensurethattheprofitablestrategywillnotturnintoafrustratedonewhenthemarketphasechanges. By prolonging period τs, we increase the probability of capturingdiverse market phases, and, thus, reduce the sensitivity of the strategy to thechanging market environment. Accordingly, optimization performed using alonger time period is more reliable. On the other hand, the shorter theoptimization period, the better the strategy is customized to the conditionsprevailing in the market in recent time. Other things being equal, suchoptimizationismorestable.Thus,thedecisionaboutthelengthofthehistoricalperiod used for strategy optimization is a compromise between reliability andstability.Wesuggestaguideline thatcanhelpfinda trade-offbetweenreliabilityand

stability for option trading strategies. It is based on theweighted (by positionvolumes) average time interval between themoment of portfolio creation andthatofoptionsexpiration.Ingeneral,thelongertheperioduntilexpiration,thelongertheperiodofoptimizationshouldbe.Forexample, if thestrategyopenspositions that consistmainlyofoptionswith2 to20days leftuntil expiration,theoptimizationperiodmaybemuchshorterthaninthecaseofthestrategythatisbasedontradinglonger-termoptions(forexample,LEAPS).The lengthof the testingperiod shouldnotbe less than theperiod leftuntil

options expiration. We can propose the following rule-of-thumb: τs shouldinclude at least ten full non-overlapping expiration cycles.For example, if theweighted-average time interval between themoment of portfolio creation andthatofoptionsexpirationis15workingdays,theminimumτslengthshouldnotbe less than 150 days. Such estimations should be adjusted depending on theaverage number of positions that are opened during one expiration cycle. Thehigherthenumberoftradingoperationsexecutedbythestrategy,thehigherthe

Page 278: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

credibilityofperformancestatisticsandtheshorterperiodτsmaybeacceptable.

5.4.2.AdaptiveOptimizationThe algorithm of the trading strategy may provide for the adaptive

optimizationprocedure.This is realized as amovingoptimizationwindow.Toformally describe the adaptive optimization, let us consider the description ofstrategyS(P),wherePisthevectorofstrategyparameters.Letτ(T)=[T–Δt+1,T]bethehistoricalintervalendingatsomemomentTandhavingthelengthofΔtdays.WhenpointTmovesfromthepasttothefuture,theintervalτ(T)alsomoves afterT. Assume that optimization algorithmA generates the vector ofparametersP*(T)=A(τ(T)).Letlbethedistancebetweenoptimizationmoments,andT0betheinitialmomentintime.Thenthetradingalgorithmwithadaptiveoptimization is the following.AtmomentsTn =T0 +nl (wheren is the serialnumber of the adaptation stepwith valuesn = 0,1,2,..., nlast, the optimizationalgorithmA is activated to generate new parameter valuesP*(Tn) =A(τo(Tn)).ThestrategyS(P*(Tn)) tradesduringthenextafter timeinterval[Tn+1,Tn+1],afterwhichanewstepofadaptationandtradingismade.As a result of introducing the adaptive optimization procedure, the original

strategyS(P),whichinitiallyhadthesetofparametersP, turns intoacomplexstrategy that can be described by the sequence {S(P*(T0)), S(P*(T1)),...,S(P*

(Tn)),...}. This complex strategy has two additional parameters, l and Δt, thatmay also be optimized in order to find their best values. Performance of thestrategyprovidingforperiodicalreoptimizationmaybeevaluatedusingstandardeffectivenessindicators(seesection5.5).Suchevaluationenablesustojudgetheusefulnessofadaptiveoptimizationineachspecificcase.Inmanycasesadaptiveoptimizationallowscreatingstrategies thataremore

robust(thatis,lesssensitive)tochangingmarketphases.However,itshouldbeclearly noted that adaptive optimization does not eliminate the overfittingproblem—it is still just an optimization, although with a more complicatedstructure.Moreover,usingadaptationsinthebacktestingsysteminevitablyleadsto increasing the number of optimized parameters, which might increase theoverfitting risk (see section 5.4.3). Nevertheless, our experience suggests thatwhenthestrategyisreoptimized,itsfuturerobustnessishigherthanitwouldbeif it hadbeenoptimizedat anunchanginghistoricalperiod (provided that it istested during a sufficiently long historical interval and generates a sufficientnumberofpositionopeningsignals).

Page 279: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

5.4.3.OverfittingProblemThehigh effectivenessdemonstratedbymany strategies (in simulations that

arebasedonpasthistoricaldata)isfrequentlyattributedmerelytotheexcessiveoptimization of their parameters. Usually, performance of the same strategiesdeteriorates significantly when they are tested using the out-of-sample priceseries. This phenomenon is known as the overfitting or curve-fitting problem.Since no trading algorithm is possible without using (either explicitly orimplicitly)someparameters,theoverfittingriskisinevitableevenforrelativelysimplestrategies.Formorecomplexstrategiesthisriskincreasesmanifoldly.Ingeneral,wecanclaimthattheprobabilityofoverfittingisdirectlyrelatedto

thenumberofdegreesoffreedominthebacktestingsystem.Inthebacktestingofstrategiesorientedtowardtradingstocksorfutures,thenumberofdegreesoffreedom is equal to thenumberof optimizedparameters.Foroption strategiesthenumberofdegreesoffreedomishigherbecause,apartfromtheparametersrelatingdirectly to the tradingalgorithm, there are someadditionalparametersrelated to the construction of option combinations.Option-specific parametersinclude,forexample,therangeofallowablestrikeprices,limitsimposedonthetime intervalbetween themomentofpositionopeningand theexpirationdate,thelengthofhistoricalhorizonthatisusedtocalculatevolatility,andmanyotherparameters.Thus, foroption-orientedstrategies theoverfittingproblemisevenmorerelevantthanforstrategiesusedinthetradingofplainassets.Unfortunately,thereisnowaytofullyeliminatetheoverfittingrisk.However,

thisproblemcanbesubstantiallydiminished,ifthefollowinggeneralprinciplesareobserved.Walk-forwardanalysisisthemainmethodofstrugglingwithoverfitting.This

method isbasedondividinghistorical time series intoperiodsofoptimization(in-sample)andtesting(out-of-sample)(seesection5.4.1.).Themainideaisthattheevaluationofstrategyperformancedoesnotinvolvedatathathavebeenusedin strategy creation and optimization. However, it is necessary to note thatsatisfactory performance, recorded during out-of-sample testing, does notnecessarily prove that the strategy is not vulnerable to the overfitting risk.Although this statement seems to be contradictory at first sight, this can beexplained with the following reasoning. Suppose that the developer sets tworequirementsforthebacktestingsystem:

1.Valuesforstrategyparametersthatcausetheobjectivefunction(orfunctions)toachievesatisfactoryvalue(s)duringthein-sampleperiodshouldbefound.

Page 280: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

2.Thesevaluesshouldnotdeteriorateduringtheout-of-sampleperiodbymorethanagivenamount.

It was shown earlier (see Chapter 2, “Optimization”) that quite a fewparameter combinations with acceptable objective function values (so-calledoptimal zones) may be identified in the course of optimization (using the in-sampleperiod).Consequently,itmaywellturnoutthatatleastonevariantfromthis multitude will give (solely by chance) satisfactory results during out-of-sampletestingaswell.Thismeansthatgoodresultsobtainedviawalk-forwardanalysis may be merely the result of fitting (overoptimization) and will mostlikelynotholdinfuturerealtrading.Whenthestrategyistestedusingwalk-forwardanalysis,thenumberoftrades

should be thoroughly controlled. The appropriate relationship between thenumber of executed trades and the number of strategy parameters must beestablished. In general, the higher the number of parameters used inoptimization, the more trades should be executed. Adhering to this principleensuresminimizationoftheoverfittingrisk.If the strategy is unstable (small changes in parameter values lead to

significant deterioration of strategy performance), it is most likely overfitted(differentaspectsofstability,whichisalsocalled“robustness,”werediscussedinChapter2).Twoparallellinesofresearchcanbeconductedtoensurethatthestrategyissufficientlyrobustrelativetotheoptimalvaluesofitsparameters.Thefirstlineofresearchconsistsinanalyzingchangesinstrategyperformanceintheneighborhood of the optimal parameter values. The second one is based oninvestigatingthestrategybehavioratslightlymodifiedhistoricaldata(obtainedby applying small distortions to original data). The robustness of the strategywithrespecttosmallchangesinparametervaluesandtimeseriesindicatesloweroverfittingrisk.

5.5.EvaluationofPerformanceEvaluationofstrategyperformance isamulticriteria task.There isnosingle

characteristic (the terms “criterion,” “characteristic,” and “indicator” will beused interchangeably) that would allow thorough evaluation of strategyeffectivenessanditscomparisonwithotherstrategies.Instead,thereisawholeset of universal indicators that are used in the backtesting of different tradingstrategies regardless of the kind of financial instruments employed. Althoughthese indicators arewidelyknown, their calculation and application for optionstrategies have a number of specific features.Apart from universal indicators,therearealso somespecific indicators thatweredevelopedexclusively for the

Page 281: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

evaluationofoptionstrategies.

5.5.1.SingleEventandUnitofTimeFrameTodiscusstheindicatorsthatareusedintheevaluationofstrategyperformance,weneedtogiveastrictdefinitionofasingleeventandaunitoftimeframe.A single event can be defined as a single trade relating to a specific option

contractorasasetoftradesrelatingtotheoptioncontractandexecutedwithinone day. Besides, a single event may be defined as a set of trades executedwithin one day to create an option combination. When plain financialinstruments(stocksandfutures)aretraded,eachseparatetradeisusuallytreatedasasingleevent.Inoptiontradingthechoiceofthesingleeventdependsonthepeculiaritiesof thestrategy. Inmostoptionstrategiesasetof tradesrelating tothe same combination or the same underlying asset are considered as a singleevent.Theimportantfactorindeterminingtheunitoftimeframeisthenecessityto

evaluate the outcome of option trades at the moment of expiration. Optionstrategies are based on selection of trading variants using special criteria thatevaluate option combinations at the moment of position opening. Accurateverification of these evaluations is possible on the expiration date only. ThetraditionalexpirationmomentofmostoptionstradedatCBOE(themainoptionsexchange) is the thirdFriday of eachmonth.Thus, performance evaluation ofmany strategies that trade stock options has a natural monthly periodicityresulting from the standardexpiration schedule.For such strategies theunitoftimeframeisonemonth.Forstrategiesdealingwithlong-termoptions,theexpirationmomentdoesnot

playsuchakeyrole. In thesecasesother referencepoints (suitable for interimportfolio evaluations) become more important. Recently, options with weeklyexpirations have been introduced by exchanges. For strategies employed intrading weekly options, the selection of the unit of time frame of one weekseemstobethemostappropriatesolution.

5.5.2. Review of Strategy Performance Indicators Strategy performance ismeasuredat the time interval τ= [T0,TN],which is divided into a sequenceofinterim time moments {T0, T1, ..., TN}. For the sake of simplicity, we willmeasure time in days (though any unit of time frame may be used forperformance evaluation). The length of interval τ is ΔT = TN – T0 days, or

years,whereA=365.25calendardays.Let{E0,E1, ...,EN}be

Page 282: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

thesequenceofcapitalvaluesdeterminedateachofthepointsintime{T0,T1,...,TN}. The capital value is usually estimated as the liquidation value of allpositions(calculatedusingclosepricesofthecorrespondingday)plusfreecash.CharacteristicsofReturn

We will consider two types of return corresponding to two differentapproachestocapitalmanagement(herewerefertothefirstlevelofthecapitalmanagement system; see Chapter 4, “Capital Allocation and PortfolioConstruction”). The first approach requires a constant amount of capital to beinvested at eachperiodof time (regardless of the strategyperformanceduringpreviousperiods).Thesecondapproachisbasedonthereinvestmentprinciple.Thefirstapproach isapplicableforanalyzing theperformanceofaseriesof

single-type portfolios. It may be appropriate for the strategy that creates oneseparate portfolio for each expiration date. The same amount of capitalE0 isused for each unit of time frame. Performance of the strategy with constantinvestment amounts is estimated by calculating the linear annual return:

Thischaracteristicrepresentstheannualizedarithmeticalmeanreturn.Thesecondapproachismoreappropriateforcomparingstrategyperformance

withacertainreferencereturn,suchasacontinuouslyaccruedinterestrate(forexample,arisk-freerate)orwiththeperformanceofsomebenchmarkindex(forexample,S&P500).Performanceofastrategythatisbasedonreinvestmentsofprofits generated during previous periods is estimated by calculating the

exponentialannualreturn:Thischaracteristicrepresentsanannualizedgeometricalmeanreturn.By linking the moments when capital measurements are taken with option

expirationdates,weobtainaseriesofmonthlyprofitsandlosses.LetNbethenumberofmonths in theperiodof strategybacktesting.According to the first(linear)approach tocapitalmanagement, the investedcapitalalwaysequalsE0andthecapitalmeasuredattheendofthei-thmonthisEi.Thentheprofitofthe

i-thmonth is , the averagemonthly profit is , the average

returnis ,andthereturnofthe i-thmonthis .Accordingtothesecond (exponential) approach to capital management, the invested capital ofeachmonthisequaltotheendingcapitaloftheprecedingmonth.Thereislittle

Page 283: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

sense in calculating the average monthly return, since different amounts are

invested in each month. The return of the i-th month is , and the

averagereturnisthegeometricalmeanreturn .Sets of , and are used to calculate different

statistics that are very useful for the evaluation of strategy performance. Themaximum monthly profit , maximum linearmonthly return , and maximum exponentialmonthlyreturn characterizethemostsuccessfulmonthinthetimeseries.Maximum monthly absolute and relative losses are also very important

characteristics. If their values turn out to exceed a certain threshold level, thestrategymighthavetoberejected.Evenahighlyprofitablestrategywithasingleunprofitablemonthcanberejected,ifthislossisunacceptablyhigh.Calculationoftheabsolutemaximummonthlyloss makessense only in the linear case. The relative value for the linear case is

; for the exponential case it is.

Other indicators may also be used to characterize the strategy return: thenumber of profitablemonths, the number of unprofitablemonths, the averageprofit of profitable months, the average loss of unprofitable months, themaximum number of successive profitable months, the maximum number ofsuccessiveunprofitablemonths,andsoon.MaximumDrawdown

One of the most popular risk indicators that can be easily applied to anyautomatedtradingstrategyismaximumdrawdown.DrawdownatmomentT isdefined as the difference between the current capital value E(T) and themaximum capital value recorded during the preceding time period:

. Accordingly, themaximum drawdown corresponding tothetimeintervalτis .Thenotionofdrawdowniscloselyrelatedtoanotherindicator:thelengthof

drawdown. This characteristic measures the time interval from local capitalmaximumtoitsbreakdown.Let tmaxbe themomentof reaching themaximumcapitalvalue,andletE(tmax)bethevalueofcapitalatthemomenttmax.Ifatthe

Page 284: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

current moment in time the T capital value exceeds the previous maximumvalue, that isE(T)>E(tmax), the lengthofdrawdown is fixedatT– tmax. Themaximum drawdown length can be seen as an additional negative indicatorreflectingtheriskofthestrategy.Maximum drawdown and maximum drawdown length represent the most

“emotional” risk characteristics. In real trading unacceptable values of theseindicatorsoftenresultinceasingtheutilizationofotherwiseprofitablestrategies.Meanwhile,periodicalappearanceofsomedrawdownsisanaturalphenomenonfor many successful strategies. It is important to note that the psychologicaleffectproducedby thedrawdowndependsonhowsuccessful the strategywasbefore the drawdown occurred.However, in terms of performance evaluation,highdrawdownisundesirableregardlessofthemomentwhenitemerged.Atthesame time, if the strategy had significant drawdown in the backtesting, it cantheoreticallytakeplacejustafterthebeginningofrealtrading.Thiscanruinthetradingaccountbeyondtherecoverablelevel.Themaindrawbackoftheseindicatorsisthat,whileassessingtheamountand

lengthofmaximumloss, theydonotevaluatetheprobabilityofsuchanevent.Meanwhile,thelossofacertainmagnitudeexperiencedbythestrategythatusesjustoneyearofhistoricaldatapoints toamuchhigherrisk thanthesamelossrecordedinthebacktestingthatisbasedon10-yeardata.Hence,theriskinessofthestrategyestimatedonthebasisofmaximumdrawdownshouldbeweightedwithrespecttothetestingperiodlength.SharpeCoefficient

Sincethereisadirectpositiverelationshipbetweenreturnandrisk,indicatorsthatallowthesimultaneoussolutionoftwoproblems—returnmaximizationandriskminimization—areveryusefulforperformanceevaluation.Inthecourseofstrategy backtesting, the developer obtains a sample ofN return values. Thecloser the sample elements are to each other (and, hence, to their mean), thestraighterandmorestableistheequitycurve.Theeffortstowardmaximizationof average return and simultaneousminimization of standard deviation can berealizedbyapplyingtheSharpecoefficient—anindicatorwhichiswidelyusedinalmostallbacktestingsystems.The Sharpe coefficient represents the ratio of average return to standard

deviation.Althoughthereturnisusuallyreducedbyarisk-freerate,weprefertoneglect it (using a risk-free rate complicates calculations without adding anysupplementarybenefitinassessingthestrategyperformance).Intheexponentialcase(thestrategyisbasedonreinvestmentofprofitsgeneratedduringprevious

Page 285: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

periods),weapplygeometricalmeanreturnre;inthelinearcase(thestrategyisbasedontheinvestmentofconstantamounts),weapplyarithmeticalmeanreturn

rl.Theformulaformean-squareddeviationiswhered=lord=e.ThemaindrawbackoftheSharpecoefficientisthatitdoesnotaccountforthe

order in which profitable and unprofitable months (or other time frames)alternate. It follows from the Sharpe coefficient formula that we can shufflesummands inanyorderwithoutchanging the result.Thismeans that the sameSharpecoefficientcanpertaintoastrategywithevenlygrowingcapitalandtoastrategywithanunacceptablemaximumdrawdownvalue.The strategy shouldnothavelongsequencesofconsecutiveunprofitablemonths.ThisdrawbackcanbecompensatedforbythejointuseoftheSharpecoefficientandthepreviouslymentionedriskindicators(particularly,maximumdrawdown).Profit/LossFactor

The profit/loss factor, which is the ratio of the total profit of all profitabletradestothetotallossofallunprofitabletrades,isoftenusedinthebacktestingof trading strategies. There is a consensus that the profit/loss factor shouldexceed2forastrategytobeeffective.This indicator isusefulandinformativewhenappliedtostrategiesthatexecutesingle-typetradesconsecutively,oneafteranother. For option strategies the calculation of the profit/loss factor has itsspecific aspects (since the set of trades generated by the strategy is nothomogeneous).Let us illustrate this by two examples. Consider the classical strategy of

volatilitytradingwithdelta-neutralhedging.Thesimplestvariantofthisstrategyinvolvesbuying(orselling)someoptionanditerativebuyingandsellingof itsunderlyingassetindifferentquantities(wewillrefertothesetofsuchtradesas“the game”). There is no sense in considering profits and losses of separatetradesforanalyzingtheperformanceofsuchstrategy.Onlythefinalresultofthewhole game, determined after closing all separate positions, can have sense.Thus,tocalculatetheprofit/lossfactor,oneshouldusesumsofallprofitableandunprofitablegamesinsteadofusingoutcomesofseparatetrades.The second example corresponds to the volatility selling strategy. Suppose

that the strategy algorithm specifies the following sequence of procedures.Straddles, consisting of short at-the-money call and put options, are createdeverytradingdayforeachunderlyingasset.Thewholesetofthesecombinationsis sorted by the values of a specific criterion and a certain number of

Page 286: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

combinations is sold. Similarly to the previous example, evaluation of theprofit/lossstructureonthebasisofseparatetradesisuselessforsuchastrategy.Itseemstobemoreappropriatetobasetheestimationoftheprofit/lossfactoronprofitsandlossesofseparateoptioncombinations.To ensure proper application of the profit/loss factor, the developer should

define the single event correctly (see section 5.5.1). In the first example thewholesetof tradesrelatedtoaspecificunderlyingassetshouldbe treatedasasingleevent.Inthesecondexamplethesetofalltradesexecutedwithinoneday(orthewholeexpirationcycle)tocreateaspecificoptioncombinationshouldberegardedasasingleevent.Consistency

Thestrategyisconsideredtobeconsistentifprofitableandunprofitabletradesare not concentrated within certain periods but are distributed more or lessevenly through thewhole testingperiod.Underunevendistribution,periodsofcapital growth alternate with periods of decline (their length and depth isdetermined by the extent of this unevenness). In option trading the precisesequence of trades following one after another is not always determinable.Usuallypositions thathavebeenopenedsuccessively in timearenotclosed inthe same order. Thus, for option strategies the consistency term should beassociated with the equity curve (rather than with separate trades) that wasestablishedinthecourseofbacktesting.To express the consistency quantitatively, itwould be practical to introduce

the concept of “the ideal strategy.”To be ideal, a strategymust have constantpositive return and zero drawdowns. In the linear case (constant amounts areinvestedateachstep),theequitycurveoftheidealstrategyisastraightlinewiththe slope coefficient equal to the return. In the exponential case (moneymanagement is based on reinvestments), the equity curve is exponential. If acapital logarithm isused insteadofabsolutecapitalvalues, theequitycurve istransformed into a straight line. The consistency indicator shouldmeasure theextent of deviation of real equity curve (with or without logarithmictransformation)fromtheidealstraightline.Let the sequenceX = {X(T),T =T0,T0 + 1,...,TN } represent the series of

equities (or equity logarithms) that were successively measured during the

simulationperiod τ.The straight line connectsthefirstpointofthissequence(whenthetradingstarts)withthelastone(theendoftrading).TheextentofdeviationofthesequenceXfromthestraightlinecan

Page 287: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

beestimatedasthesumofsquares:Thelowerthevalueofthisindicator,theclosertheequitycurveistotheideal

line.

5.5.3. The Example of Option Strategy Backtesting Let us considerperformanceevaluationofthestrategythatisbasedonsellingSPYoptionsandhedging these positions by long VIX options. The strategy employs thefollowingalgorithm:Onsomefixeddaybefore thenearestexpirationdate, theSPY strangle is sold and the VIX call, belonging to the series with the nextexpirationdate,ispurchasedinamountsdeterminedbythecapitalmanagementalgorithm. The short position is bought back on a certain day before theexpiration date. The long VIX option is held until expiration. These are thestrategyparameters:

•Thedayofpositionsopeningrelativetothenearestexpirationdate•Thedayofshortoptionsbuyback•TherelativeratioofSPYstranglesandVIXcalls•Theshareofcapitalinvestedinthecurrentposition•Thedistancebetweenstrangles’strikes

VisualAnalysis

Usually, analysis of backtesting results begins with the visualization of thetimedynamicsofbasicperformance indicators.Theequitycurve isoneof themostinformativevisualizations.Figure5.5.1showstheequitycurveobtainedinthe backtesting of one of the strategy variants. To demonstrate the desirableshapeofthecurve,wehaveselectedthebestvariantofthestrategywithrathersmoothandstablecapitalgrowth.Visualanalysisofthechartindicatesthatthisstrategy looks good, on the face of it, and deserves further detailedconsideration.

Page 288: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure5.5.1.Equitycurveobtainedinthebacktestingofoneoptionstrategy(seedescriptioninthetext).

The equity curve is usually constructed using daily equity valuations (asshown in Figure 5.5.1). This allows intra-month evaluation of capitalfluctuations and drawdowns.However, for the evaluation of option strategies,we also need to link performance to standard expiration cycles.A convenientformofsuchpresentation isachartshowingmonthlyprofitsand losses (if theunitoftimeframeisonemonth).Figure5.5.2showsthemonthlyperformancechart for the strategy used in our example. Such a presentation form enablesinstant performance overview—most of the 31 months, covered by thebacktesting period,were profitable and only twomonths generated significantlosses. Although these two strongly unprofitable months took place at thebeginningofthetestingperiod,theydidnotresultinstrategyfailure,whichisanimportantindicatorofitseffectiveness.

Page 289: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Figure5.5.2.Monthlyprofitsandlossesobtainedinthebacktestingoftheoptionstrategy(seedescriptioninthetext).

AnalysisofQuantitativeCharacteristics

Inthefollowingtextwepresentvariousperformanceindicatorscalculatedforthelinearversionofthestrategy(withaconstantamountofcapital investedateachtradingstep).Someindicatorswerecalculatedfortwotimeframes:months(whichcorrespondstoexpirationcycles)anddays(sincedayisthetimeframeatwhichsteadinessofthestrategyhastobecontrolled).Testingperiod:01.01.2009to31.07.2011.Numberofcalendardays:d=938.Numberoftradingdays:t=648.Numberofmonths:m=31.

Numberofyears:Startingcapital:E0=1,000,000.

Endingcapital:EN=1,953,594.

Totalprofit:P=1,953,594to1,000,000=953,594.

Averageannualprofit:

Averagemonthlyprofit:

Page 290: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Mean-squareddeviationofmonthlyprofits:

Sharpecoefficientformonthlydata:

Averagedailyprofit:

Mean-squareddeviationofdailyprofits:

Sharpecoefficientfordailydata:Maximum drawdown occurred on 18.03.2009, when the capital had

decreasedfromitsmaximumof1,157,537(recordedon11.03.2009)to818,733.Thedrawdownamountwas338,803.The length ofmaximum drawdown was 78 days. It turned out to be the

mostprolongeddrawdownrecordedduringtheentiretestingperiod.Percentageofprofitabletransactions (thetransactionisdefinedasasetof

alltradesrelatingtoacertaincombinationandexecutedwithinoneday):53.6%.Percentageofprofitablemonths:76.6%.Maximumnumberofconsecutiveprofitablemonths:9months.Maximumnumberofconsecutiveunprofitablemonths:2months.Averagenumberofconsecutiveprofitablemonths:3.3months.Averagenumberofconsecutiveunprofitablemonths:1.2months.Totalprofitofprofitabletrades:2,684,032.Totallossofunprofitabletrades:1,730,438.Profit/Lossfactor,calculatedonthebasisofseparatetrades:1.55.For this strategy, aswell as formany other option strategies, the profit/loss

factor calculated on the basis of separate trades is meaningless (see theexplanationinsection5.5.2).Asimilarratiocalculatedusingmonthlyprofitsandlossesismoreinformative.Suchanapproachisquitenaturalforthestrategythatwasconsideredinourexample.Theprofit/lossfactorcalculatedonthebasisofmonthlydataissignificantlyhigherthanthesameratiocalculatedusingseparatetrades:1,176,797/223,203=5.3.

Page 291: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

5.6. Establishing the Backtesting System: Challenges andCompromisesThefirstchallengefacedbythesystemdeveloperconsistsinmaintainingthe

historical database that contains complete information required for adequatetesting of option trading strategies. Information must be reliable and free ofinaccuraciesanderrors.Thesetworequirementstothedatabase—completenessandreliability—contradicteachother tosomeextent.Bystriving to includeasmuch information as possible into thedatabase, thedeveloper inevitably facestheproblemof information reliability.Themore informationofdifferent typesthat is accumulated, the higher the probability of including some erroneous orinaccurate data in the database. Therefore, efforts applied to maximize thecompleteness of information should be balanced by the possibility of itsverification.Filtration of unacceptable signals is a compromise between striving for

maximumfiltrationausterity,on theonehand,and thedesirabilityofavoidingelimination of potentially profitable trading variants, on the other. The stricterthe filtration, the higher the probability of discarding promising tradingopportunities.Simulatingpricesandvolumesofsignalexecutionsisalsobasedon compromise. The more conservative the approach used in the simulation(executed volumes and prices are assumed to be worse than those used forsignalsgeneration),thelowertheestimatedstrategyeffectivenessandthehighertheprobabilitythattheresultsofrealtradingwillnotbeworsethanbacktestingresults.One of the most critical issues in developing a backtesting system is the

divisionofthehistoricalperiodcoveredbythedatabaseintoin-sampleandout-of-sample periods. The longer the in-sample period, the shorter the out-of-sample period (and vice versa). In general, one can claim that the developershouldstriveforprolongingtheout-of-sampleperiodasmuchaspossible.Thisallowstestingthestrategiesatvariousmarketphases(usingdatanotinvolvedinstrategyoptimization).However,extending theout-of-sampleperiod inevitablyresultsinshorteningthein-sampleperiod.Asaresult,theoptimizationwillnotbesufficiently reliable (since the in-sampleperiodwillnot includeallpossiblemarketphases).The most challenging problem that arises in the backtesting of all trading

strategies (and especially of the option-based strategies) is the danger ofoverfitting.Thisproblembecomesworsewhenthenumberofparametersusedinstrategy creation increases. Accordingly, the probability of overfitting can be

Page 292: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

reduced by decreasing the number of optimized parameters. However, areasonablecompromiseisneededhere,sinceexcessivereductioninthenumberof parameters may decrease strategy flexibility. As a result, a potentiallyprofitableversionofthestrategymaybeleftout.

Page 293: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Bibliography

Aldridge, Irene. High-Frequency Trading: A Practical Guide toAlgorithmicStrategiesandTradingSystems.Wiley,2009.Bandy,HowardB.QuantitativeTradingSystems.BlueOwlPress,2007.Barmish, B. Ross. On trading of equities: a robust control paradigm.

Proceedingsofthe17thIFACWorldCongress,pp.1621-1626,2008.Briza, Antonio C., and Prospero C. Naval Jr. Design of stock trading

system for historical market data using multiobjective particle swarmoptimizationof technical indicators.ProceedingsofGECCO2008. ACM,pp.1871-1878,2008.Bryant, Michael R. Building trading system using automatic code

generation.Workingpaper,2010.Burns, Patrick. Random portfolios for evaluating trading strategies.

Workingpaper,2006.Chan, Ernest P. Quantitative Trading: How to Build Your Own

AlgorithmicTradingBusiness.Wiley,2008.Harris, Larry. Trading and Exchanges: Market Microstructure for

Practitioners.OxfordUniversityPress,2002.Harris, Michael. Profitability and Systematic Trading: A Quantitative

ApproachtoProfitability,Risk,andMoneyManagement.Wiley,2008.Izraylevich,Sergey,andVadimTsudikman.SystematicOptionsTrading:

Evaluating,Analyzing,andProfitingfromMispricedOptionOpportunities.FTPress,2010.Izraylevich, Sergey, and Vadim Tsudikman. When volatility distorts

probability.Futures,vol.40(1),pp.44-47,2011.Izraylevich, Sergey, and Vadim Tsudikman. Measuring new risk

managementtools.Futures,vol.39(1),pp.42-47,2010.Izraylevich, Sergey, and Vadim Tsudikman. Risk management: facing

newchallenges.Futures,vol.38(12),pp.30-35,2009.Izraylevich, Sergey, and Vadim Tsudikman. Short volatility trading in

extrememarkets.Futures,vol.38(10),pp.28-31,2009.Izraylevich, Sergey, and Vadim Tsudikman. A better risk gauge for

optionsportfolios.Futures,vol.38(7),pp.24-27,2009.

Page 294: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Izraylevich, Sergey, and Vadim Tsudikman. An empirical solution tooptionpricing.Futures,vol.38(5),pp.28-31,2009.Kan, Raymond, and George Kirikos. Biases in evaluating trading

strategies.Workingpaper,1995.Katz, Jeffrey Owen, and Donna L. McCormick. The Encyclopedia of

TradingStrategies.McGraw-Hill,2000.Kim, Kendall. Electronic and Algorithmic Trading Technology: The

CompleteGuide.AcademicPress,2007.Masters,Timothy.Monte-Carlo evaluationof trading systems.Working

paper,2006.Meyers, Dennis. The siren call of optimized trading systems.Working

paper,1996.Moody, John, Lizhong Wu, Yuansong Liao, and Matthew Saffell.

Performancefunctionsandreinforcementlearningfortradingsystemsandportfolios.JournalofForecasting,vol.17,pp.441-470,1998.Munir,Danish,andDivyaKrishnan.Financialmodeling:asystemtotest

high-frequencytradingstrategies.Workingpaper,2009.Narang, Rishi K. Inside the Black Box: The Simple Truth About

QuantitativeTrading.Wiley,2009.Owens,Scott.Historicaltesting.Workingpaper,2005.Oya, Tomoyasu. Evaluating automated trading systems using random

walk securities. Proceedings of the 2008 International Conference onGeneticandEvolutionaryMethods.CSREAPress,pp.174-178,2008.Pardo,Robert.The Evaluation andOptimization of Trading Strategies.

Wiley,2008.Pavlidis, N.G., E.G. Pavlidis, M.G. Epitropakis, V.P. Plagianakos, and

M.N. Vrahatis. Computational intelligence algorithms for risk-adjustedtradingstrategies.Workingpaper,2006.Pinsky, E., and R. Sunitsky. Testing a high frequency trading strategy.

Workingpaper,2010.Ruggiero, Murray A. Cybernetic Trading Strategies. Developing a

Profitable Trading Systemwith State-of-the-Art Technologies. JohnWiley&Sons,1997.Schoenberg,Ronald.UsingDOEmethodintrading.Futures,vol.39(2),

2010.

Page 295: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Schroeder,Michael,JulieMcCann,andDanielHaynes.Tradingwithoutexplicitontologies.ProceedingsofAgent-mediatedE-commerce.Springer-Verlag,1999.Stridsmam, Thomas. Trading Systems and Money Management.

McGraw-Hill,2003.Tsudikman,Vadim,andSergeyIzraylevich.Bestmethodofmulticriteria

analysis.Futures,vol.39(6),pp.40-42,2010.Tsudikman, Vadim, and Sergey Izraylevich. Multicriteria analysis: A

practicalapproach.Futures,vol.39(7),pp.25-27,2010.Tsudikman, Vadim, Sergey Izraylevich, and Arsen Balishyan. Risk

Evaluation and Financial Crises: Review of New Approaches to RiskEvaluation:VaRCriticism,AlternativesandModifications.FTPress,2011.Vanstone, Bruce J., and Gavin Finnie. An Empirical Methodology for

Developing Stock-market Trading Systems Using Artificial NeuralNetworks.BondUniversity,2007.Vince, Ralph. The Mathematics of Money Management: Risk Analysis

TechniquesforTraders.Wiley,1992.Vliet,BenjaminVan.BuildingAutomatedTradingSystems.ElsevierInc,

2007.

Page 296: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Appendix

BasicNotionsCall option. A standard contract which gives its buyer the right (without

imposinganyobligations)tobuyacertainunderlyingassetataspecificpointintimeinthefuture(seeexpirationdate)forafixedprice(seestrikeprice).Put option. A standard contract which gives its buyer the right (without

imposinganyobligations)tosellacertainunderlyingassetataspecificpointintimeinthefuture(seeexpirationdate)forafixedprice(seestrikeprice).Strikeprice. The price, settled in a contract, atwhich the option buyer can

realizehisrighttobuyorselltheunderlyingasset.Expirationdate.Thedate,settled inacontract,beforewhich(seeAmerican

option)oratwhich(seeEuropeanoption)theoptionbuyercanrealizehisrighttobuyorselltheunderlyingasset.Americanoption.Atypeoftheoptioncontractwhichgivesitsbuyertheright

tobuyorselltheunderlyingassetatanypointuntiltheexpirationdate.Europeanoption.Atypeoftheoptioncontractwhichgivesitsbuyertheright

tobuyorselltheunderlyingassetattheexpirationdate.Premium. The value of the option paid by the buyer to the seller. The

premiumofstockoptionsisusuallyquotedfor1share,butthestandardcontractisgenerallycomprisedofoptionsfor100shares.Intrinsic value. A part of the option premium which is equal (for the call

option)tothedifferencebetweenthecurrentunderlyingassetpriceandthestrikeprice if this difference is positive, and zero otherwise. For the put option theintrinsicvalueisequaltothedifferencebetweenthestrikepriceandthecurrentunderlyingassetpriceifthisdifferenceispositive,andzeroifitisnegative.Time value. Another part of the option premium which is equal to the

differencebetweentheoptionpremiumandtheintrinsicvalue.Timevalueisariskpremiumpaidbyoptionbuyerstosellers.Timedecay.Theprocessofoptionstimevaluedecreasingwhiletheexpiration

dateapproaches.Theclosertheexpirationdate,thefasterthedecay.Options in-the-money.Optionswith thestrikepricedistant fromthecurrent

underlying asset price. For put options the strike price is higher, and for calloptions it is lower than theunderlying asset price.The intrinsicvalue of such

Page 297: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

optionsishigh,whereastheirtimevalueisrelativelylow.Options out-of-the-money. The strike price of these options is also distant

fromthecurrentunderlyingassetprice.However, in thiscase thestrikeofputoptionsislowerthantheunderlyingassetprice(andviceversaforcalloptions).Theintrinsicvalueofsuchoptionsiszero,andtheirtimevalueisrelativelylow.Options at-the-money. Options with the strike price close to the current

underlying asset price. The intrinsic value of such options is low, while theirtimevalueisrelativelyhigh.Combination. Any number of different options corresponding to the same

underlying asset can be considered and analyzed as a whole entity. Optionscomprising a combinationmay be long (bought) and/or short (sold), andmayhavethesameordifferentexpirationdatesandstrikeprices.Marginrequirements.Theminimumamountofcapital required tomaintain

anoptionposition. It is setby the regulatingauthoritiesand isgenerallymadetougherby theexchangeand/orbroker.Theamountofmargin requirements isrecalculateddailyinaccordancewiththeunderlyingassetpricechange.Historicalvolatility.Theindicatorreflectingtheextentoftheunderlyingasset

price variability at the specific time interval. It is usually estimated as thestandard deviation of relative increments of the underlying asset pricesnormalizedby the square rootof time.Thismethod is straightforwardand thesimplestone,althoughtherearealotofothermoreelaborateandsophisticatedtechniques. Historical volatility is widely used as the basic risk indicator. Inoptiontheoryitisakeyelementofallpricingmodels.Implied volatility. Another indicator reflecting the underlying asset price

variability.Unlikethehistoricalvolatility, it isnotbasedonhistoricalpricesofthe underlying asset, but is derived from current market prices of the option.Pricing models generally use the historical volatility value to calculate thetheoreticaloptionfairvalue.If insteadwesubstitute theoptionmarketpriceinthe model formula and solve the inverse problem, we can derive volatility“implied”by theoptionprice. Impliedvolatilityexpressesmarketexpectationsfor future variability of the underlying asset price. Besides, this indicator is aconvenient measure of option expensiveness. The divergence of implied andhistorical volatility often creates favorable opportunities for implementingdifferentoptiontradingstrategies.TheGreeks(vega,gamma,delta,rho,theta).Indicatorsusedtoestimatethe

risksofoptionsreflectingtheextenttowhichthevalueoftheoptionrespondstosmallchanges inspecificvariables.Theunderlyingassetprice,volatility, time,

Page 298: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

andinterestratecanbetakenasvariables.TheGreeksarecalculatedanalyticallyas partial derivatives of the option price with respect to a given variable. Tocalculateaderivative, acertainoptionpricingmodel isused (forexample, theBlack-Scholesformula).Theseindicatorscanbeinterpretedasthespeedoftheoptionpricechangeinresponsetothevariablechange.Delta. The first partial derivative of the option price with respect to the

underlyingassetprice. Itestimates thechange in theoptionpricegivenaone-pointchangeintheunderlyingassetprice.Thedeltaisalwayspositiveforacalloptionandnegativeforaputoption.Gamma.Thesecondpartialderivativeoftheoptionpricewithrespecttothe

underlying asset price. It estimates the change in the delta given a one-pointchange in the underlying asset price. Gamma shows if the speed of the deltachangeisincreasing,decreasing,orconstant.Vega. The first partial derivative of the option price with respect to the

underlying asset volatility. It estimates the change in the option price given aone-pointchangeintheunderlyingvolatility.This indicatorplaysanimportantroleinthestrategiesofvolatilitytrading.Theta.Thefirstpartialderivativeof theoptionpricewithrespect to time.It

estimatesthechangeintheoptionpriceinresponsetothedecreaseintimeleftuntilexpirationbyoneunit.Thetacharacterizesthespeedoftimedecay.Rho.Thefirstorderderivativeoftheoptionpricewithrespecttotherisk-free

interestrate.Itestimatesthechangeintheoptionpricegivenaone-pointchangeintheinterestrate.Rhoexpressesthesensitivityoftheoptionpricetochangesintheinterestrate.Payofffunction.Therelationshipbetweenthepriceofaseparateoptionora

combinationandtheunderlyingassetprice,estimatedforaspecificfuturedate.The payoff function of a combination consisting of options with the sameexpiration date and calculated for the expiration date is a broken line. If theestimation is made for the date preceding expiration or if the combinationincludes optionswith different expirationdates, the payoff function is a curve(calculatedonthebasisofaspecificoptionpricingmodel).

PayoffFunctionsSeparateOptionsFigureA.1 shows payoff functions of long and short call and put options.

Solidlinesdepictpayofffunctionsfortheexpirationdate;dashedlines,forsome

Page 299: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

datebeforetheexpiration.Atagivenunderlyingassetprice,themoretimeleftuntil expiration, the higher the value of the long position (in the figures thedashed lines of both call and put options are higher than solid ones).Accordingly, the closer the expiration date, the higher the value of the shortposition(dashedlinesarelowerthansolidonesinthefigures).Thereasonisthatthe option value consists of intrinsic and time values. The latter decreasescontinuouslywhenapproaching theexpirationdate (thisphenomenon iscalledtimedecay).

FigureA.1.Payofffunctionsreflectingprofitsandlossesofbuyers(long)andsellers(short)ofcallandputoptions.Boldlinesshowpayofffunctions

correspondingtotheexpirationdate;thinlines,toadatebeforetheexpiration.

The buyer of a call option realizes theoretically unlimited profit when theunderlyingassetpricegrowsandlimitedlosswhenitdecreases.Theputoption

Page 300: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

buyer realizes theoretically unlimited profit when the underlying asset pricedecreasesandlimitedprofitwhenitincreases.Inbothcasesthemaximumlossislimitedtothepremiumpaid.Payofffunctionsofshortoptionsaretheoppositeofthoseoflongoptions(see

FigureA.1). Profits of the seller are limited to the premium received, and thelossesare theoreticallyunlimitedanddependon theextentofunderlyingassetpricemove.Themoretheunderlyingassetpriceincreases,thehigherthelossoftheshortcallis.Correspondingly,thelowerthepricedecrease,thehigheristhelossoftheshortput.

OptionCombinationsMore complicated forms of payoff functions can be obtained when several

differentoptionsarecombined.Thisfeaturerepresentsoneofthemostimportantadvantages of investing in options. Construction of complex optioncombinationsallowscreatingamultitudeofnonlinearpayofffunctions,therebyconsiderably enlarging the potentialities and flexibility of the sophisticatedinvestor.Applyingdifferentprinciplesofoptions combining (suchas ratioof long to

shortoptions,callstoputsratio,positioningstrikepricesrelativetothecurrentunderlying price, selection of expiration dates, and so on), one can createcombinationswithalmostanydesiredtypeofpayofffunction.Thecombinationsareusuallyclassifiedbytheprinciplesoftheircreationandtheshapeofpayofffunctions characteristic of them. In the literature (including this book) suchclassesarecalled“optionstrategies.”Nextwedescribeseveralexamplesofthemostpopularstrategies.Straddle

The long straddle is created by buying call and put options with the samestrike price and expiration date. The number of calls is usually equal to thenumberofputs(asinFigureA.2),butthisisnotacompulsorycondition.Iftheunderlying asset price is close to the strike price at the expiration date, thecombination isunprofitablewitha loss limited to thepremiumpaidfor it. Ifaconsiderable pricemovement occurs (regardless of the direction), the straddlegeneratesprofit.Theshortstraddleiscreatedunderthesameprinciplesbuttheoptionsaresoldratherthanbought.Accordingly,thecombinationisprofitableiftheunderlyingassetpricedoesnotchangealotandgenerateslosseswhenthereisaconsiderablepricemovementinanydirection(seeFigureA.2).

Page 301: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

FigureA.2.Payofffunctionsoflongandshortstraddlescorrespondingtotheexpirationdate(boldlines).Thinlinesshowpayofffunctionsofseparate

optionsformingthecombinations.Strangle

The long strangle is created by buying call and put options with the sameexpirationdatebutdifferentstrikeprices.Thestrikeofthecallisusuallyhigherthanthatof theput,andtheirquantitiesinthecombinationareequal,althoughneither of these conditions is compulsory. Correspondingly, the short stranglecombination is created by selling these options. Payoff functions of long andshortstranglesareshowninFigureA.3.Profitsand lossesofstranglesdependon the changes of the underlying asset price in the same manner as wasdescribed for straddles.Thedifferencebetween these two strategies is that themaximumlossof longstranglesand themaximumprofitofshortstranglesarelower than those of straddles. However, the probabilities of these profits andlossesarehigherforstranglesthanforstraddles.

Page 302: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

FigureA.3.Payofffunctionsoflongandshortstranglescorrespondingtotheexpirationdate(boldlines).Thinlinesshowpayofffunctionsofseparate

optionsformingthecombinations.CalendarSpreads

Straddles and strangles, discussed previously, are created by combiningoptionswiththesameexpirationdate.Calendarspreadsconsistofoptionswithdifferent expiration dates. By selling the call (or put) option with the nearestexpirationdateandbuyingthecall(orput)optionwiththelaterexpirationdate,we construct the combination corresponding to the short calendar spreadstrategy.Thisisadebitstrategy(i.e.,itrequiresinvestingfunds)sincetheoptionboughtisalwaysmoreexpensivethantheoptionsold(owingtothefactthatthepremium of more distant option has more time value). The payoff functionshowninFigureA.4 is calculated for the expirationdateof thenearest option(we assume closing the second option position on that date). This strategygeneratesalimitedprofitiftheunderlyingassetpricechangesaresmall.Ifpricemovesaresubstantial,thecombinationgeneratesalimitedloss.Strikepricesofbothoptionsmaybethesame(asinFigureA.4)ordifferent. In the lattercasetheamountofthemaximumpossibleprofitislowerbutitsprobabilityishigher.

Page 303: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

FigureA.4.Payofffunctionsofshortandlongcalendarspreads.Boldlinesshowpayofffunctionsofcombinationsfortheexpirationdateofthenearestoption,andthinlinesshowpayofffunctionsofseparateoptionsformingthecombinations(brokenlinesdenoteoptionswiththenearestexpirationdate,andcurvesdenoteoptionswithalaterexpirationdate).

Thelongcalendarspreadstrategyistheoppositeoftheshortcalendarspreadin every respect. The combination is created by selling the option with thenearest expiration date and buying the option with the later expiration date.Accordingly, this strategy is a credit one. Both profits and losses of thiscombinationarelimited.Profitisgeneratedundersubstantialpricemovements,and loss is generated when the underlying asset price does not changeconsiderably(seeFigureA.4).Allcombinationsdescribedpreviouslyarerelatedtomarket-neutralstrategies.

Itmeans that short combinationsbecomeprofitablewhen theunderlying assetprice fluctuates within a quite narrow range. Losses are generated as aconsequence of strong price movements. The opposite is true for longcombinations. Such strategies are called neutral since they do not requireforecasting the market direction (i.e., growth or fall of the underlying assetprice). Although there are a lot of market-neutral strategies, we restrict ourdescription to those which are mentioned most often in this book. Besidesmarket-neutralstrategies,thereisanextensiveclassofoptionstrategiesbasedonforecasting future price direction. But since this book is dedicated mostly toneutral strategies, we will discuss only a few combinations relating to suchstrategies(moredetaileddescriptionscanbeeasilyfoundintheliterature).BullandBearSpreads

Page 304: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Buyingacalloptionwithacertainstrikepriceandsellingacalloptionwithahigherstrikepriceproducesabullspread.Thisstrategymakesa limitedprofitwhentheunderlyingassetpriceincreases,andyieldsalimitedlossifitdecreases(see FigureA.5). Both options have the same expiration date. Since the callpremium is higher for the lower strike prices, a bull spread is a debitcombinationrequiringinitial investments.Abullspreadcanalsobecreatedbybuyingaputwithalowerstrikepriceandsellingaputwithahigherstrikeprice(inthiscaseitwillbeacreditcombination).

FigureA.5.Payofffunctionsofbullandbearspreadscorrespondingtotheexpirationdate(boldlines).Thinlinesshowpayofffunctionsofseparate

optionsformingthecombinations.

Abearspreadiscreatedbybuyingacall(put)withacertainstrikepriceandselling a call (put) with a lower strike price. Such a combination generates alimitedprofitiftheunderlyingassetpricefalls,andalimitedlossotherwise(seeFigure A.5). Using calls allows creating a credit position, whereas a debitpositioniscreatedusingputoptions.

Page 305: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Index

Page 306: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

A

acceptablevalues,determiningrangeof,76,85-87accessinhistoricaldatabase(inbacktestingsystems),220-221adaptiveoptimization,233-234additiveconvolution,97,172adjacentcells,averageof,103-104alternating-variableascentoptimizationmethod,116-118

comparisonwithrandomsearchmethod,132effectivenessof,128

Americanoption,defined,251amoebasearchoptimizationmethod,123-127analysis of variance (ANOVA) in one-dimensional capital allocation

system,190-191analyticalmethod(indexdeltacalculation),142-143analyticalmethod(VaRcalculation),137arbitragesituations,testsfor,223assets

indelta-neutralstrategy,5inportfolio

analysisofdelta-neutralitystrategy,24-25analysisofpartiallydirectionalstrategies,58

priceforecasts,35call-to-putratioinportfolio,40-49delta-neutralityappliedto,49-57embeddinginstrategystructure,36-40

asymmetrycoefficient,157-159,180-181asymmetryofportfolio

analysisofdelta-neutralitystrategy,29-30analysisofpartiallydirectionalstrategies,60

at-the-money,defined,252

Page 307: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

attainabilityofdelta-neutrality,14,19-20,51,54-55automatedtradingsystems

defined,xvempiricalapproachtodevelopment,xviii-xixrationalapproachtodevelopment,xix-xxscientificapproachtodevelopment,xviii

averageofadjacentcells,103-104

Page 308: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

B

backtestingsystemschallengesandcompromises,246frameworkfor,232

adaptiveoptimization,233-234in-sampleoptimization/out-of-sampletesting,232-233overfittingproblem,234-236

historicaldatabase,217dataaccess,220-221datareliability/validity,222-224datavendorsfor,218recurrentcalculations,221-222structureof,219-220

orderexecutionsimulation,228commissions,231pricemodeling,230-231volumemodeling,229

performanceevaluationindicators,236backtestingexample,242-245characteristicsofreturn,237-238consistency,241maximumdrawdown,238-239profit/lossfactor,240-241Sharpecoefficient,239-240singleevents,236unitoftimeframe,236

signalsgeneration,225filtrationofsignals,227-228functionalsdevelopment/evaluation,226-227principlesof,225-226

Page 309: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

bearspreads,payofffunctions,258-259boundariesofdelta-neutrality,6-10

incalmversusvolatilemarkets,10-11,13optimalportfolioselection,67-72inpartiallydirectionalstrategies,49-55,57portfoliostructureandpropertiesat,62-65quantitativecharacteristicsof,14-21

brokercommissions(inbacktestingsystems),231bullspreads,payofffunctions,258-259

Page 310: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

C

calendaroptimization,defined,73calendarspreads,payofffunctions,257-258calloptions

defined,251payofffunctions,254-255

call-to-putratioinportfolio,40-42factorsaffecting,44-49

calmmarketsdelta-neutralityboundariesin,10-13,51-52portfoliostructureanalysis

longandshortcombinations,26-27lossprobability,31-33numberofcombinationsinportfolio,22-24numberofunderlyingassetsinportfolio,24-25portfolioasymmetry,29-30straddlesandstrangles,28-29VaR,33-34

capitalallocationchallengesandcompromises,214-216classicalportfoliotheory,168-169

optionportfolios,featuresof,169-170indelta-neutralstrategy,5indicators

asymmetrycoefficient,180-181delta,180expectedprofit,179inversely-to-the-premium,175-176inversely-to-the-premiumversusstock-equivalency,176-178profitprobability,179

Page 311: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

stock-equivalency,174-175VaR,181-183weightfunctionforreturn/riskevaluation,178-179

multidimensionalsystem,172,204-205one-dimensionalsystemversus,206-209

one-dimensionalsystem,170,172analysisofvariancein,190-191factorsaffecting,183-186historicalvolatilityin,186-187measuringcapitalconcentration,192-195multidimensionalsystemversus,206-209numberofdaystoexpirationin,187-188numberofunderlyingassetsin,188-190weightfunctiontransformation,196-204

inpartiallydirectionalstrategies,43portfoliosystem,209-211

elementalapproachversus,173-174,211-214capitalconcentration

concaveversusconvexweightfunctioncomparison,202-204measuring,192-195one-dimensionalversusmultidimensionalcapitalallocationsystems,

208-209portfolioversuselementalcapitalallocationsystems,213-214

capitalmanagementsystemsfirstlevelof,167inpartiallydirectionalstrategies,43secondlevelof,167

characteristicsofreturnperformanceindicator,237-238classicalportfoliotheory,168-169

optionportfolios,featuresof,169-170closingsignals

indelta-neutralstrategy,4

Page 312: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

generating(inbacktestingsystems),225filtrationofsignals,227-228functionalsdevelopment/evaluation,226-227principlesof,225-226

inpartiallydirectionalstrategies,42combinationofoptions,3combinations

defined,252factorsaffectingcall-to-putratio,44-49long and short combinations, analysis of delta-neutrality strategy,

26-27inpartiallydirectionalstrategies,43payofffunctionsfor,255

bull/bearspreads,258-259calendarspreads,257-258straddles,256strangles,256-257

inportfolioanalysisofdelta-neutralitystrategy,22-24analysisofpartiallydirectionalstrategies,57-59

commissions(inbacktestingsystems),231computation,defined,74concaveweightfunction,196,198

convexweightfunctioncomparedbycapitalconcentration,202-204byprofit,200-202

conditionaloptimization,74consistencyperformanceindicator,241constraintsinconditionaloptimization,74convexweightfunction,196-198

concaveweightfunctioncomparedbycapitalconcentration,202-204

Page 313: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

byprofit,200-202convolution

ofindicators,172inmulticriteriaoptimization,97-98

correlationanalysisofobjectivefunctions,91-96riskindicatorinterrelationships,162-165

correlationcoefficientinobjectivefunctionrelationships,91criterionparametersinpartiallydirectionalstrategies,42criterionthresholdindex,14-17,51-52

pointofdelta-neutrality,determining,7-8

Page 314: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

D

dataaccessinhistoricaldatabase(inbacktestingsystems),220-221datareliabilityinhistoricaldatabase(inbacktestingsystems),222-224datavalidityinhistoricaldatabase(inbacktestingsystems),222-224datavendorsforhistoricaldatabase(inbacktestingsystems),218database(inbacktestingsystems),217

dataaccess,220-221datareliability/validity,222-224datavendorsfor,218recurrentcalculations,221-222structureof,219-220

deformablepolyhedronoptimizationmethod,123-127delta,138-139,169,180,253.Seealsoindexdeltadelta-neutralstrategy,xvii,4

basicformof,4-5optimalportfolioselection,67-72optimizationspaceof,79-80

acceptablerangeofparametervalues,85-87optimizationdimensionality,80-85optimizationstep,87-88

partiallydirectionalstrategiesversus,34pointsandboundariesof,6-10

incalmversusvolatilemarkets,10-11,13quantitativecharacteristicsof,14-21

portfoliostructureanalysis,21-34longandshortcombinations,26-27lossprobability,31-33numberofcombinationsinportfolio,22-24numberofunderlyingassetsinportfolio,24-25portfolioasymmetry,29-30

Page 315: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

straddlesandstrangles,28-29VaR,33-34

portfoliostructureandpropertiesatboundaries,62-65priceforecastsversus,35

delta-neutralityappliedtopartiallydirectionalstrategies,49-55,57attainability,14,19-20,51,54-55

derivatives,Greeksas,138determinationcoefficientinobjectivefunctionrelationships,91dimensionalityofoptimization,80-85

one-dimensionaloptimization,80-82two-dimensionaloptimization,83-85

directfiltrationmethod,227directmethods,defined,78directsearchoptimizationmethods,115

alternating-variableascentmethod,116-118comparisonofeffectiveness,127-130drawbacksto,115-116Hook-Jeevesmethod,118-120Nelder-Meadmethod,123-127Rosenbrockmethod,120-123

directionalstrategies,xvidiversification,underlyingassetsinportfolio,24diversityofoptionsavailable,3dominationinParetomethod,99

Page 316: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

E

elementalcapitalallocationapproach,173-174portfoliosystemversus,211-214

embeddingpriceforecastsinstrategystructure,36-40empiricalapproachtoautomatedtradingsystemdevelopment,xviii-xixequitycurveinbacktestingresults,242-244Europeanoption,defined,251evaluation

ofoptionpricing,1-2ofperformance(inbacktestingsystems),236

backtestingexample,242-245characteristicsofreturn,237-238consistency,241maximumdrawdown,238-239profit/lossfactor,240-241Sharpecoefficient,239-240singleevents,236unitoftimeframe,236

exhaustivesearchoptimizationmethod,114-115expectedprofit(capitalallocationindicator),179expirationdate,169

defined,251indelta-neutralstrategy,8-13effectoncall-to-putratio,48-49inone-dimensionalcapitalallocationsystem,187-188

exponentialannualreturn,237

Page 317: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

F

fairvaluepricing,determining,1-2filtrationofsignals,227-228firstlevelofcapitalmanagementsystems,167fixedparameters,steadinessofoptimizationspace,109-110forecastsofunderlyingassetprices,35

call-to-putratioinportfolio,40-42factorsaffecting,44-49

delta-neutralityappliedto,49-57embeddinginstrategystructure,36-40

fulloptimizationcycle,defined,74functionals,developmentandevaluationof,226-227fundamentalanalysisforpriceforecasts,35

Page 318: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

G

gamma,138,253generatingsignalsindelta-neutralstrategy,4geneticalgorithms,115globalmaximum,defined,75Greeks,169

defined,253inriskevaluation,138-139

Page 319: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

H

hedgingstrategies,xvihistoricaldatabase(inbacktestingsystems),217

dataaccess,220-221datareliability/validity,222-224datavendorsfor,218recurrentcalculations,221-222structureof,219-220

historicalmethod(VaRcalculation),137historicaloptimizationperiod,steadinessofoptimizationspace,112-114historicalvolatility

defined,252indelta-neutralstrategy,80inone-dimensionalcapitalallocationsystem,186-187recurrentcalculationsapplied,221-222inriskevaluation,136

Hook-Jeevesoptimizationmethod,118-120comparisonwithrandomsearchmethod,132effectivenessof,128

I–J–Kidealstrategy,241impliedvolatility

defined,252estimations,224

in-sampleoptimization,232-233in-the-money,defined,252indexdelta,139,141,169

analysisofeffectivenessatdifferenttimehorizons,150-156

Page 320: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

inriskevaluation,146-149analyticalmethodofcalculation,142-143applicabilityof,156-157calculationalgorithm,141-142exampleofcalculation,144-146

indirectfiltrationmethod,227interrelationships

betweenriskindicators,161correlationanalysis,162-165testing,161

ofobjectivefunctions,91-96intrinsicvalue,defined,251inversely-to-the-premium(capitalallocationindicator),175-176

stock-equivalencyversus,176-178investmentassets

indelta-neutralstrategy,5inportfolio

analysisofdelta-neutralitystrategy,24-25analysisofpartiallydirectionalstrategies,58

priceforecasts,35call-to-putratioinportfolio,40-49delta-neutralityappliedto,49-57embeddinginstrategystructure,36-40

isolinesindelta-neutralityboundaries,9

Page 321: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

L

lengthofdelta-neutralityboundary,14,17-19,51-54lifespanofoptions,limitednatureof,2-3linearannualreturn,237linearassets,optionsversus,xviilinearfinancialinstruments

nonlinearinstrumentsversus,135riskevaluation,136-137

localmaximum,defined,75longcalendarspreads,258longcombinations

analysisofdelta-neutralitystrategy,26-27factorsaffectingcall-to-putratio,44-49inportfolio,analysisofpartiallydirectionalstrategies,58-59

longoptions,payofffunctions,254-255longpositions,limitationson,111longstraddles,256longstrangles,256lossprobability,159-160

analysisofdelta-neutralitystrategy,31-33inportfolio,analysisofpartiallydirectionalstrategies,60

Page 322: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

M

marginrequirements,170,252marketimpact,230marketvolatility,effectoncall-to-putratio,46-47market-neutralstrategies,258.Seealsodelta-neutralstrategymarket-neutrality,xviiMarkowitz,Harry,168maximumdrawdown,238-239

asobjectivefunctioneffectonoptimizationspace,90relationshipwithpercentageofprofitabletrades,93relationshipwithprofit,92

mean,ratiotostandarderror,104-105minimaxconvolution,97modeling(inbacktestingsystems),228

commissions,231pricemodeling,230-231volumemodeling,229

moneymanagementindelta-neutralstrategy,5Monte-Carlomethod(VaRcalculation),137movingaverages,comparedwithaverageofadjacentcells,103multicriteriaoptimization,79

convolution,97-98nontransitivityproblem,96-97Paretomethod,99-102robustnessofoptimalsolution,102

averagingadjacentcells,103-104ratioofmeantostandarderror,104-105surfacegeometry,106-108

steadinessofoptimizationspace,108-109

Page 323: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

relativetofixedparameters,109-110relativetohistoricaloptimizationperiod,112-114relativetostructuralchanges,110-111

multidimensionalcapitalallocationsystem,172,204-205one-dimensionalsystemversus,206-209

multipleregressionanalysisinone-dimensionalcapitalallocationsystem,190-191multiplicativeconvolution,97,172

Page 324: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

N

Nelder-Meadoptimizationmethod,123-129neuronets,115nodes,defined,74nonlinearfinancialinstruments

linearinstrumentsversus,135riskevaluation,138-139riskindicators,139

asymmetrycoefficient,157-159indexdelta,141-157interrelationshipsbetween,161-165lossprobability,159-160VaR(ValueatRisk),140-141

nonlinearity,optionsevaluationand,1-2nonmodaloptimization,76nonmodaloptimizationspace,82nontransitivityinmulticriteriaoptimization,96-97normalization,184

Page 325: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

O

objectivefunctiondefined,74effectonoptimizationspace,89-91explained,78-79interrelationshipsof,91-96usageof,88

one-dimensionalcapitalallocationsystem,170-172analysisofvariancein,190-191factorsaffecting,183-186historicalvolatilityin,186-187measuringcapitalconcentration,192-195multidimensionalsystemversus,206-209numberofdaystoexpirationin,187-188numberofunderlyingassetsin,188-190weightfunctiontransformation,196-204

one-dimensionaloptimization,80-82openingsignals

indelta-neutralstrategy,4generating(inbacktestingsystems),225

filtrationofsignals,227-228functionalsdevelopment/evaluation,226-227principlesof,225-226

inpartiallydirectionalstrategies,42optimalarea,defined,75optimaldelta-neutralportfolioselection,67-72optimalsolution

defined,75robustnessof,82,102

averagingadjacentcells,103-104

Page 326: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

ratioofmeantostandarderror,104-105surfacegeometry,106-108

optimizationadaptiveoptimization,233-234challengesandcompromisesin,134defined,73dimensionalityof,80-85

one-dimensionaloptimization,80-82two-dimensionaloptimization,83-85

in-sampleoptimization,232-233multicriteriaoptimization

convolution,97-98nontransitivityproblem,96-97Paretomethod,99-102robustnessofoptimalsolution,102-108steadinessofoptimizationspace,108-114

objectivefunctioneffectonoptimizationspace,89-91explained,78-79interrelationshipsof,91-96usageof,88

parametricoptimization,explained,73-75terminology,74-75

optimizationmethodsdirectsearchmethods,115

alternating-variableascentmethod,116-118comparisonofeffectiveness,127-130drawbacksto,115-116Hook-Jeevesmethod,118-120Nelder-Meadmethod,123-127Rosenbrockmethod,120-123

Page 327: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

exhaustivesearch,114-115randomsearch,131-133

optimizationspacedefined,74ofdelta-neutralstrategy,79-80

acceptablerangeofparametervalues,85-87optimizationdimensionality,80-85optimizationstep,87-88

effectofobjectivefunctionson,89-91explained,75-77steadinessof,108-109

relativetofixedparameters,109-110relativetohistoricaloptimizationperiod,112-114relativetostructuralchanges,110-111

optimizationstep,76,87-88optioncombinations

defined,252factorsaffectingcall-to-putratio,44-49long and short combinations, analysis of delta-neutrality strategy,

26-27inpartiallydirectionalstrategies,43payofffunctionsfor,255

bull/bearspreads,258-259calendarspreads,257-258straddles,256strangles,256-257

inportfolioanalysisofdelta-neutralitystrategy,22-24analysisofpartiallydirectionalstrategies,57-59

optionportfolioscapitalallocationindicators

asymmetrycoefficient,180-181

Page 328: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

delta,180expectedprofit,179inversely-to-the-premium,175-176inversely-to-the-premiumversusstock-equivalency,176-178profitprobability,179stock-equivalency,174-175VaR,181-183weightfunctionforreturn/riskevaluation,178-179

capitalallocationsystems,challengesandcompromises,214-216featuresof,169-170multidimensionalcapitalallocationsystem,172,204-205

one-dimensionalsystemversus,206-209one-dimensionalcapitalallocationsystem,170-172

analysisofvariancein,190-191factorsaffecting,183-186historicalvolatilityin,186-187measuringcapitalconcentration,192-195multidimensionalcapitalallocationsystemversus,206-209numberofdaystoexpirationin,187-188numberofunderlyingassetsin,188-190weightfunctiontransformation,196-204

portfoliocapitalallocationsystem,209,211elementalsystemversus,173-174,211-214

optionstrategies,payofffunctionsfor,255bull/bearspreads,258-259calendarspreads,257-258straddles,256strangles,256-257

optiontradingstrategieslimitedoptionslifespan,2-3nonlinearityandoptionsevaluation,1-2

Page 329: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

optiondiversity,3options,linearassetsversus,xviiorderexecutionsimulation(inbacktestingsystems),228

commissions,231pricemodeling,230-231volumemodeling,229

out-of-sampletesting,232-233out-of-the-money,defined,252overfittingproblem,234-236

Page 330: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

P

parametervalues,determiningacceptablerangeof,76,85-87parametricoptimization,73-75.SeealsooptimizationParetomethod,172

inmulticriteriaoptimization,99-102partiallydirectionalstrategies,xvii

basicformof,42-43call-to-putratio,40-42

factorsaffecting,44-49delta-neutralityappliedto,49-57delta-neutralitystrategyversus,34embeddingforecastinstrategystructure,36-40featuresof,35portfoliostructureanalysis,57-61

payofffunctionscall-to-putratioinportfolio,40-42

factorsaffecting,44-49defined,253foroptioncombinations,255

bull/bearspreads,258-259calendarspreads,257-258straddles,256strangles,256-257

inoptionportfolios,169forseparateput/calloptions,254-255

percentageofprofitabletradesasobjectivefunctioneffectonoptimizationspace,90relationshipwithmaximumdrawdown,93relationshipwithprofit,92

performanceevaluationindicators(inbacktestingsystems),236

Page 331: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

backtestingexample,242-245characteristicsofreturn,237-238consistency,241maximumdrawdown,238-239profit/lossfactor,240-241Sharpecoefficient,239-240singleevents,236unitoftimeframe,236

pointsofdelta-neutrality,6-10incalmversusvolatilemarkets,10-11,13quantitativecharacteristicsof,14-21

polymodaloptimization,76polymodaloptimizationspace,82portfolioasymmetry,analysisofpartiallydirectionalstrategies,60portfoliocapitalallocationapproach,173-174,209-211

elementalsystemversus,211-214portfolioconstruction

capitalallocationindicatorsasymmetrycoefficient,180-181delta,180expectedprofit,179inversely-to-the-premium,175-176inversely-to-the-premiumversusstock-equivalency,176-178profitprobability,179stock-equivalency,174-175VaR,181-183weightfunctionforreturn/riskevaluation,178-179

capitalallocationsystems,challengesandcompromises,214-216classicalportfoliotheory,168-169

optionportfolios,featuresof,169-170multidimensionalcapitalallocationsystem,204-205

Page 332: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

one-dimensionalsystemversus,206-209one-dimensionalcapitalallocationsystem

analysisofvariancein,190-191factorsaffecting,183-186historicalvolatilityin,186-187measuringcapitalconcentration,192-195multidimensionalsystemversus,206-209numberofdaystoexpirationin,187-188numberofunderlyingassetsin,188-190weightfunctiontransformation,196-204

optionportfoliosmultidimensionalcapitalallocationsystem,172one-dimensionalcapitalallocationsystem,170-172portfolioversuselementalapproachtocapitalallocation,173-

174portfoliocapitalallocationsystem,209-211

elementalsystemversus,211-214portfoliostructureatdelta-neutralityboundaries,62-65portfoliostructureanalysis

ofdelta-neutralitystrategy,21-34longandshortcombinations,26-27lossprobability,31-33numberofcombinationsinportfolio,22-24numberofunderlyingassetsinportfolio,24-25portfolioasymmetry,29-30straddlesandstrangles,28-29VaR,33-34

ofpartiallydirectionalstrategies,57-61positionclosingsignals

indelta-neutralstrategy,4inpartiallydirectionalstrategies,42

positionopeningsignals

Page 333: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

indelta-neutralstrategy,4inpartiallydirectionalstrategies,42

position opening/closing signals, generating (in backtesting systems),225

filtrationofsignals,227-228functionalsdevelopment/evaluation,226-227principlesof,225-226

premiumdefined,251inversely-to-the-premium(capitalallocationindicator),175-176

stock-equivalencyversus,176-178priceforecasts,35

call-to-putratioinportfolio,40-42factorsaffecting,44-49

delta-neutralityappliedto,49-57embeddinginstrategystructure,36-40

pricemodeling(inbacktestingsystems),230-231profit

concaveversusconvexweightfunctioncomparison,200-202asobjectivefunction

effectonoptimizationspace,89relationshipwithmaximumdrawdown,92relationshipwithpercentageofprofitabletrades,92relationshipwithSharpecoefficient,91

one-dimensionalversusmultidimensionalcapitalallocationsystems,206-208portfolioversuselementalcapitalallocationsystems,211-213

profitprobability(capitalallocationindicator),179profit/lossfactor,240-241putoptions

defined,251payofffunctions,254-255

Page 334: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Q–Rquantitativecharacteristicsofdelta-neutralityboundaries,14-21quantitativecharacteristicsanalysis,244-245randomsearchoptimizationmethod,131-133rangeofacceptablevalues,determining,76,85-87rationalapproachtoautomatedtradingsystemdevelopment,xix-xxrecurrent calculations in historical database (in backtesting systems),

221-222regressionanalysis,154reliabilityofdatainhistoricaldatabase(inbacktestingsystems),222-224requirementsindelta-neutralstrategy,5restrictionsindelta-neutralstrategy,5rho,138,253risk,lackofdefinitionfor,135riskevaluation

effectivenessofindexdelta,146-149linearfinancialinstruments,136-137nonlinearfinancialinstruments,138-139

riskindicators,139asymmetrycoefficient,157-159establishingriskmanagementsystems,165-166indexdelta,141

analysisofeffectivenessatdifferenttimehorizons,150-156analysisofeffectivenessinriskevaluation,146-149analyticalmethodofcalculation,142-143applicabilityof,156-157calculationalgorithm,141-142exampleofcalculation,144-146

interrelationshipsbetween,161correlationanalysis,162-165testing,161

Page 335: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

lossprobability,159-160VaR(ValueatRisk),140-141

riskmanagementindelta-neutralstrategy,5establishingriskindicators,165-166theGreeks,169inpartiallydirectionalstrategies,43

robustnessofoptimalsolution,82,102averagingadjacentcells,103-104defined,75ratioofmeantostandarderror,104-105surfacegeometry,106-108

Rosenbrockoptimizationmethod,120-123,129rotatingcoordinatesoptimizationmethod,120-123

Page 336: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

S

scientificapproachtoautomatedtradingsystemdevelopment,xviiisecondlevelofcapitalmanagementsystems,167selectingoptimaldelta-neutralportfolio,67-72selectiveconvolution,97Sharpecoefficient,239-240

asobjectivefunctioneffectonoptimizationspace,90relationshipwithprofit,91

shortcalendarspreads,257shortcombinations

analysisofdelta-neutralitystrategy,26-27factorsaffectingcall-to-putratio,44-49inportfolio,analysisofpartiallydirectionalstrategies,58-59

shortoptions,payofffunctions,254-255shortstraddles,256shortstrangles,256signal-generationindicatorsindelta-neutralstrategy,4signalsgeneration

inbacktestingsystems,225filtrationofsignals,227-228functionalsdevelopment/evaluation,226-227principlesof,225-226

indelta-neutralstrategy,4simplexsearchoptimizationmethod,123-127simulationoforderexecution(inbacktestingsystems),228

commissions,231pricemodeling,230-231volumemodeling,229

singleeventsinperformanceevaluation,236

Page 337: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

slippage,230smoothing,advantagesof,88smoothnessofoptimizationspace,77spreads,xviistandarddeviationofassetreturnsinriskevaluation,136standarderror,ratiotomean,104-105steadinessofoptimizationspace,77,108-109

relativetofixedparameters,109-110relativetohistoricaloptimizationperiod,112-114relativetostructuralchanges,110-111

stock-equivalency(capitalallocationindicator),5,174-175inversely-to-the-premiumversus,176-178

straddlesanalysisofdelta-neutralitystrategy,28-29payofffunctions,256

stranglesanalysisofdelta-neutralitystrategy,28-29payofffunctions,256-257

strikeprice,defined,251strikesrangeindex,14-17,51-52structuralchanges,steadinessofoptimizationspace,110-111structuraloptimization,defined,73surfacegeometry,determiningrobustnessofoptimalsolution,106-108survivalbiasproblem,218synchronization,219syntheticassetsstrategies,xvi

Page 338: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

T

technicalanalysisforpriceforecasts,35testingriskindicatorinterrelationships,161.Seealsobacktestingsystemstheta,138,253three-dimensionaloptimization,77timedecay,defined,252timehorizons,effectivenessofindexdelta,150-156timevalue,defined,252transformationofweightfunction,196-204transitivityinmulticriteriaoptimization,96-97two-dimensionaloptimization,77,83-85

Page 339: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

U

unconditionaloptimization,74underlyingassetsinone-dimensionalcapitalallocationsystem,188-190unimodaloptimization,76unimodaloptimizationspace,82unitoftimeframeinperformanceevaluation,236

Page 340: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

V

validityofdatainhistoricaldatabase(inbacktestingsystems),222-224ValueatRisk.SeeVaRvalues,determiningacceptablerangeof,76,85-87VaR(ValueatRisk),181-183

analysisofdelta-neutralitystrategy,33-34calculationmethods,137drawbacksto,140-141inportfolio,analysisofpartiallydirectionalstrategies,61inriskevaluation,136

variationcoefficients,181,183vega,138-139,253vendorsforhistoricaldatabase(inbacktestingsystems),218visualanalysisofbacktestingresults,242-244volatilemarkets

delta-neutralityboundariesin,10-13delta-neutralityboundariesinpartiallydirectionalstrategies,51-52historicalvolatilityinriskevaluation,136portfoliostructureanalysis

longandshortcombinations,26-27lossprobability,31-33numberofcombinationsinportfolio,22-24numberofunderlyingassetsinportfolio,24-25portfolioasymmetry,29-30straddlesandstrangles,28-29VaR,33-34

volumemodeling(inbacktestingsystems),229

W–Zwalk-forwardanalysis,235

Page 341: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

weightfunctionforreturn/riskevaluation,178-179transformationof,196-204

Page 342: Automated Option Trading: Create, Optimize, and Test Automated Trading Systems

Inanincreasinglycompetitiveworld,itisqualityofthinkingthatgivesanedge—anideathatopensnewdoors,atechniquethatsolvesaproblem,oraninsight

thatsimplyhelpsmakesenseofitall.

Weworkwithleadingauthorsinthevariousarenasofbusinessandfinancetobringcutting-edgethinking

andbest-learningpracticestoaglobalmarket.

Itisourgoaltocreateworld-classprintpublicationsandelectronicproductsthatgivereaders

knowledgeandunderstandingthatcanthenbeapplied,whetherstudyingoratwork.

Tofindoutmoreaboutourbusinessproducts,youcanvisitusatwww.ftpress.com.