Wh y do people trade ? FIN AN C IAL TR AD IN G IN R Il y a Kipnis - - PowerPoint PPT Presentation

wh y do people trade
SMART_READER_LITE
LIVE PREVIEW

Wh y do people trade ? FIN AN C IAL TR AD IN G IN R Il y a Kipnis - - PowerPoint PPT Presentation

Wh y do people trade ? FIN AN C IAL TR AD IN G IN R Il y a Kipnis Professional Q u antitati v e Anal y st and R programmer What is trading ? The act of BUYING or SELLING an asset BUYING tangible prod u ct SELLING nancial sec u rit


slide-1
SLIDE 1

Why do people trade?

FIN AN C IAL TR AD IN G IN R

Ilya Kipnis

Professional Quantitative Analyst and R programmer

slide-2
SLIDE 2

FINANCIAL TRADING IN R

What is trading?

The act of BUYING or SELLING an asset BUYING → tangible product SELLING → nancial security Cash → product → cash (hopefully making a prot!)

slide-3
SLIDE 3

FINANCIAL TRADING IN R

Why do people trade?

To make a prot To take on, ooad, and hedge nancial risk To protect a company from commodity price movements Systematic trading: risk/reward payo is favorable enough to bear the risk

hp://www.cntraveler.com/ hps://qzprod.les.wordpress.com

1 2

slide-4
SLIDE 4

FINANCIAL TRADING IN R

Types of trading

Divergence (or momentum, trend trading): The movement of a quantity will continue in its current direction eg CTA (commodity trading advisors)

slide-5
SLIDE 5

FINANCIAL TRADING IN R

Types of trading

Convergence (or reversion, cycle trading): The movement of a quantity will eventually reverse eg Warren Bue

slide-6
SLIDE 6

Let's practice!

FIN AN C IAL TR AD IN G IN R

slide-7
SLIDE 7

Pitfalls of various trading systems

FIN AN C IAL TR AD IN G IN R

Ilya Kipnis

Professional Quantitative Analyst and R programmer

slide-8
SLIDE 8

FINANCIAL TRADING IN R

Pitfalls in trading system development

Market data is a mix of fear, greed, and noise of millions “Past performance is not indicative of future results.” Overt on past (in-sample) data means bad performance on future (out-of-sample) data

slide-9
SLIDE 9

FINANCIAL TRADING IN R

How to not overfit

Can cause a system to fail in the future Minimize the number of moving objects! GOOD strategy BAD strategy

slide-10
SLIDE 10

FINANCIAL TRADING IN R

Stability with system settings

  • System should behave similarly for similar seings levels
slide-11
SLIDE 11

FINANCIAL TRADING IN R

Stability with system settings

  • System should behave similarly for similar seings levels
slide-12
SLIDE 12

FINANCIAL TRADING IN R

Hypothesis testing

Perform hypothesis tests Relationship between an indicator & future returns? Signal process to generates outperformance? Most of these are beyond the scope of the course, but keep them in mind

slide-13
SLIDE 13

Let's practice!

FIN AN C IAL TR AD IN G IN R

slide-14
SLIDE 14

Getting financial data

FIN AN C IAL TR AD IN G IN R

Ilya Kipnis

Professional Quantitative Analyst and R programmer

slide-15
SLIDE 15

FINANCIAL TRADING IN R

Obtaining data from Yahoo!

Every trading system relies on data (oen costly) Yahoo! Finance has free data Use the getSymbols() command in quantmod

slide-16
SLIDE 16

FINANCIAL TRADING IN R

2 ETFs in this course

LQD:

getSymbols("LQD", from = "1990-01-01", src = "yahoo", adjusted = TR LQD.Open LQD.High LQD.Low LQD.Close LQD.Volume LQD.Adjust 2002-07-30 101.30 102.00 101.25 101.37 21200 52.168 2002-07-31 101.80 102.25 101.55 101.99 272000 52.487 2002-08-01 102.40 103.10 102.30 102.99 111700 53.002 2002-08-02 102.90 103.30 102.45 103.20 29200 53.110 2002-08-05 103.65 103.65 102.51 102.95 166500 52.982 2002-08-06 102.50 102.65 102.10 102.60 430100 52.801

Spy: see exercises

slide-17
SLIDE 17

FINANCIAL TRADING IN R

quantmod functions

Op() : Opening day prices Hi() : Maximum value traded during the day Lo() : Minimum value traded during the day Cl() : Last price that was traded Vo() : Number of trades that day Ad() : Adjusted closing price, adjust for dividends & splits

slide-18
SLIDE 18

FINANCIAL TRADING IN R

Plotting financial data

Plot data using the plot() command

plot(Cl(LQD))

slide-19
SLIDE 19

Let's practice!

FIN AN C IAL TR AD IN G IN R

slide-20
SLIDE 20

Adding indicators to financial data

FIN AN C IAL TR AD IN G IN R

Ilya Kipnis

Professional Quantitative Analyst and R programmer

slide-21
SLIDE 21

FINANCIAL TRADING IN R

Trading indicators

TTR: toolbox of classical trading indicators SMA (Simple Moving Average) Popular for CTA’s: 200-day moving average Displays where prices have been over the past 10 months

slide-22
SLIDE 22

FINANCIAL TRADING IN R

Using SMA()

# Compute a simple moving average (SMA) across 200 days sma <- SMA(x = Cl(LQD), n = 200) # Add the SMA line to your plot of LQD closing price plot(Cl(LQD)) lines(sma, col = "red")

slide-23
SLIDE 23

FINANCIAL TRADING IN R

The trend line

slide-24
SLIDE 24

Let's practice!

FIN AN C IAL TR AD IN G IN R