The options trading technique called 'delta neutral' is flattening out a position's delta at a time interval or a delta level.
ORATS offers the ability to backtest delta neutral by selecting 'Hedge Days' parameter when setting up a backtest. For example, you can flatten deltas every 7 days or when the delta reaches 50 long or short.
For a delta neutral trading example, assume a position short 50 deltas from selling an at-the-money call. To make the deltas neutral, 50 shares of stock are bought to flatten the deltas. The next day, if the stock goes up and the call is now an in-the-money 80 delta, 30 more shares are bought to again flatten the deltas. On the third day, if the stock were to go back down to its original level, then the 30 shares would have to be sold to be again delta neutral.
The profit from that position would be the profit from the options plus the profit from trading the stock. You can see that the profit from the stock is a loss, since the 30 shares bought on day two we sold at a lower price on day three. The 50 shares bought on day one had no profit since the stock price at day three was the same as day one.
To see how we calculate the profit on an actual backtest example, consider the SPY Short Call with Hedged Days = 1 below. The strategy had an annual return of 1.40% on total strategy profit of $2,171.40.
Click the Download button and view the OptionTrades file to see the detail of the $2,171.40 as the sum of the Total Profit column. Let's take a look at the profit from the second to the last trade entered 12/17/18 and exited 1/7/2019 with an options profit of $325.2, a stock profit of -$343.59 and a total profit of -$18.39.
The options profit is easy to reconcile as selling the call for $5.192 and buying it back for $1.93, a profit of 3.252 * 100 less $1 commission.
The stock profit is a more involved calculation. You need delta, stock price and dividends. The delta is found in the OptionsReturns file as part of the download. The stock price and dividends are found using the Data API history of General Core.
On 12/17/2018 the -0.5 delta call was hedged with 50 long shares at the stock price of 253.74. On day two the stock went up to 255.78 for a profit of $102 on the long 50 shares.
On 12/21/18 SPY paid a dividend of 1.435429 and at that time the position was long 28.1751 shares for a profit of (1.435429*-0.281751*-1*100)= $40.44 that is added to the normal stock profit from the stock price change on that day.
Summing the stock and dividend profits and adding commissions of .01 per share, the total profit from this trade matches the trades file of $343 off by a little rounding error.
Here is a video going through the process: