Backtesting Option Wheel
Overview
In this tutorial, we will explain how to backtest the Option Wheel strategy using the OptionStack platform.
The Option Wheel is a strategy that involves selling cash secured puts (CSP) and adjusting them into a covered call if the short puts are assigned into long stock.
The Option Wheel strategy is as follows:
- Start by selling cash secured puts (CSP)
- Instead of closing them at expiration, allow out-of-the-money options to expire worthless or allow assignment of long stock for in-the-money put options.
- If CSP expire worthless, sell another round of cash secured puts, collecting more premium with each round of sales.
- If CSP are assigned into long stock, sell a covered call against the assigned long stock.
- Instead of closing the call options at expiration, allow out-of-the-money options to expire worthless or allow assignment of short stock for in-the-money call options.
- If the covered calls expire worthless, sell another round of covered calls, collecting more premium with each round of sales.
- If the covered calls are assigned into short stock, the short stock from assignment will offset your long stock, resulting in a net zero / flat position.
- Rinse and repeat!
Run Example!
Cash Secured Puts
Let’s start by constructing the cash secured puts strategy. (CSP). The cash secured puts involves selling out-of-the-money or at-the-money puts, while simultaneously setting side enough cash to buy the stock if the puts are assigned.
Configure the Strategy block as follows:
- Strategy: Sell Put
- At Expiration: Exercise / Assign.
- Default expiration behavior is to close the position at expiration.
- Instead, we will change it to Exercise/Assign to allow out-of-the money options to expire worthless, while allowing assignment on in-the-money put options.
- Position Sizing: Size By Margin
- Position Size: Percentage of available cash balance
- Make sure there is enough cash to buy the stock if assigned
- You can adjust the Initial Cash Balance in the Backtest Settings menu
- Add the desired strategy filters to select the desired puts to sell
Check For Assignment Of Puts
Next, let’s check if the puts have been assigned.
The netOpenUnderlyingInstrumentUncoveredQuantity method will return the number of shares of the underlying stock that is open and uncovered (i.e. NOT covered by a short option). When the puts have been assigned to long stock, this value will be greater than zero.
Assign the value of this method to a variable that can be referenced later in the strategy (NumStockAssignedAndUncovered).
Covert the number of stock shares into number of option contracts. Since 1 option contract controls 100 shares of stock, divide the number of stock shares by 100.
Assign this to a variable that can be referenced later in the strategy (NumCallContractsToSell).
Adjust into covered call
Next, let’s use the variables above to check if the cash secured puts have been assigned into long stock. If they have been assigned, sell covered calls options against the assigned long stock.
In order to determine whether the puts have been assigned, check whether the NumStockAssignedAndUncovered is greater than zero.
- WHEN the NumStockAssignedAndUncovered is greater than zero, the puts have been assigned into long stock, and the position should be adjusted into a covered call.
Configure the Strategy block as follows:
- Strategy: Sell Call
- At Expiration: Exercise / Assign
- At expiration, if the calls are in-the-money, allow them to be assigned into short stock. This will offset the long stock, resulting in a net zero / flat position.
- Size By: Quantity
- Use the variable defined above (NumCallContractsToSell)
- The number of calls to sell is based on the number of shares of assigned stock, divided by 100
- Add the appropriate strategy filters to select the desired calls to sell
- DeltaAbs: 10 – 20 (out of the money call options)
- DaysToExpiration: 20 – 40 days
Offsetting Positions
By default, once a position is opened, it is considered open unless it has expired or has been explicitly closed by an accompanying order with matching OrderID. This allows you to manage and track each position separately, without worrying whether one trade interferes and overlaps with another trade.
So while the long stock / short stock from the assignments offset each other resulting in a net-zero position, each position is still considered open, since they were offset by different OrderID’s (SellPut1 / Sell Call1).
But in this case, we intentionally want the assignments to offset each other to close all the trades.
In order to change this default behavior, use the consideredPositionsClosedIfOffsetByIndependentPositions setting.