Bot Examples

Technical Swing Trading Bot

Here is how to create an options swing trading bot using the RSI technical indicator.
Technical Swing Trading Bot
Kirk Du Plessis
May 21, 2021

This bot example demonstrates how to build a technical swing trading bot. The bot uses overbought and oversold RSI values to enter a swing trade position with credit spreads.

New Bot (:09)

Create a new bot, give it a name, and set allocation and position limits in the global bot settings.

Create new bot and global settings

The bot will have no activity, positions, or automations. As a safeguard, the bot is turned off by default, and you must manually turn it on when you are ready.

Bot dashboard with automations turned off

Add a new scanner (:44)

Scanner automations tell the bot what market criteria to look for before entering a new position.

To add a new scanner automation, select the “+” symbol under Scanners in the Automations tab. You have the option to reuse an automation, make a copy and modify an existing automation, or create a new automation. A new automation will be made for this example.

Adding a new scanner automation

Select “New Automation” to access the automation editor, where you can name the automation and create a scanner with specific criteria for the bot. The new scanner is added to your automations library, where it can be edited, copied, and reused in the future.

Add a decision action to the automation editor (1:26)

Select the “+” symbol to access the decision action recipes. Decision actions tell the bot what criteria to look for to find opportunities.

Add a decision action to the automation editor

There are multiple criteria to choose from when using decision actions. For this example, the bot will evaluate RSI values before proceeding through the automation.

Decision recipe referencing a symbol's indicator

The fields are variable, so you can define the parameters to fit your trading strategy. 

You can also use custom inputs for certain fields, such as the ticker symbol and RSI value. Custom inputs provide you flexibility if the automation is used again in the future. The input enables you to assign a default value and label. For example, an RSI level of 70 will be described as “High RSI Level.” You can change the custom input at any time.

Follow yes path if ticker RSI is above high level

Select “Save,” and the automation editor displays the completed decision recipe for evaluating an underlying symbol’s indicator properties.

Decision recipe added to the automation editor

The automation will begin with the decision action. You can add additional decisions to take specific action based on the RSI value.

Add additional decision actions (3:41)

If the ticker’s RSI is not above the assigned level, you can add a decision recipe to the “No” branch to reference if the RSI is below a certain value. You can use the same ticker symbol custom input and decision action. However, this recipe will evaluate if RSI is under 30, and the custom input link will be labeled “Low RSI Level.”

Decision recipe evaluating if ticker RSI is below 30, with custom input

Select “Save,” and the decision action is added to the automation editor. 

Decision recipe referencing low level RSI added to the automation editor

The automation will begin by determining the underlying symbol’s RSI is above 70. If it is not, the bot will then check if RSI is below 30. 

Open position actions (4:53)

The framework is in place outlining the market criteria the bot will scan for in the automation. Now you can tell the bot what to do if the criteria is met. 

This example will sell a call credit spread if the ticker is overbought and sell a put credit spread if the ticker is oversold, defined by the decision recipe’s high and low values.  

To open a position, select the “+” icon under the “Yes” branch of the first decision to view the list of bot actions. Select “Open Position,” and a list of position types appears.

Open position action for a short call spread

This tells the bot to open a short call spread if the ticker’s RSI is above 70. You can reuse the ticker symbol custom input to link the open position action to the decision action. Customize the credit spread’s specifications, including the expiration date, option leg details, and contract size.

Short call spread position details settings

Select “Save,” and the open action is added to the automation editor. 

Open position action for short call spread added to automation editor

If the RSI is below 30, the bot can open a short put spread. Repeat the process by adding an open position action to the “Yes” branch of the RSI low-level decision recipe. Customize the short put spread settings and select “Save.”

Open position action for short put spread added to automation editor

If RSI is not above 70 or below 30, the bot will simply end and not do anything until one level is breached.

The automation editor displays all custom inputs and their usage in the settings and any open or close position opportunities.

Custom inputs and opportunities

You can always test the automation by selecting the “Test” icon at the top of the automation editor. You can even change the custom input values to test different outcomes in current market conditions. This is a great way to test the bot’s logic with different symbols and values.

Testing the automation

For example, if the RSI High Level is reduced to 50, the bot would open a short call spread if the automation ran at the time of the test.

Automation log bot test

