Options Strategy: Create Long Straddle with R Language

The Long Straddle is an options trading strategy that involves going long on a call option and a put option with the same underlying asset, same expiration and same strike price. This strategy tries to gain profits due to volatility in either direction as the strategy wins when the price movement is significant in any direction. In this article we will learn about how to construct a long straddle with R programming language.

The code for implementing the long straddle with R is presented below. We first create a vector of prices using the seq() function in R. For our example, we create a vector with prices ranging from 700 to 950. We chose the strike price to be 850. The call and put options have a premium of 20 and 10 respectively. We calculate the payoffs from the call and the put options and then calculate the payoff from the long straddle strategy with a long position in both call and the put option. We finally plot the strategy payoff using the ggplot library in R.

prices <- seq(700,950,1) # Vector of prices
strike <- 850 # strike price for both put and call 
premium_call <- 20 # option price call
premium_put <- 10  # option price put 
 
# call option payoff at expiration 
intrinsicValuesCall <- prices - strike - premium_call
payoffLongCall <- pmax(-premium_call,intrinsicValues)
 
# put option payoff at expiration
intrinsicValuesPut <- strike - prices - premium_put
payoffLongPut <- pmax(-premium_put,intrinsicValuesPut)
 
# The payoff of the Strategy is the sum of the call and put payoff. Need
# to sum wise element by element between the two vectors
payoff <- rowSums(cbind(payoffLongCall,payoffLongPut))
 
# Make a DataFrame with all the variable to plot it with ggplot
results <- data.frame(cbind(prices,payoffLongCall,payoffLongPut,payoff))
 
ggplot(results, aes(x=prices)) + 
  geom_line(aes(y = payoffLongCall, color = "LongCall")) + 
  geom_line(aes(y = payoffLongPut, color="LongPut"))+
  geom_line(aes(y=payoff, color = 'Payoff')) +
scale_colour_manual("", 
                    breaks = c("LongCall", "LongPut", "Payoff"),
                    values = c("darkred", "darkblue", "darkgreen")) + ylab("Payoff")+
 ggtitle("Long Straddle Payoff")  

The following graph shows the payoff from the long straddle strategy.

As we can observe in the graph above, the profits from the strategy (green line) are high when any of the stock price moves significantly away from the strike price at expiration. The maximum gain is unlimited in either direction. At the time of expiration, the profit will be the difference between the stock price and the strike price. If at expiration, the stock price is exactly the same as strike price, both options will not be exercised and will expire worthless. The trader’s maximum loss from the strategy will be the premium paid for the two options. The strategy is suitable under high volatility scenarios when trader expects a significant move in the stock price in either direction.

Finance Train Subscription

Unlock full access to Finance Train and see the entire library of member-only content and resources.