Anda di halaman 1dari 64

IntroductiontoAlgorithmicTradingStrategies

Lecture6
TechnicalAnalysis:LinearTradingRules
HaksunLi
haksun.li@numericalmethod.com
www.numericalmethod.com

Outline

Movingaveragecrossover
Thegeneralizedlineartradingrule
P&Lsfordifferentreturnsgeneratingprocesses
Timeseriesmodeling

References

Emmanual Acar,StephenSatchell.Chapters4,5&6,
AdvancedTradingRules,SecondEdition.
ButterworthHeinemann;2ndedition.June19,2002.

AssumptionsofTechnicalAnalysis

Historyrepeatsitself.
Patternsexist.

DoesMAMakeMoney?

Brock,Lakonishok andLeBaron (1992)findthata


subclassofthemovingaverageruledoesproduce
statisticallysignificantaveragereturnsinUSequities.
Levich andThomas(1993)findthatasubclassofthe
movingaverageruledoesproducestatistically
significantaveragereturnsinFX.

MovingAverageCrossover

Twomovingaverages:slow( ) andfast( ).
Monitorthecrossovers.
,

Longwhen
Shortwhen

.
.

HowtoChoose and ?

Itisanart,notascience(sofar).
Theyshouldberelatedtothelengthofmarketcycles.
Differentassetshavedifferent and .
Popularchoices:

(150,1)
(200,1)

AMA(n,1)

iff

iff

GMA(n,1)
iff

(bytakinglog)

iff

(bytakinglog)

Whatis ?

Acar Framework

Acar (1993):toinvestigatetheprobabilitydistribution
ofrealizedreturnsfromatradingrule,weneed

theexplicitspecificationofthetradingrule
theunderlyingstochasticprocessforassetreturns
theparticularreturnconceptinvolved

EmpiricalPropertiesofFinancialTimeSeries

Asymmetry
Fattails

KnightSatchellTranIntuition

Stockreturnsstayinggoingup(down)dependson

therealizationsofpositive(negative)shocks
thepersistenceoftheseshocks

Shocksaremodeledbygammaprocesses.
PersistenceismodeledbyaMarkovswitchingprocess.

KnightSatchellTranProcess

:longtermmeanofreturns,e.g.,0
, :positiveandnegativeshocks,nonnegative,i.i.d

KnightSatchellTran

1q

Zt =0

Zt =1

1p

StationaryState

,withprobability
,withprobability

GMA(2,1)

Assumethelongtermmeanis0,

NaveMATradingRule

Buywhentheassetreturninthepresentperiodis
positive.
Sellwhentheassetreturninthepresentperiodis
negative.

NaveMAConditions

Theexpectedvalueofthepositiveshockstoasset
return>>theexpectedvalueofnegativeshocks.
Thepositiveshockspersistency>>thatofnegative
shocks.

PeriodReturns

hold
0
0

1
Sellatthistimepoint

HoldingTimeDistribution

ConditionalReturnsDistribution(1)

UnconditionalReturnsDistribution(2)

LongOnlyReturnsDistribution

Proof:make

I.I.DReturnsDistribution

Proof:
1

make

ExpectedReturns

Whenistheexpectedreturnpositive?
,shockimpact

,shockimpact
1
,if
,persistence

GMA(,1)Rule

GMA(,1)ReturnsProcess

ReturnsAsaMA(1)Process

GMA(,1)ExpectedReturns

MAUsingtheWholeHistory

Aninvestorwillalwaysexpecttolosemoneyusing
GMA(,1)!
Aninvestorlosestheleastamountofmoneywhenthe
returnprocessisarandomwalk.

OptimalMAParameters

So,whataretheoptimal and ?

LinearTechnicalIndicators

Asweshallsee,anumberoflineartechnical
indicators,includingtheMovingAverageCrossover,
arereallythesamegeneralized indicatorusing
differentparameters.

TheGeneralizedLinearTradingRule

Alinearpredictorofweightedlaggedreturns

Thetradingrule

Long:
Short:

1,iff,
1,iff,

0
0

