53. Butterfly example using R.

# 53. Butterfly example using R. - #Profit from(b expiration...

This preview shows pages 1–2. Sign up to view the full content.

University of California, Los Angeles Department of Statistics Statistics C183/C283 Instructor: Nicolas Christou Butterﬂy spread using R #Butterfly spread: #Create a vector with possible values of the stock at expiration. s1 <- c(seq(0,55,5), seq(56,64,1), seq(65,100,5)) #(a) Buy one call with: E1 <- 55 C1 <- 10 #(c) Buy one call with: E3 <- 65 C3 <- 5 #(b) Sell two calls with: E2 <- 60 C2 <- 7 #Profit from (a) at expiration: x1 <- ifelse(s1 > E1, s1-E1-10, -C1) #Profit from (c) expiration: x3 <- ifelse(s1 > E3, s1-E3-C3, -C3)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: #Profit from (b) expiration: x2 <- ifelse(s1 > E2, 2*(E2-s1+C2), 2*C2) #Total profit at expiration: total <- x1+x2+x3 #The diagram: plot(s1,x1, type="l", ylim=c(-30,40), ylab="Profit at expiration", xlab="Stock price at expiration", lty=2) lines(s1,x3, lty=3) lines(s1,x2, lty=4) lines(s1,total, lwd=1.5) legend(’topleft’, lty=c(2:4,1), legend=c(’a’, ’c’, "b", "total")) 1 20 40 60 80 100-30-20-10 10 20 30 40 Stock price at expiration Profit at expiration a c b total 2...
View Full Document

## This note was uploaded on 06/02/2011 for the course STATS 183 taught by Professor Nicolas during the Spring '11 term at UCLA.

### Page1 / 2

53. Butterfly example using R. - #Profit from(b expiration...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online