25%(4)25% found this document useful (4 votes) 1K views8 pagesMQL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
(CO MaMiom tet
AN INTRODUCTION TO
ALGORITHMIC
TRADING
BASIC TO ADVANCED STRATEGIES
Edward Leshik and Jane Cralle
AW
we iz
ANN
NA
\ KS \
: WAS \(CO MaMiom tet
AN INTRODUCTION TO
ALGORITHMIC
TRADING
BASIC TO ADVANCED STRATEGIES
Edward Leshik and Jane Cralle
AW
we iz
ANN
NA
\ KS \
: WAS \PRPCGSMEL — QC:FCGSPH TSP
fn SWBK406Leshik Febery 2.2011 1016 Printer Name: Yer Come
‘Thisescon Ht polished 2011
Copyeight © 2011 etn Wiley & Sons Lad
Registered ofce
Jab Wile & Sons Lid The Asim, Southern Gale, Chics, West Sussex POLS 8SQ.
‘Unies Kingdom |
For deals of oor global oil fics for ustomer services for ifoematon about how to ane
for permission wo ease he copy ight materia ths book please see our website t wwe. com
The right ofthe suthor to be ete asthe ath ofthis Weck hss hoon asete a secon ith
the Copyeigt, Desges tnd Patents Act 108K,
Altihec reserve. par ofthis publication may berepresuce, sored ina retrieval syste oF
rani, nay Forma by aey means, lectonic, mechanical phetoeaprine ecard oatherwive,
‘xcapt as pormitoshy the UK Copyright, Designs and Patents Act 1988, without th rer pansion of
the pulser.
‘ile so publishes is oka vary of eleewonic Formats. Some cometh sppears in pint my
ote availabe in letonic books,
Designations used by companies distinguish their produce ae often claimed astrndemarks, All rand
tres ad prot aries ed itis book trade nares serve mars, rademarks Feiss
under of tee respective capers. The pulser is mit soci with ny prt vendor
‘ato ats ba Ti publ is tiie Uo evden dad ove ein
‘ecano the subjec mr covered lll on the wodestaning hat the pubes sna engaged in
ering profesional services If profession vice or othr exPertwsnince a rays the services
‘fa competent profesional should be sph
For other tls ia the Wiey Trading Seles
reas sce wey. comfioance
‘A citaloguc cord fortis book is aalale fom the Bei Litrary
ISBN 978.0-170-68051-7 dhadlueh); ISBN 078.0470.97936-8 (Bk)
ISBN 975:1-119-92500-0 (eb: ISHN 978-1-119-97500-6 eh)
“Typse in 10/129 Times by Aptara He. New Debi Ena
ited in Great Britain by TY Ineratonal Lid, Paco, CornsPRFCGSME —_QC-FCGSPE —TH:SPHT
fm WKS coh Febery 2,2011 1916 Pinar Name: Yetta Come
Contents
Acknowledgments
Mission Statement
PART 1 INTRODUCTION TO TRADING ALGORITHMS,
Preface to Part L
L_ History
2__All About Trading Algorithms You Ever Wanted
to Kaos,
3._Algos Detined and Explained
4 Who Uses and Provides Algos
5._Why Have They Become Mainsrear so Quickly?
6 Curenaly Popular Atgos
1_A Perspective View From a Tir | Company
How w Use Algos for Individual Traders
9. How 1 Optimize Individual Trader Algos
10. The Future = Where Do We Go trom Here?
fe
W
Io
2»
3
uPRFCGSPE —_QC-FCGSPE —TH:SPHT
Fon JWHKGL shi —_Febeuny 2,201 E916 Pater Name: Yet to Come
(2 Math Toolkit
43 Statisties Toolbox
14_Data ~ Symbol, Date, Timestamp, Volume, Price 61
AS Excel Mini Seminar
16__Bxcel Charis: How to Read Them and How to Build Them ___98
17_Qur Metrics — Algometrics 8
18 Stock Personality Clusters 8s
19 Selecting a Cohort of Trading Stocks 89
20 Stock Profiling 1
21_Siyistie Properties of Equity Markets 93
22_Vorutty 91
23._Reeurns ~ Theory 101
24 Benchmarks and Performance Measures 193
25 _Qur Trading Algorithms Described ~The ALPHA ALGO,
Swalesies
L_ALPHACL (DIFF) 107
la,_The ALPHA-I Algo Expressed in Excel Function
Language 109
2._ALPHA-2 (EMA PLUS) VI And V2 Lo
ALPHAc4 (High Frequency Real-Time Matrix) 2
5._ALPHA-S (Firedawn) uyol
SWBKA9WLesbk —Januay' 17,2011 72). Primer Nae: Yetso Come
8 Ineaduction to Trading Algaritrns
‘The origin of what was to become the very frst algorithmic trade ean be roughly
traced back to the world’s first hedge fund, set up by Alfred Winslow Jones in
1949, who used a strategy of balancing long and short positions simultaneously wish
probably « 30:70 ratio of short to long. The first sliring of quant finance
In equities trading there were enthusiasts from the advent of computer availability
In the easly 1960s who used their computers (aften clandestinely *horsowing” some
‘computer time from the mainframe of their day job) to analyze price movement of
stocks on a long-term basis, from weeks to months.
Peter N, Hiaurlan, a rocket scientist in the 19608 atthe Jet Propulsion Laboratory,
where he projected the trajectories of satellites, is said ta be one of the frst to use a
computer to analyze stock data (Kirkpatrick snd Dahlquist, pp. 135). Combining his
technical skills he began calculating exponential moving vera
later published the “Trade Levels Reporis”
‘Computers came into mainstream use for block trading in the 1970s with the
definition of a block tride being $1 million in value or more than 10 000 shares in
the trade. Considerable controversy accompanied this advance.
‘The real stat of trae algorithmic trading as itis now perceived can be attributed
to the invention of ‘pair trading, later also to be known as statistical arbitrage, or
‘statarb (mainly t make it sound more ‘coo!’), by Nuazio Tartaglia who brought
together at Morgan Stanley circa 1980 a multidiseiplinary team of scientists headed
bby Gerald Bamberger
“Pair trading” soon became hugely profitable and almost Wall Street cult. The
criginal team spawned many successful individuals who pioncered the intensive use
of computing power to obtain a competitive edge over their colleagues. David Shaw,
James Simons and a number of others* genealogy ean be raced back to those pion
‘at Morgan Stanley.
‘The ‘Black Box” was born,
As computer power inereased almost miriculously sceording t Moore's Law
(speed doubles every eighteen months, and still does today, well over a thind of a
century after he fst promulgated the hold forecast) and computers Became main
stream tools, the power of computerized algorithmic trading becanie irresistible. This
advance was coupled with the invention of Direct Market Access for non Exchange
_members enabling trates to be made by individual traders via their brokerages,
Soon all major trading desks were running algos.
‘As Wall Sereet (hoth the Buy side mutual funds ete. with their multi-ittion
dollar vaults and the aggressive Sell side brokerages) soon discovered that the hu
Increase in computer power needed different staffing to deliver tke promised Holy
Grail, they pointed their recruiting machines atthe top universities sueh as Stanford,
Harvard and MIT.
“The new recruits had the vague misfortune to be labelled “quants” no matter which
iscipline they originated from — physics, statistics, mathematies
This intellectual invasion ofthe financial spaee soon changed the cultural landscape
of the trading floor. The ‘high personality” tader/brokers were slawly foreed to 8 less
‘dominant position. Technology became all-pervasive.om
IWBKA96TLedik January 17,2011 7:25 Proter Nam: Yotto Come
2
All About Trading Algorithms
You Ever Wanted to Know...
(Q¢ Tn layman's language what are they really?
A; Algorithms are lists of steps or insirustions which start with inputs and end
witha desired output or resull
Q: Do Thave to know much math?
A: No, but it helps, We will provide what you need for ur algos in Part IT of this
book.
Q What about statistics ?
A: High school level helps. Part IT of the book has a chapter which eavers most
cof what you will need.
Q: Do I need tw know Excel?
A: The hook will guise you through all you need to know te use the algorithm
templates whielt are on the CD and desevibed in detail in Par II. Bxee! isi mest
convenient workhorse and de facto
Q: Do [need to be generally computes
A: Not that much really ~ basic computer literacy and ability wv handle fies and
‘mouse skill. For any real equipment function malfinetions call in an IT guy to
‘woubleshoot the problern
Q Do Ihave to understand the detailed workings of the algorithins?
Ac A qualified ‘no’. OF course understanding how the machine works is an asset
‘but yau can drive a car with knawing how the engine warks. Hf you want to
design algos you will need to kniaw where the clutch is and what it does
\gorithms wark bet
also vary over time.
oeks than an others?
(continued)‘gppDJWDBKSDeHLeshik —Janunty 28.2011 16:52 Printer Name: Yet w Come
0 Appenclces
oxy
OXY 3rd QTR 2009
DATE oriioy | Matcap 05,697.64
Open 3482 Shares SUL 67
Close EPS. 208
MIN 1.45 PIE
MAX. 5160 BETA,
Range 18s INST
SIRANGE, 0.023
you. 340
TXN
SHARESITXN
TRAVERSE
SHARPE 1507
Company Description
Occidental Petroleum Corporation (Oveidental) conducts its operations through vari-
‘ous ol and gas, cheriea, midstream, marketing and ether subsidiaries, and affiliates,
The company operates in three business segments: the oll and gas segment, the chem-
Jeal segment, and midstream, marketing and other segment. The oll and gas segment
explores for, develops, produces and markets erude oil, natural gas Higuids (NGL),
condensate snd natural gas, The chemical segment (OxyChets) mansfactares and
‘markets basie chemicals, vinyls and performance chemicals, The midstweam, market
ing and other segment (midstream and marketing) gathers, teats, processes, trans:
ports, stores, trades and markets crude ol, natural gas, NGL. condensate and carbon
dioxide (COs) and generates and markets power. In February 2008, Oceidental pur-
chased from Plains a 50% interest in oil and gas properties in the Permian Basin and
‘western Colorado,
‘Our Comments
‘Careful but can give good results with ALPHA“
el