This week's episode explores a backtest that led to creating a popular and successful bot template.
Bot templates allow you to create, edit, reuse, and share strategies that can be saved to your personal library.
This podcast is a deep dive into the origin, strategy, automations, and decisions of the “Trendy Short Put Spread” bot.
We discuss backtesting, automation details, and explain the changes made along the way as we observed the bot’s performance through multiple expiration periods.
The genesis of the Trendy Short Put Spread bot came from a top backtest that was modified to create an automated strategy.
The backtest was a sequential SPY put credit spread with no overlapping positions.
The put credit spread had a short put with a 0.15 delta and a long put with a 0.05 delta. The profit target was 50% of the original credit received. There was no stop-loss or time limit for exiting the position. The average expiration was 10 days.
Capital Allocation Observations
You can test up to three capital allocations with the backtester. The ability to test different capital allocations allows you to observe how a strategy will perform using different risk levels.
We tested allocations with 5% of capital per position, 10% of capital per position, and $1,000 per position.
Of the three portfolios, the 5% capital allocation had the lowest returns but had a much more stable portfolio curve. The $1,000 per position allocation was a better overall performer but experienced more volatility. The 10% allocation had the highest returns but also had the largest drawdowns.
The 5% capital allocation per position portfolio had strong performance metrics despite the lower returns.
The 10% capital allocation had a compound annual growth rate (CAGR) of 7.3% which looks more appealing on the surface. However, it also had a max drawdown of 29%.
The $1,000 per position allocation returned a 4.8% CAGR, but the maximum drawdown was only 12.1%. The win rate was 94.9% and the profit factor was 1.47. It had a streak of 101 wins in a row, while the worst losing streak was only two consecutive losses.
It is important to consider how different allocations will affect your portfolio. These metrics give you context about how your strategy should perform going forward.
Of course, there are no guarantees that future performance will replicate past results. What you're looking for is the expected long-term outcome after hundreds or thousands of trades.
Building The Bot
So, you've identified a successful strategy using a backtest. Now what? Time to create a bot.
Bots typically begin with scanner automations. Scanner automations look for opportunities to enter new positions based on the decision recipes you create. Scanners filter through market criteria and work through a decision tree to open a position.
The Trendy Short Put Spread’s scanner uses simple decisions for the bot to evaluate.
The first decision action checks two different market criteria in a single decision block. The automation will only continue down the “Yes” path if the VIX is below 40 and the ticker symbol’s price is above its 200-day simple moving average.
The bot then proceeds through a set of opportunity filters. Opportunity filters look at potential trading opportunities before an order is sent to the broker.
The first opportunity filter checks if the bid-ask spread is less than $0.05. The second opportunity filter checks if the short put leg’s open interest is greater than 500 contracts.
Finally, a decision recipe ensures that there are no other positions open in the bot.
If all criteria are met, an order is sent to the broker using the specifications of an open position action.
The open position action tells the bot to open a position with a -0.15 delta short put and a long put $10 below the short put’s strike price, one contract at a time.
The allocation limit is set to $1,000 in the bot’s global settings.
Monitor automations manage open positions inside a bot. Bot monitors typically end with a close position action to exit a trade when your decision criteria are met.
Monitors usually start with a repeater action. Repeaters loop through open positions in the bot to manage specific position types. The monitor will automatically manage open positions once they are entered, and the repeater will only apply the decision actions to the specified position type.
The monitor automation has two exit criteria: a profit target and a grouped decision for expiration and challenged positions. If neither criteria are met, the position will simply expire.
The first decision checks if the position’s premium has decreased by 25% since it was opened. If there is a 25% profit, the automation proceeds down the “Yes” path to a close position action.
If the position does not have a 25% profit, the bot checks if the position will expire in less than two days and if the underlying symbol’s price is below the short put’s strike price. An order to close the position will only be sent to the broker if the position expires in less than two days and SPY’s price is below the short put strike.
You can always update your bot templates.
SmartStops allow you to set a target and a trailing percentage for a position.
The original template used a decision recipe to check if the position’s premium decreased by 25%. SmartStops add a dynamic stop-loss that trails the position by 10% once a 50% profit target is hit.
The SmartStops decision recipe is followed by a close position action.
Why is this important? Additional backtesting research showed that short put spreads often reach a 90% profit before expiration. SmartStops enable you to optimize a position’s exit and maximize profit potential.
Monitor automatons can also be used to adjust a position.
Version three added a monitor automation to hedge a short put spread position that is challenged.
If the underlying price is below the short put, an order is sent to the broker to open a short call spread.
An adjustment was also made to the original scanner automation to ensure the bot has exactly zero call spread positions open. This way an order only goes to the broker if there are no short call spreads in the portfolio. The global settings were adjusted accordingly.
The great thing about bots is they are intelligent enough to match expiration dates, contracts, and spread widths of existing positions. They can also link position details between decision actions.
Call Spread Manager
A simple monitor automation was created to manage any short call spreads that may be opened.
A repeater action is used for call spreads, and similar decision criteria are used to exit the position.
Each template version improved the bot. Version two added SmartStops to maximize profits. Version three included additional strategy adjustments to hedge challenged positions.
Bots are flexible and dynamic, so you can always improve their components and update your templates as you discover new information and market conditions change.
Trendy Short Put Spread Performance
Currently, the bot has been doing really well. The $1,000 allocation has yielded a $521 return, or 52.1%, with an amazing win rate of 93.8% and a 1.93 profit factor. This is in line with the backtest results.
You’ll notice the P&L took a slight dip recently, as the market dropped. However, the losses were minimized by the addition of the short call spread hedge. To be fair, there were times when the hedge led to a loss that otherwise would not have occurred. (Perhaps another modification is coming in a future version? Remember, automated does not mean unattended!)
This is a very simple bot that demonstrates the power of automation. You can create a bot to perform mechanical tasks on a strategy that you’ve backtested for historical data, continually refine and update the template, and track its performance with live data.
“Devon: Hello, Kirk. I just saw one of your videos about selling covered calls. In the video, you said we need to own 100 shares to sell a covered call and collect the premium. Is that even possible? If it is possible, would you be able to sell a call without owning the 100 shares? Or do you need to own 100 shares to sell the call? What happens when you sell the call? I was thinking about selling a call for Uber and trying to collect the premium. If I sell a call for Uber without owning the 100 shares, what will happen, or what could happen? Is it even possible?”