The Moving Average Convergence/Divergence (MACD) is a technical indicator of momentum that uses moving averages to determine a trend’s strength.
MACD uses three exponential moving averages (a short-term, a long-term, and the average difference between the short and long-term) to indicate price momentum. It identifies changing trends by showing where the signal line crosses over the moving averages lines.
Traders often use the MACD indicator for identifying overbought and oversold conditions to trade mean-reversion strategies.
Identifying changes in trend and momentum can help traders time entries for various trading strategies. However, tracking technical indicators for multiple securities, and entering trades exactly when your criteria are met, can be difficult.
Automating the strategy
Automating a MACD reversion strategy allows you to offload the process of finding overbought or oversold conditions for different tickers and entering multiple trades. Automating position management also means you don’t have to watch every open position simultaneously.
This bot’s scanner automation includes a symbol loop to scan SPY, GLD, XOP, and TLT. You can easily modify the symbols in the scanner automation at any time.
First, the automation ensures there are no open positions in the bot for each symbol. This portfolio management tool keeps the bot from opening multiple positions in a single ticker.
The scanner then checks if the ticker symbol’s MACD is overbought or oversold. If the overbought or oversold condition is confirmed, the bot then verifies the opportunity has adequate liquidity using the position’s bid-ask spread and short leg open interest.
If (and only if) all conditions are met, an open position order is sent to the broker.
You can create dynamic orders to specify a strategy type based on market conditions. So, if the ticker symbol is overbought, the bot sends an order to open a bearish short call spread. Conversely, if the ticker is oversold, a bullish put spread is opened.
Monitor automations allow you to manage and exit positions differently. This bot manages open positions based on their position type, profit target, and days until expiration.
Next, we’ll dive into the various decisions and settings that make up the bot’s automations.
The bot first scans a watchlist of tickers to ensure the bot has no open positions in the symbol, then evaluates live market conditions to see if MACD has an overbought or oversold condition. You have full control of the MACD’s settings and can change them anytime.
The bot initially checks if the ticker is overbought with this decision recipe.
If the ticker symbol is not overbought, the bot will check to see if the symbol is oversold.
If neither condition is met, the automation ends. If any symbol has an overbought or oversold reading, the bot will verify the selected position type meets two minimum liquidity filters.
This bot uses the bid/ask spread and short leg’s open interest to define minimum liquidity thresholds.
You can use custom inputs to easily modify any decision’s settings.
If the bot passes both liquidity checks, it will send an order to the broker to open a position in the respective symbol. The bot sends an order to open a short call spread for overbought conditions or a short put spread for oversold conditions. Again, you have complete control of the position’s settings.
Note: Adding an open position action before adding position filters allows you to reference the position when building a decision recipe.
Monitor automations tell the bot when to exit positions. This bot uses different management strategies for different position types.
First, the monitor uses a position loop to cycle through all open positions.
The bot then determines if the position is a short call spread or a short put spread.
Historically speaking, stocks tend to go up more than they go down. Therefore, the bot has a larger profit target for short put spreads than short call spreads.
If a short put spread’s 75% profit target is not hit, the bot trails a 50% profit by 10% using SmartStops.
If either position type has not achieved its profit target, the bot will exit the position based on days until expiration. The bot automatically exits short call spreads two days before expiration.
However, the bot will only send a closing order to the broker for short put spreads if the position is three days from expiration and the underlying ticker’s price is below the short put strike.
The automation ends if the option leg is not challenged and the position expires in more than three market days.
Technical indicators can be a great tool to enter and exit positions. But it is challenging to track multiple indicators in multiple tickers, enter new trades, and manage a portfolio of positions.
With automation, you can clearly define your entry and exit parameters and let a bot do all the work of scanning markets and dynamically monitoring positions, giving you more time to focus on things you love.
Watch Kirk build the MACD bot in this recorded bot workshop.