We've all been there. For whatever reason, you wish you could exit all your positions at once. It can be overwhelming to close multiple positions simultaneously. If you’re reacting to unexpected volatility or a flash crash, manually exiting each position can take too long.
The monitor automation will loop through and instantly close all open positions inside the bot using a close position action.
This powerful feature gives you a another layer of complete control in your bots and may be used as an intelligent safeguard against volatile market events.
In this video, I'm going to show you how to instantly close all open positions inside of your bot. And we're going to do this using a very simple bot button that we can add to any of our bots.
This demo bot here has six open positions. Now, notice I just opened these positions manually with a bunch of different ticker symbols so that I can show you how we can close all of these in one full swoop using the bot button.
So if I go over to my list of automations, you'll notice that I already have one button here to open an iron condor position. And this is using a bot event that whenever this button is clicked, it runs this automation to simply just open an iron condor position. This is how I actually got the original positions into my list of positions.
Now we're going to create another bot button. We're going to go down here to events and go down to a manual event. Event-based automations are really cool because they allow us to run automations when certain events happen inside of the bot. We can run events when a bot opens a position or closes a position, or we can run automations on a date or repeating schedule.
And in this example, we're going to show you how to run an automation at the click of a button. We're going to create our own custom button that we can add to the automation dashboard. In this case, we'll call the button close all. This lets us know whenever we click this button that it's going to close all of our positions.
We can even set a certain button type or style here, and then we can choose what automation it's going to run. In this case, we're going to create a brand-new automation for this particular bot button. We're going to call this automation a button and call it close all positions.
This way, when we add this automation, we know exactly what this automation is doing and how it could be or should be used inside of our bot. I'd like to use this name in conventional way where I tell the automation name where it goes in the automation so that if I share it with somebody, then they know what the automation is used for.
In this case, a button that would close all positions. Next, I have to tell the automation what to do whenever the button is clicked. And the first thing that we're going to do here is we're going to have the bot loop through all positions. This is because we want the bot to pull in all information and all positions that are currently open inside the bot.
Now, we're not going to filter by a certain position type, but we could filter by just iron condors or credit spreads. But here, we're going to leave it to all positions. And then go ahead and save. So when the automation runs, it's going to loop through and pull in the information for every open position.
Now, we're going to add another action to close the position. We're going to connect the position to whatever position it's looping through. And we're going to set all of our information on how we want the orders to be submitted to our broker using smart pricing and our final prices. Once we're good to go here, we simply can just hit save.
Now, our automation is built out. As soon as we click the button to run this automation, the bot would loop through and pull in the information for each position the bot has opened and then submit the closing orders to our broker. That's a really easy automation, and you'll only have to do it once.
And once you save it to your library, you can reuse this button inside of all of your bots if you want to. Once we're good to go, we simply hit save. And then, we save again and add this to our automation.
Now, at the top, we have two buttons. One button to open our iron condors and a button to close all of our positions. If I click this button here, which I'll do here in a second to close all of our positions, then it will start submitting orders to every single one of the positions that we have opened, to start trying to fill those closing trades with our broker. So go here and just click this, and the automation will start running.
Now, we've submitted orders for each of the different positions that we have. It's going to go through and starts to close all of those positions just with the click of a button. If I go back to my list of positions, you can see that already four of the positions have closed, and two of the positions are still working through their SmartPricing progression.
We just refresh here really quick. You can see another position got closed, and now we only have one more position that's currently working through its SmartPricing progression. As soon as the orders are filled, and everything is closed out, and then all of our positions are now removed from the bot.
You can see, in this case, with our demo bot, all of our positions have now been removed and exit.
Again, we did this really simply. Just using a very simple close or liquidate button. We connected this bot event button to a simple automation to loop through positions and close every position.
Now you can use these inside of your bots; or of course use another version or different combination. But bot buttons are really powerful way to take massive action on a lot of positions inside of your bots.