(Unrealized)rulereturns

if
if

1
1

BuyAndHold

PredictorProperties

Linear
Autoregressive
Gaussian,assuming isGaussian
Iftheunderlyingreturnsprocessislinear, yieldsthe
bestforecastsinthemeansquarederrorsense.

ReturnsVariance

MaximizationObjective

Varianceofreturnsisinverselyproportionalto
expectedreturns.
Themoreprofitablethetradingruleis,thelessrisky
thiswillbeifriskismeasuredbyvolatilityofthe
portfolio.
Maximizingreturnswillalsomaximizereturnsper
unitofrisk.

ExpectedReturns

TruncatedBivariateMoments

JohnstonandKotz,1972,p.116

Correlation:

Corr

ExpectedReturnsAsaWeightedSum

atermforvolatility

atermfordrift

Praetz model,1976

, thefrequencyofshortpositions

ComparisonwithPraetz model

Randomwalkimplies

.
theprobabilityofbeingshort

increasedvariance

BiasedForecast

Abiased(Gaussian)forecastmaybesuboptimal.
Assumeunderlyingmean
.
Assumeforecastmean
.

MaximizingReturns

Maximizingthecorrelationbetweenforecastandone
aheadreturn.
Firstordercondition:

FirstOrderCondition

Fittingvs.Prediction

If processisGaussian,nolineartradingrule
obtainedfromafinitehistoryof cangenerate
expectedreturnsoverandabove .
Minimizingmeansquarederror maximizingP&L.
Ingeneral,therelationshipbetweenMSEandP&Lis
highlynonlinear(Acar 1993).

TechnicalAnalysis

Useafinitesetofhistoricalprices.
Aimtomaximizeprofitratherthantominimizemean
squarederror.
Claimtobeabletocapturecomplexnonlinearity.
Certainrulesareilldefined.

TechnicalLinearIndicators

Foranytechnicalindicatorthatgeneratessignalsfrom
afinitelinearcombinationofpastprices

1 iff

Sell:

Thereexistsan(almost)equivalentARrule.

Sell:

1 iff

ln

ConversionAssumption

MonteCarlosimulation:

97%accurate
3%error.

ExampleLinearTechnicalIndicators

Simpleorder
SimpleMA
WeightedMA
ExponentialMA
Momentum
Doubleorders
DoubleMA

Returns:RandomWalkWithDrift

Thebiggertheorder,thebetter.
Momentum>SMAV>WMAV

Howtoestimatethefuture drift?

Crystalball?
Delphicoracle?

Results

Results

Returns:AR(1)

Autocorrelationisrequiredtobeprofitable.
Thesmallertheorder,thebetter.(quickerresponse)

Results

ARMA(1,1)

AR

MA

Pricestendtomoveinonedirection(trend)fora
periodoftimeandthenchangeinarandomand
unpredictablefashion.

Meandurationoftrends:

Informationhasimpactsonthereturnsindifferent
days(lags).

Returnscorrelation:

Results
nosystematic
winner

optimal
order

ARIMA(0,d,0)

Irregular,erratic,aperiodiccycles.

Results

ARCH(p)

aretheresiduals
When
,
.

residualcoefficientsasa
functionoflaggedsquared
residuals

AR(2) GARCH(1,1)

AR(2)

innovations

ARCH(1):lagged
squaredresiduals

lagged
variance

GARCH(1,1)

Results

Thepresenceofconditionalheteroskedasticity willnot
drasticallyaffectreturnsgeneratedbylinearrules.
Thepresenceofconditionalheteroskedasticity,if
unrelatedtoserialdependencies,maybeneithera
sourceofprofitsnorlossesforlinearrules.

Conclusions

Trendfollowingmodelrequirespositive(negative)
autocorrelationtobeprofitable.

Trendfollowingmodelsareprofitablewhenthereare
drifts.

Whatdoyoudowhenthereiszeroautocorrelation?

Howtoestimatedrifts?

Itseemsquickerresponserulestendtoworkbetter.
Weightsshouldbegiventothemorerecentdata.

Anda mungkin juga menyukai