53. Butterfly example using R.

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

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

View Full Document Right Arrow Icon
University of California, Los Angeles Department of Statistics Statistics C183/C283 Instructor: Nicolas Christou Butterfly 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)
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: #Profit from (b) expiration: x2 &lt;- ifelse(s1 &gt; E2, 2*(E2-s1+C2), 2*C2) #Total profit at expiration: total &lt;- x1+x2+x3 #The diagram: plot(s1,x1, type=&quot;l&quot;, ylim=c(-30,40), ylab=&quot;Profit at expiration&quot;, xlab=&quot;Stock price at expiration&quot;, 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, &quot;b&quot;, &quot;total&quot;)) 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

Page1 / 2

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

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online