This video demonstrates how to build a bot using multiple moving average indicators to enter new positions.
Create a New Bot (:12)
This example will use a new bot and new automations. To build a new bot, select “Create Bot” on the Bots homepage. Name the bot, customize the icon, and set allocation and position limits in the global bot settings.
This bot example will use the functionality of previous trend decision automations but will add another layer of recipes to compare multiple moving averages.
Add a New Scanner Automation (1:05)
Scanner automations tell the bot what market criteria to search for before entering a new position.
To add a scanner automation, select the “+” icon in the Automations tab.
When adding an automation, you can 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.
Select “New Automation” to access the automation editor, where you can name the automation and add decisions and actions.
Add a Decision Action (1:39)
To add a decision action, select the “+” icon in the automation editor, and choose “Decision.”
Decision actions tell the bot what market data to filter when scanning for opportunities. There are multiple criteria to choose from when using decision actions.
For this example, the bot will first determine if the underlying position’s short-term moving average is above a long-term moving average.
You can manually type in a ticker symbol or use a custom input to make the field flexible when using the automation in the future.
The fields are variable, so you can define the parameters to fit your trading strategy. This example will check if the 50-day simple moving average is above the 200-day simple moving average. Select “Save,” and the automation will continue down the “Yes” path if the criteria is met.
The automation editor displays the completed decision recipe for comparing multiple underlying symbol indicators.
The automation is split into two different branches. The scanner automaton will check if the ticker symbol’s 50-day simple moving average is above the 200-day simple moving average. The resulting answer will dictate what the bot does next.
Open a New Position (3:25)
Select the “+” icon under the “Yes” branch of the automation editor to view the list of bot actions. This tells the bot to take action if the ticker symbol’s 50-day SMA is above the 200-day SMA. In this example, the bot will open a position in the underlying security if the answer is yes.
You can select the position type for the bot to open. In this example, the bot will purchase long equity if the criteria is met.
You can manually input the ticker symbol field or use the previously created custom input to link the two actions. Select the blue custom input icon and choose the Ticker custom input.
Select “Save,” and the open position action is added to the automation editor.
If the ticker symbol’s 50-day simple moving average is above the 200-day simple moving average, the bot will open a long equity position with one share of stock. If the 50-day simple moving average is below the 200-day simple moving average, no position is entered, and the automation ends.
The scanner automation is now complete. You can add it to your library in a specific folder. Select “X” in the top right corner to exit the automation editor. The scanner automation details are displayed, as well as any custom inputs used. Select “Save” to add the automation to the bot.
Inside the scanner dialogue, you must manually set any custom inputs. This bot defaults to SPY for the ticker symbol, but you can change the input at any time.
Select “Save” to add the automation to the bot.
Copying and Editing Monitor Automations (4:39)
With the scanner complete, the bot will search for new long stock positions to enter based on the criteria. You can add a monitor automation to manage existing positions once they are opened. Monitor automations are only triggered when positions are active inside the bot.
This bot example will copy and edit an existing monitor automation. Select the “+” icon in the Monitors section to select from a list of available automations in your library.
Copying an automation enables you to immediately replicate and modify an automation without changing the original automation. Once the copy has been made, you can rename it, edit the decision criteria, and add it to your library.
The monitor automation uses a repeater action to loop through all long equity positions. Because this bot will open long equity positions, the repeater does not need to be changed.
However, the decision action referencing if a security is below its 200-day SMA needs to be deleted. Select the decision action in the automation editor, toggle the recipe, click the settings icon, and choose the trash icon.
A new decision recipe can be added with different criteria for the bot to reference. Again, the ticker symbol can be linked using a custom input.
The decision action will use the same recipe as before, with a minor change to check whether the 50-day simple moving average is below the 200-day simple moving average.
If the 50-day SMA is below the 200-day SMA, the bot will close the position. If the 50-day SMA is still above the 200-day SMA, the automation will end.
Save the automation and turn on the bot. The scanner automation will search for new positions to enter. The monitor automation automatically triggers to manage positions once they are opened.