Does Short Straddle Work in Algorithmic Trading
Posted on August 17, 2022 by Quantplay Team ‐ 3 min read
Introduction to Short Straddle
Today, we are going to take a look at one of the most famous option selling strategies. This strategy is so effective and yet so easy to execute, Many traders use it on a daily basis.
So without any further ado, let’s take a look at short straddle and how you can execute short straddle almost efffortlessly using Quantplay.
What Is a Short Straddle?
A short straddle is all about taking advantage of theta. This strategy is a delta neutral stratgey.
A short straddle is an options strategy that sells both a call option and a put option with the same strike price and expiration date. Traders use it when they are expecting a lower volatility market over the lives of the options contract.
In this blog, we are going to test a short straddle over a period of two years.
Strategy Explanation
- Enter a trade at 9:30 IST
- Exit the trade at 3:15 IST or whenever the stoploss triggers
- Trade two lots of NIFTY 50 ATM options
- Sell both PUT/CALL option with a 50% stoploss
We have backtested this strategy using our system, now let us see how you can execute this strategy using quantplay.
Strategy Code
from quantplay.strategy.base import QuantplayAlgorithm
from quantplay.utils.constant import TickInterval
from quantplay.service import market
import pandas as pd
class Straddle(QuantplayAlgorithm):
def __init__(self):
self.interval = TickInterval.minute
self.entry_time = "09:29"
self.exit_time = "15:15"
self.exchange_to_trade_on = "NFO"
self.option_nearest_expiry_offset = 0
self.option_chain_depth = 0
self.backtest_after_date = "2020-01-01"
self.backtest_before_date = "2022-02-25"
self.stream_symbols_by_security_type = {"EQ": ["NIFTY 50"]}
self.strategy_type = "intraday"
self.strategy_tag = "straddle"
super(Straddle, self).__init__()
def get_trades(self, market_data):
equity_data = market_data[market_data.security_type == "EQ"]
trades = market.get_trades(equity_data, self.entry_time)
trades = self.add_expiry(trades, security_type="OPT")
trades.loc[:, "atm_price"] = (
round((trades.close / trades.strike_gap).astype(float)) * trades.strike_gap
)
trades.loc[:, "atm_price"] = trades.atm_price.astype(int)
pe_trades = market.option_symbol(
trades, price_column="atm_price", option_type="PE"
)
ce_trades = market.option_symbol(
trades, price_column="atm_price", option_type="CE"
)
trades = pd.concat([pe_trades, ce_trades], axis=0)
trades.loc[:, "transaction_type"] = "SELL"
trades.loc[:, "stoploss"] = 0.5
trades.loc[:, "quantity"] = 100
return trades
Performance
Fig: Balance progression from Jan 2020 till April 2022
Fig: Profit gained on the backtested data from 31st Jan 2020 till 28th feb 2022
Fig: Profit gained on the backtested data from the year 2020 till 2022
Strategy statistics -
Attribute | Year 2020 | Year 2021 | All (combining both years) |
---|---|---|---|
Total profit | 184978 | 213511 | 405395 |
Max drawdown | 19736 | 23414 | 23414 |
Sharpe ratio | 7.54 | 8.60 | 7.42 |
Max drawdown days | 34 | 41 | 57 |
Losing streak | 6 | 4 | 6 |
Winning streak | 9 | 19 | 19 |
Monthly pnl | 15415 | 17793 | 15592 |
Required exposure | 100000 | 100000 | 100000 |
Total signals | 497 | 480 | 1053 |
Total trading days | 249 | 242 | 529 |
Success ratio | 0.51 | 0.52 | 0.51 |
Avg. pnl | 372 | 445 | 385 |
Conclusion
Straddle is a beginner friendly and yet an effective trading strategy. it is usually more expensive to execute compared to strangles. Straddle is a non-directional strategy. And as markets remain sideways most of the time, this can be an effective strategy in the markets.
I hope you enjoyed reading our blog. If you follow the steps in the article and the information we provided, you should be able to make money with a short straddle.
In our next blog we are going to discuss the right market conditions to trade a better version of short straddle.