When you exit the automation editor, all custom inputs used in the automaton are displayed. You can always edit the custom input values at the automation level without going into the automation itself.

Bot scanner details with custom inputs listed

Select “Save,” and the scanner automation can be seen in the bot’s dashboard. Remember, the bot and automations are still turned off.

Scanner automation in bot dashboard

You can also hover the mouse over the “i” icon to view the automation’s custom input details. 

Information icon displaying custom inputs inside the automation

Reuse, edit, and add an additional scanner automation (9:15)

You can add a second scanner by reusing the same basic framework of the first automation. Because a custom input was used for the ticker symbol and RSI levels, you can easily edit their values when adding the automation.

Select the “+” icon in the Scanners section and choose the same RSI Swing Scanner. You then can change the ticker symbol and RSI levels.

Adding and editing a previously created automation

The reused and modified automation will be added to the list of scanners. It will use the same decision criteria to scan for opportunities in GLD and open a credit spread if either condition is met.

Create and add a monitor automation (9:38)

The scanner automations can add two different types of credit spreads, so this bot will need two separate monitor automations to manage call spreads and put spreads. 

Select the “+” icon in the Monitors section to create and add a new automation. You can name the automation in the automation editor.

Adding a new monitor automation

Add a repeater action (10:33)

Monitor automations typically begin with a repeater action. Repeater actions are an efficient tool that pulls information for a specified position type and loop through all corresponding positions open inside the bot.

Adding a repeater action

You can assign a position type for the repeater to reference. This monitor automation will use the repeater action to manage only short put spreads open in the bot.

Select position type for repeater action

Decision recipes (11:17)

After the repeater action is added to the automation editor, you can create decision recipes to manage and exit positions using market data.

Adding a decision action below a repeater

For this example, the bot will first check if the position’s premium has reached a defined profit target. 

Decision recipe evaluating a position's premium

You can set up the recipe to monitor if a position’s premium has increased or decreased by a specified percentage since entry. Because this is a profit-taking exit for a credit spread, the bot will first check if any open put spreads have decreased by 50%, which represents a 50% profit.

Decision action added to the automation editor

A custom input is used to link positions opened with the scanner automation. You can add a “Close Position” action under the “Yes” branch to exit the position if its premium has decreased by 50%.

Adding a close position action

If the position has not reached a 50% profit, another decision action can be added under the “No” branch. For this example, the bot will check if the position expires in less than five days. 

Decision recipe for days until expiration

A “Close Position” action can be added under the “Yes” branch to exit the short put spread if the position is five days from expiration.

Decision action and close position action added to automation editor

The monitor automation will repeat through all open put spread positions. It will first check if the position premium has decreased by 50%. If it has, the position will be closed. If not, the bot will then check if the position expires in less than five days. If it does, the position will be closed. If neither condition is met, the automation will end and wait for the next interval to check market conditions.

Exit the automation editor, select “Save,” and the monitor automation will be added to the bot.

Monitor automation in the automations tab

Creating an automation copy (15:06)

With the put spread manager in place, the same process can be repeated and applied to call spreads. Because many of the “Put Spread 50% Manager” monitor components can be used, creating a copy of the automation is more efficient.

Adding an automation copy

The copy is created instantly. You can use the same framework as the original automation and modify the necessary criteria. You can change the title to differentiate the two monitors. The repeater action must also be changed from put spreads to call spreads.

New monitor automation using a copy, with changes to title and actions

You can always edit any of the recipes inside the automation editor. For example, the call spread manager may take profits at 25%. This change will only be reflected in the new copy.

Exit the automation editor, select “Save,” and the new version of the monitor automation is added to the bot.

Completed automations in the bot

Turn the bot on, and it will begin searching for credit spreads to enter based on RSI levels. Monitor automations will automatically trigger once a position is opened inside the bot.

This video example demonstrates how to automate an entire strategy from entry to exit and how multiple automations can easily be copied and edited to create the bot quickly and efficiently. You can scan the market for different entry and exit parameters using different tickers and open and manage different position types simply by reusing and modifying automations and recipes.

Next article
Trend and Momentum Trading Bot
How to build a bot using multiple indicators to trade with the trend and momentum.
Was this helpful?
FAQs
Related articles

Trade smarter with automation