- Create a new bot using Bollinger Bands as the core trigger signal.
- Scan for signals automatically to trade credit and debit spreads.
- Use a decision recipe to prevent the bot from entering multiple positions in the same ticker symbol.
- Build a monitor automation with management decisions for multiple exits based on profit targets, time until expiration, and Bollinger Bands.
- Use new decision "switches" to to toggle between credit spreads and debit spreads.
Bollinger Bands Bot template shared in the Community.
Welcome again to the bot workshop. Tonight we're gonna be going through an automated Bollinger band strategy. So here's kind of a rundown that I have for the strategy, or right now, at least the goal for the workshop together. Again, this is just purely to give you another idea, another way to build bots, help you start the transition, start to think about it.
What I always think comes best out of these events and workshops is afterwards when we post the actual template to the community, which we'll do live together. Do your own version and modify it. I'm gonna be talking about modified versions and different ways you can use Bollinger bands tonight. By no means this is the only way, and all be all. So let's share with each other. Let's help each other out. Post your own version, share back to the community once we're done, and help each other out.
But we'll be creating a Bollinger band bot together tonight, as with Bollinger band is kind of the core trading signal. We're gonna be showing you how to set up and scan for those signals automatically and then trade spreads. We're gonna be doing something a slightly different in this one we haven't done before, which is using decision switches to easily toggle on or off whether you want to trade credit spreads or debit spreads. Super easy. We can do it together with the switch.
We're also gonna be using decisions to prevent the bot from entering multiple positions in the same underlying ticker symbol at one time. So what this allows us to do is make sure that we're not doubling up on positions. We already have a position and a ticker symbol, no more, okay? There's just one way you could do it.
Then we're gonna be building out our monitor automation with management decisions for multiple exit points. You can do this based on profit targets, time until expiration, or some sort of reversed Bollinger band signals. So however you guys like to do it, you can do it multiple ways. If this is true, exit. If that's true, exit. If that's true, exit.
And then finally, like I said, we're gonna be using the new decision switches to toggle between credit spreads and debit spreads. So here's just a really simple like look at Bollinger bands on chart. So this is, you know, kind of you got a visualization of what we're trying to go after here. So on here on left, you guys can see my mouse; I'm doing this. I think you should be able to. But on here on the left, what we're gonna be doing tonight, and this is just one way you can do it. Again, build another version, another type of bot, share back in the community.
But we're gonna be using the breakout of the upper band as basically the trigger for entering the position. And then, in this case, we can sell opposing credit spreads or directional debit spreads. And then we'll be using as one of our exits in addition to profit-taking or time until expiration etc. We're gonna be using the stock coming back inside that middle-moving average band. So kind of that middle band in there. So, in this case, this would be the breakout here, and we would start selling put spreads. And then when it came back inside of this middle band, then we would exit those put spreads or stop selling that put spread, exit that position.
So same thing here; if this was the breakout, it started to break above the actual upper band, then we basically traded it the whole way up here, bla bla bla, up until here, however long that position is. And then, because it came back inside that middle band, then we would exit the position. That's just visually how we're gonna be setting it up.
So let's do this. Let's jump on over into the bots. So first thing that we're gonna do. We're gonna start by just building our bot totally from scratch. We're gonna call this Bollinger Band Bot; we call it from the bot workshop. Give it a name, give it a little icon, whatever works for you. Make it a little custom. Pick something a little bit different. Be like Bollinger bands or kinda like bats, I don't know, whatever. You give it whatever you want.
Next thing is, you're gonna choose what account it goes into. So this is important. Every bot is tied to an account. You gotta choose that account cause it gets locked into that account when you get started. So you can choose a paper trading account, you can choose number paper trading account, you can make a bunch of them at Option Alpha, run our own paper trading engine. Or you can choose one of your live accounts if you're connected to your broker, okay? We'll just choose our paper trading account for now.
Next thing is, we're gonna go ahead and set a total allocation for the bot. This is basically where you tell the bot, "Look, this is how much you have to trade inside of this bot." You can do a lot more with allocating for individual positions, but this is kind of like your final fail-safe, your backstop for all of your trading. So you can do something as little as $1000, or you can do $3000, whatever works for you, just put that in there. That's your backstop for your bot allocation.
Last thing that we're gonna set here is we're gonna set position limits. Now position limits are super cool because what they allow us to do is tell the bot when it's turning off its scanners automatically. Now what this means is that it will keep looking for positions until it hits this position limit. Now there's no limit on the number of positions or the number of times you can close the position, right? It's only, you can set limits if you want to, on the number of positions the bot opens.
So one position per day or two positions in total. In our case, maybe we'll give it something like five positions in total and five positions per day. That means it can get two positions today three tomorrow. It could get all five today, but when it reaches five, it stops entering new positions.
So once we're good to go there, we'll just simply hit create. Now you can go over and view your new bot. Now your bot is a completely empty shell. So it has nothing in it right now because we're building it from scratch. So, of course, all of your automations are automatically turned off until we start adding them.
To add your first sets of automations, we're gonna go over to the automation tab. Now, this is literally the brain of your bot. Automations are where you tell the bot what to do and when. You think about it as like an instruction manual, a recipe guide; it's the set of criteria that the bot goes through. And you tell the bot when it can make decisions and when it can take actions, okay? So that's what the automations do.
Now there's a couple different ways you can trigger automations. In this bot workshop, we're gonna be using scanners and monitors. And really, we only need just one scanner and one monitor automation for this workshop, okay? So, you can use multiple ones to trigger different things in your bot, and for this particular one, we only need one scanner.
Scanners are usually used to find new positions, so everything that we would want the bot to do to get into a new position, all the criteria we want the bot to check, that goes into the scanner to open a new position. Then our monitor automation is where we're gonna tell the bot what to do with any open positions.
You can think about it like you have one part of your bot that's looking and hunting for things. And the other part of your bot is managing any positions that the bot has. The beautiful thing about doing this in Option Alpha is that you can swap these scanners between bots or use them over and over again. There's really just no limit to how many different things you can do with it.
All right, so the first thing that we're gonna do, we're gonna add a scanner. Just click that button to add a scanner. Now notice that you can add it from your library if you already saved them, then you can have another one in there. You can modify ones that already are in your library. If you already have a really sweet scanner, you can create a clone of it or a copy of it and then just add it and modify that.
Now we don't need to do that. We're gonna build one completely from scratch here tonight. So we're gonna call this one our Bollinger bands scanner for spreads, okay? You name it, whatever you want. I like to name it something really specific, so I know exactly what it is. And of course, you save it into your library. I'm gonna save it to Kirk's Scanners. Now I have that forever. If I want to reuse this on another bot, I can just simply add it right to that bot. I don't have to build it 22 times, right? So once it's done, it's done.
First thing that we have to do is we have to start adding actions. So whenever this scanner starts running, remember think, we're turning on the bot. We're now scanning for a position. What do we want the bot to do first? Well, the first thing that we typically do is we start this with a symbol loop. Symbol loops are super awesome. It's basically like telling the bot what symbols you want the bot to go through.
Now you don't have to do this with the symbol loop. You can choose to just tell the bot to do one position. You can start with a decision recipe, but if you want to try a little portfolio that's all looking for Bollinger band little breakout all over the place, you need to use a symbol loop. Now inside of your symbol loop, you'll just set all of the symbols that you want the bot to loop through. So you go through all of your different symbols here, and you just plug them in here, and you just say, "Look, I want the bot to loop through these particular symbols." Don't want one, just remove it. Once you're good, then you simply hit done and then save.
So what this does with the symbol loop is it tells the bot when it starts up to loop through SPY, TLT, GLD, XOP, DIA, whatever symbols you want, and then individually analyze each one of those symbols. Now what we have to do is we have to now add actions below that.
Okay, bot, we've told you what symbols we want you to go through. Now, what do we want you to do? Well, we want you to start to make some sort of decision. Now notice inside of your decisions, you can use any of these recipes that are listed here, right? These are all available recipes that use natural language to just swap out variables and tell the bot what to do.
So one thing that we might want the bot to check is, as I said earlier, we might wanna check and see if the bot has room to open a new position. These could be really simple, easy things that you can check. You can check and see if you already have a position in the underlying symbol that it's looping through currently. And if you don't have a position in there, then you allow the bot to continue moving forward. Does that make sense?
So you can go down here to these bot-level recipes, and you can check and see if the bot already has a position with that symbol, or a position of a certain type, or a position of a certain type and of a certain symbol. Whatever you want, right? You can check that in here. So we're just gonna use this recipe here. We're gonna check and see if the bot has exactly 0 positions with this symbol that we're currently looping through.
So if the bot has 0 positions, meaning it does not have a position at all. Then we're allowing the bot to continue and possibly look for a position in that symbol, okay? Now inside of this symbol field, we can type in a symbol like GLD. That doesn't really help us because then every time we use this recipe, it's gonna reference GLD. It's only if you always wanna check the same symbol.
What you can actually do you can connect this field using these custom inputs to the loop that's already running. And now what's that gonna do is using a custom input. It's gonna automatically swap that symbol out as it loops through each of these five symbols that we have here. So when I hit save, and I add this to my automation editor, the bot's gonna loop through, and it's first gonna check SPY. Then it's gonna check SPY and ask itself, "Bot, do I have exactly 0 positions with SPY?" Yes? Go down this path. No, I already have one position; go down this path.
So that's the first one. We're gonna first check and see if we have 0 positions with that symbol. If we don't have 0 positions, we have something higher, which we want to end. End that automation for that symbol, don't double up on another decision.
Next thing that we can add is another decision. We can check and see does the bot even have availability to enter new position. So you can do something like the bot can open a position, or the bot is currently opening a position, you can do a lot of these other things and kind of group these together if you want to as well.
One that I like to use is the bot can open a new position. This means that the bot has that one extra slot available to open a position. Now, if you don't add this in here, you'll just get a warning when the bot tries to open a position; it'll say, "Hey, you try to open a position, but you already have your max positions." Fine. But if you add this in here, then, in this case, you're gonna double check and just make sure, like, can I open a position? Because then the bot will stop before it even gets to a point of reaching an error.
Now, here's where we're gonna start adding our decisions for Bollinger bands, okay? So we've done some like preliminary checking in the bot to make sure that we don't have an existings position in that symbol that we're looping through, to make sure that the bot has room to open a new position, right? You can mix these up in order, doesn't always have to be the same order, but just one way you could do it.
Now what we're gonna do is we're gonna have the bot start to make some decisions based on those Bollinger band indicators. So we just go down to our list of decision recipes down here, and we're gonna choose this recipe here which is the Bollinger band recipe, okay? So we're gonna choose this recipe here which is our Bollinger band recipe.
Bollinger bands are a little bit different, so they get their own special recipe right inside the list. But of course, everything is natural language. You just have to re-plug, you know, choose your variables here, and then you're off and running. First thing that we're gonna do here is we're gonna connect the symbol to whatever symbol we're currently looping through using custom inputs.
So again, just like we did before, we can connect that symbol to the symbol that we're currently looping through. That means anytime we change the symbols; it automatically flows throughout the rest of the bot. It's like you're making a phone connection. Connecting wires between the decisions inside of your bot.
Next, we're gonna go and first check and see if the symbols price is above because remember our graphic in the beginning. The first thing we're gonna look for is that breakout above the higher band. So we're just gonna leave this variable as above. So we're gonna check for the symbol price being above one of the Bollinger bands.
Now, this is where you can set your Bollinger band period. You can set it as a 20, as a 30, whatever you want to set it. Set your Bollinger band period here. We're gonna leave it as a default two period and a default two standard deviation Bollinger band setting. Basically, exactly what I showed you on that screen chart, on the chart, when we first started.
You can also choose whether you want to use a SMA or an EMA for the exponential period or for the moving average period. We're just gonna use an SMA, very standard setup. Again, you can use your own modified version if you want to.
Next, we're gonna check and see if the Bollinger band price is above the upper band. So we're gonna check and see if the Bollinger band price is above the upper band, which to us would signal a breakout to the higher side, okay?
The final thing that we can choose is we can choose whether to look at it intraday, meaning like right when the bot pulls the data. So whenever the automation runs, it does it immediately and checks is the price right now above the currently calculated Bollinger band. That's intraday, that's right now. Or you can check it from like a day ago, or two days ago, five, whatever you want.
If you wanna trade based on some signal that happened five days ago, fine, do that. Just check and see if it was outside of that five days ago, right? You can check and see using a group decision if the Bollinger band was inside or below the upper band yesterday but then above the upper band today. You just do a group decision and do the variables for each of those.
So once you're good, you simply hit save, and by the way, this is where you would make that group decision. You can just add another decision here if you want to and group them together in an and statement. And then go ahead and save this to your actual automation editor.
Now, if you want to, and this is what I would usually do sometimes in here. Just go ahead and edit this caption. You can say, "Do we have a upper Bollinger band breakout?" You can edit it to whatever you want. An upper Bollinger band, yeah, thanks Grammarly. An upper Bollinger band breakout. Right, you can just modify that if you don't like the way it looks. You can do that for any of these.
So now we've got one set of our trigger set up. So what I'd like to do when I build out my bots is I like to build out the signals first. Then I kind of come back in and build out the actual trades. And I'll show you why I do that here in a second, but let's build the other signal. So if we don't have that upper breakout signal and the idea is no, right? So we don't have that upper breakout signal, then we wanna check for potentially lower breakout signal, right? And trade credit spreads in the other direction, right?
So here's what we can do. We can add a decision down the no path here. We use the same recipe, which is the Bollinger band recipe. We can connect this to what? We connect it to our symbol using custom inputs, and now we wanna check and see if the Bollinger band or if the symbol price is below the lower band on an intraday basis.
Now we've got both sides of our signals setup. I know I went through that one a little bit faster, but you guys see how we did that, right? We just add it if we don't have the upper breakout signal, and the answer is no; well, do we have a lower breakout signal? Could we trade it in the opposite direction, right? Because we don't have any position in the symbol right now, so could we do it one way or the other, okay?
And again, you could modify this and say, "Do we have a lower Bollinger band breakout signal?" Right? Whatever you want. You can modify that right here. I still did a versus, nope. Yep, there you go. Okay?
So now we've got our signals in place. When looking for those breakouts above the upper band or a breakout below the lower band. So what do we wanna do here when we have that upper breakout?
Here's what we're gonna do first, and this is what's super, super cool. This is why I love about using bots and switches and all this other stuff. First thing that we're gonna add here if we do have an upper breakout is we're gonna add a decision called a switch. It's all the way at the bottom here, and it's this decision recipe down here called a switch. And what a switch does is it literally a switch that you can set in your automation to toggle the bot to go one direction versus the other.
So, in this case, we're gonna create a switch. We're gonna add a switch label, and we're gonna call it "Credit Spreads ON." How about we call it "Trade Credit Spreads." We can set the default values on, and we can give it a little description. And this is what's cool. Turn on to trade credit spreads. Leave off to trade debit spreads. Make sense?
If we leave this on in the way that we set it up, it'll go down the path to turn on or to trade credit spreads. If we turn it off, it will automatically trade debit spreads. So one switch can control an entire part of the automation, just by you turning it on or off.
So we can save this now, and then we can add this right here into our automation editor. So now, if we have an upper breakout of the Bollinger bands, we can ask the bot, "Hey, is our credit spreads switch turned on?" And if it is turned on, we're gonna go down this path, and we're gonna tell it how we wanna trade credit spreads. And if not, we're gonna tell it how we want to trade debit spreads.
So we're gonna do this. We're gonna say turn credit spreads switch is on, and you can make it really specific if you want to. And just modify any of these variables. So what do I want the bot to do? Well, if it's on and I go down the yes path, now I'm gonna tell the bot, okay, look, if I go down this path, I want you to sell a put spread. A short put spread, okay?
And then here's how I set up my short put spread. So I'm telling the bot whenever you get to this decision, and you wanna start telling the bot open a position, just add your open position action. Now, like always, we can connect the symbol field to whatever symbol we're currently looping through. Then we build out exactly how we wanna trade our short put spread.
You tell with the exact expiration time, or the number of days, or the target days between some days. You tell it exactly what strikes to use, like $2 below the underlying price or whatever works for you. You set it up exactly the way that you want. You tell the bot exactly how many contracts you wanna trade or up to a certain amount of risk. You say, "Look, bot, trade five contracts." Or trade up to $5,000 of risk or up to $500 of risk, right?
You say, "Bot, trade 2% of my allocation or 2% of my remaining capital available." Or you can do this with other bots. You can match qualities when you do hedging and adjusting. You can say match the position that I already have someplace else.
So you set that all up here when I can do that together. That's all on you. And then you finally tell it how you wanna send the orders over to your broker. You can use smart pricing or not. You can tell the bot, "Look, try up to 5 prices, 20 seconds apart." And go 100% of the bid/ask spread. That means it will fire orders and cancel orders automatically for you as it sends them to your broker.
By the way, if you've never done this yet, it is wild to watch it happen. When you watch it happen the first time, you're like, oh my gosh, I've never- like you'll never go back to manually replacing orders ever again.
So you can tell the bot, "Look, try five prices up to 100% of bid/ask spread," or you can say, "You know what? Try up to 75% of the bid/ask spread, and then stop." Right? As many prices as I can possibly get. That way, you're trying different prices automatically inside of the bot. Once you're good to go and you have all that in place, go ahead and save that to your bot.
So let's think through this logic all the way through here. The bot is gonna start looping through a symbol like SPY. It's gonna check for SPY first. Everything until it gets to a no or to an ending point in the automation. So it's gonna check, do I have 0 positions with that symbol; SPY. Yes, I got no positions. Good. Can I open a position? Yes. Do we have an upper Bollinger band breakout? If it does, yes. Is my credit spreads switch turned on, so I'm trading credit spreads? Yes, okay, great, open up a short credit spread.
So it's literally just walking down a progression of decisions. By the way, this is no different than what you, and I, and everybody else used to do manually. We just do that all the time.
Now, if I don't have the credit spreads which turned on, I wanna go and open up a long call spread, right? Because I want to trade debit spreads. So you could do this here. You could go in here and say, I wanna trade a long call spread. And you set up everything for your new long call spread just like you normally would with all the other ones. Link the symbol field. Fill in all of the parameters for it, and then go ahead and save.
So now, right here, at the end of this. This is what you wanna focus on really quick right here. Just pay attention for a second. If I have my credit spread switch turned on, it will go down the yes path and open short put spread which is a credit spread strategy. If that switch is turned off, and I'll show you how to do this once we save it, then it will open up a long call debit spread, right?
So one switch, later on, can go on from trading credit spreads with this to trading put spreads or our debit spreads. Like just one switch, you can have that turned on and off.
Let's do the same thing over here for the lower breakout signal. If we have a lower breakout signal, you wanna first add our switch, right? Now because we've already built our switch, we don't have to rebuild it all over again. We can select the switch that we already have. We already built our switch called "Trade Credit Spreads," so we just use that over again here in this decision as well.
Now it's the same one. Same switch that's gonna be turned on. We don't have to turn on multiple switches; just use one switch turn it on. Now, if we have that credit spread switch turned on, we're gonna open a new position because we have the lower breakout of Bollinger bands. This time we're gonna sell a short call spread, okay? This time we're gonna sell a short call spread which is our short call spread strategy; it's a credit spread strategy.
We fill out all of the variables for this open position and then go ahead and save—same thing here for the debit spread. We can build out the debit spread here. Tell the bot, "Look, if that other switch is not turned on and we've got the lower breakout, go ahead and do a long put debit spread." And now, right here inside of my bot, I've got literally four different things that I could do based on Bollinger band and the switches that I use.
You could do these switches off of the yes/no path earlier if you want to, but you don't have to use them in the same place. So a lot of people what they like to do is they say like, "Okay, if I'm trading like upper Bollinger band breakout, I wanna use this switch for credit spreads. But if I don't wanna do that on the lower one, I could choose not to use it and just do an iron condor, just do a long call, or just do whatever."
And so you don't have to. You can use them in lots of different places; like I said, I like to use them sometimes where I'm hedging, like do I want to hedge? And I have a hedging switch allowed to be turned on or not. And then, the bot will allow itself to be hedged or not. So, you could use it a million different ways.
So once you create your first switch in a bot, you just simply add that same switch right back in. Now here's one other thing I gotta show you, and I'm gonna add it to one of these, right here, really quickly because this is crazy, crazy stuff that you have to do inside of your bots. And I want you guys to take this and expand it a million times, okay? Please do this. Add your own versions of this. I just wanna go through this quickly because it is super, super important when you're doing your automated trading.
Now that we've built out the actual open position actions, what we can actually do here is filter these potential trading opportunities right inside of the bot. So inside of here, let's take this one as an example. I'll build this one out slowly, and then you guys can add like crazy to the other ones if you want to.
So if we're gonna tell the bot, yes, go ahead and open a short put spread. We can actually proceed this decision with an opportunity filter. It's just another type of decision, and you go through your list of decisions here, and you go down to your list of opportunity recipes. Now opportunity recipes literally sound like exactly what they are. The bot is evaluating a potential trading opportunity for you.
Look, these guys work for you. Tell them what to do. They love this stuff. Literally, they tell me. They're like, Kirk, we love crunching numbers. Oh, they love it; they eat numbers all day. They never get tired, ever. Just tell them what to do. And you can have them filter all of your opportunities so that you only place an order when the moment is right when all of the things check your boxes.
So, in this case, we can do something as simple as check the bid/ask spread right now for whatever I'm gonna get into. So, in this case, I can use this recipe to lookup an opportunity. The bot can say, "Well, what opportunity do you want me to check?" Well, we say, "Well, how about this short put spread that we already built out?" And this is where the bots are smart enough to say, "Look, I see you've got a couple different trades that you're gonna be potentially getting into. So why don't you look up the short put spread and confirm everything that I want you to look up."
And then what I want you to do is check and see if the bid/ask spread right now on this is less than 10 cents. Right now. Like the bid/ask spread position is less than 10 cents, right this second. Because if it's not less than 10 cents, don't do anything. And this is a really good- look, if you're gonna start automate trading, this is a really great way to let bots do the heavy lifting in manual process stuff. Let's be honest; we all forget to do it at some point, right? You don't always remember to do this, like check every little thing, volume, and this and that. But you can let the bot; they're never gonna forget.
And so tell the bot what to do. Say, "I want you to check that the bid/ask spread is less than 10 cents." Oh and, I want you to also, you can go down here, right? I want you to check and make sure that for this opportunity that we're still looking at, the short put spread. I want you to make sure that the short call leg or short put leg, open interest on the short put leg. Notice all the different things you can check in here. You can check all of these different things.
The open interest on the short put leg is greater than 1,000 contracts. Whatever it is for you. 500 contracts, right? So it's gonna check, not only is the bid/ask spread less than 10 cents, but and the short put leg open interest is greater than 500 contracts. It's just gonna try and prevent you from jumping into a pool of liquidity that's about as shallow as my ankles, right? That's what it can do for you by just, you just telling it what to do.
Notice you can just keep adding here as much as you want. You wanna check the volume; you wanna check the underlying price; you wanna check another leg; you wanna check a delta, a gamma, whatever. You check all of those things, put it all in here, and then simply just add it to the yes path. So what the bot is gonna do if you look over here on the left is before it gets to the open position action, where actually sends the order to your broker. It's gonna first check all of your criteria that you put in there.
It's gonna make sure everything checks out like yes, this is good, that's good, this is good, that's good. Boom, you're off. Okay? So add those to all of your open position actions. This is an easy win for you guys like this is one that when we start building this out, I was like this is such an easy win that nobody- be honest, like I never knew. Like I mean, you know, like, I never check all the time, right? Like you're just moving too fast. Sometimes you didn't have enough time. Don't let that happen now. Like now, you can do it. Just let the bots do it for you.
So do that to the rest of the other ones here. Okay, so we have our scanner built out. It's doing a lot of stuff, but it's only doing the most critical things necessary to check for those trades and then entering the appropriate trade wherever we need to.
Now that we've got our scanner built out, we just simply exit out the automation, and now you can see where our new input switches. And right before we save it, now we default it to turn on, but if we want to turn it off, just turn it off. So whichever way we go, if we turn it off, it's gonna trade debit spread. We turn it on; it'll trade credit spreads. And once we're good to go here, we hit save.
Now it gets added to our list of scanners. Now, all we have to do if we want to switch that is we just come in here, and we turn it off, and then we're done. Now we're like, oh wait, no, no, no. I wanna go back in; I wanna- I want to trade credit spreads. Okay, all right, fine, switch. Turn it on, and you're good to go. It's that easy.
So let's build out our monitor automation. Now again, everything that we did inside of this scanner was getting to the point of opening a position, right? The scanners where you tell the bot, "Look, do this, do this, do this, open." Okay? When you're open, and you're done, that's when you jump over here to the monitor automation.
Monitor automation is where we can be our Bollinger bands monitor. Okay? And we can call this three exits. I think we're gonna have three potential places that we could exit this position. You can call it whatever you want, you don't have to call it that, but that's how we're gonna call it.
Now, what we're gonna do this time is we're gonna start with another loop. Now first, when we did our scanner, we started with a symbol loop. The symbol loop was looping through potential symbols, looking for trading opportunity. This time, we're gonna do something a little bit different. And this time, we're gonna use a position loop.
What do you think a position loop does? It loops through positions that the bot has. So monitors are here sitting. They're like constant guard dogs for your positions. And as soon as the bot opens a new position, the monitors start running and start checking that position for you. And running through all of the things that you would want the bot to do in that position.
Now inside of a position loop, you can tell the position loop to monitor any type of position that comes in. Like it doesn't matter. Like all come, all positions come in. You can do that, or you can monitor certain types.
You can say I wanna build one monitor for my short put spreads and one monitor automation for my short call spreads. And I can manage each individual type of strategy completely different, if I want it to, inside of this same bot. We got a lot of bot examples that do this. Our genesis bot series is a great little walkthrough on how you can do this.
In this particular case, we're gonna use any position just to make it super simple. We're trading credit spreads, so we first want the bot to loop through any position that the bot has. Like bring them all on, and then we can divide and conquer and figure out what we're gonna do with these positions. So repeat each position, like I wanna see every position in here.
And then the next thing that we're gonna do is we're gonna use a decision to see if the position is a long or short position. This is what's really cool. We can use this decision right here, and you can say, okay, I wanna check and see if the position type is a certain type, or you can use it's a long position or a short position. There's a lot of different ways you can combine a lot of these together. Again try to give you as many decision recipes as possible, but we're gonna use the one that says, is the position long or short?
So we can select the position that it's currently looping through, again, using these custom inputs. So just connect it to whatever position it's currently looping through. And then we can say is the position a long position, or short? We'll just toggle it over to short and then go ahead and save, okay?
So now, when it starts looping through. So follow me on this because we go slow in the beginning, and we get faster as we go. It's gonna loop through every position. If the position is a short position meaning it's a credit spread position. Again we can just rename this and say is position is a credit spread? Because that basically anything that's a credit spreads. Is the position a credit spread? Yes, go down this path. No, go down this path.
Now you have split your management based on whether it's credit spreads or debit spreads. Totally easy to do, right? Does that make sense? So you can split it right here. You can split it with two monitors, but this right now seems like the most logical and easiest way to do it for this workshop, okay?
Now when you go down the yes path, what are things that you might want to check? Well, you might want the bot to check and see if it has a potential profit. So you go down to this position recipe here, and you say did my position premium go down by some amount since it was opened? Remember, we're trading credit spreads, so we want the premium to go down in value which would signify a profit on that credit spread.
So I use this recipe, I connect this to whatever position it's currently looping through, and then I just simply swap the variable and say, did my position go down in value by, say, 50% since it was opened. If it did go down in value by 50% since it was opened, what do you wanna do? Close, of course, take the profit.
So now you add an action. You tell the bot, look, if I get to this, so down the yes path. If my position- whatever one position it's currently looping through if it goes down in value by 50%, which is actually a profit. So let me rewrite this, right? Cause the credit spreads. Do I have a 50% profit? That's really what you're doing, right? Exact stop because it's a credit spread trade, so when it goes down in value, that's a profit.
Do I have a 50% profit? Yes, close that position. So you connect that position whatever one it's looping through, right? And you go ahead and just close the position. Just tell the bot, okay, you can close the position if it gets to here. If it said, you can set a switch and close it the other way. You could, too, right? You can set it this way and close it that way, or you can say, if it's a credit spread and or whatever, close it. You can group decisions together. Totally.
Now, if it does not have a 50% profit, what do you want to do? So that's one way you can close your position. Remember, I said we're gonna do three different exits. If I don't have a 50% profit, what might I want the bot to check next? Well, one other thing that I could check is I could check and see if there's enough timeline. Am I running short on time?
So I could use this recipe here like the position expires in less than a certain number of days. So I connect this to a position, and I say the position expires in less than two market days. And, if you want to, this is you can get really creative with this too. It is what I think is really cool, right? The position underlying price, right? And the positions underlying price is currently below my short put strike.
Because I don't wanna close a position that's out of the money. Like if my short put spread is out of the money, and it's two days from expiration, but I'm not being challenged, maybe I don't wanna close the position. So this is where you could group a decision together. See how we're doing this here? Like you can do this for your other one too.
So the position expires in less than two days, and the position's underlying price is below my short put strike. I gotta be in two days, and I gotta be challenged. If I'm not in two days and not challenged, maybe I don't want to close it, but if I am, okay, go ahead, add your close position action, connect it to your position, and boom. Now we've told the bot another scenario in which it could close the position.
So if we have a 50% profit, take it. If we don't have a 50% profit, am I inside two days, and am I getting challenged on the position? Yes, go ahead, close the position, right? All right, bot, you got approval. You get my stamp of approval. You can close the position and remove the trade from my portfolio.
Next one, this is the last one. Now this is using Bollinger bands, now the opposite direction, okay? What we're gonna do here is now we're gonna add another decision to choose whether this credit spread is a call credit spread, right? Or put credit spread, or one of the cases, right? Or whatever that is. Or you can just add the decision immediately for Bollinger bands to check and see if the price has come back inside of that range, okay?
I'm gonna do it a little bit more advanced because I want you guys to see how specific you can get with your bots. You don't have to do it this way; you could do it even more than this if you want to, okay? So I'm gonna now add a decision here. And again, this is later in the process. You can add it earlier. It doesn't matter, right? It's just another way that you can possibly do it.
So I'm gonna say that the position type that I'm looking at right now is a short put spread. So I want to check and see if the position type is a short put spread. And then I'm also gonna add another one here and again; this is just, you can do as many of these as you want to. Just keep going with them as much as you want to.
Now I'm gonna add one here that says, is the position type a short call spread? Okay. Now, if I'm not like immediately profitable or challenged, right, on the short put spread. And again, you can use this for the short call spread too. If I'm not immediately challenged on this, then I'm gonna check and see if I can see which position I am trading; is it short put spread or short call put spread? And then we're gonna add those decisions for Bollinger bands to check the inside band of those Bollinger bands. Does that make sense?
So now I'm gonna add a decision down the yes path. I'm gonna go down to my indicators, and I'm gonna choose Bollinger bands. I'm gonna connect that symbol that I'm looking at, and I'm gonna check and see if the price is now below the middle band. Remember, we used this on the chart earlier. If the price is below the middle band, and we had the breakout, we made the trade. And now the price has come back in the other way. Then I'm gonna go ahead and allow the bot to close the position.
So is it a short put spread, and we bought the breakout? Is the price now below the middle band on an intraday basis? Yes, go ahead close the position. For the short call spread, we do the same thing. We say, "Hey, we're gonna go here for the short call spread, and we're gonna check and see if the Bollinger band-" because remember, we sold a call spread when we got that lower breakout of the bottom band. So now we're gonna check if the prices now above the middle band on an intraday basis. Did we get a reversal in the Bollinger band? Such that we would want to go ahead and close the position, okay?
So now inside of this monitor, I mean you can see like what we're doing here. We're literally just taking this and building out the whole process like what happens at this stage, what happens at this stage, what happens at this stage. You can get crazy crazy granular with this if you want to, right?
But the idea behind this is, are you in a position where you're letting the bot go ahead and close the trade? And what I think is cool about using monitors like this is you tell the bot all the different scenarios in which you're allowing it to close. This is what we do anyway. We do this normally; we just mentally doing it in our mind. But now we can tell the bot, look, if this is all true, okay, go ahead and close. If this is all true, yes, go ahead and close, right?
And it just keeps doing this over and over. Never gets tired of doing this, okay? Once you're good to go with your monitor automation, all you gotta do is just simply save it. Notice how it saves right down here in the monitors section. So now our bot literally has everything that we need to start trading it. We can start scanning for opportunities; then, we can start monitoring anything that comes in.
Remember, the bot is gonna be looping through all of those positions. It will stop if it ever reaches anywhere close to $3,000 of total allocation. But everything we had was one position at a time, so probably won't do that. Won't get to that 3,000 max, so you can go ahead and modify that yourself.
And then it's gonna look for five positions at a time. Now we're telling it to loop through all five symbols, may not find anything right away until we get some breakouts. But guess what? That's great. That's what you want bots to do. You want bots to go out there searching and scanning for trades for you, so you don't have to.
So you guys can focus on I wanna give you bigger problems. Like being an actual manager of the portfolio, choosing strategies, researching, right? Doing the hard due diligence on like do I trade this or this? Right? That's a way better use of your time than looking and flipping through charts and hoping you catch everything, right?
So let the bot do what they do best. Now here's the cool thing. When you have your bot built, and you have your awesome awesome template for your bot. Where you're gonna be, you're gonna go up here, and you can save this bot as a template. Templates are amazing because what they do is they solidify a bot strategy forever in your library.
And then you can use that, reference it, delete it. There's no limit on templates. No limit on templates. Save as many templates as you want to. I haven't seen they reach a limit yet; maybe somebody will, but save hundreds of templates if you want to from people, right? And then you save that template, give it a name, give it some tags, some icons, whatever. Save that to your library, right?
Now you have your template. You can keep versions; you can keep your own notes, you can save tags to it, you can look inside of it and be like, oh what did I do on here? Oh, that's right, I did that. Right? You can keep that all in here and just keep it inside of your library. Then when you wanna make a new clone of this, you just spin up a clone really quickly right from here, or you can save another version on top of this.
But here's the really powerful part. You wanna help us out in the community? You wanna help each other out? Give back. That's what we're all about here, like helping each other, adding new ideas, sharing ideas back and forth with each other. Go ahead and share this template into the community.
You can share right into this community, give it a good write up, a good description, right? And then you share it right into the community. Now, if you guys going to the community right now and you go to that post, you'll see this literally right now. If you wanna get notified of updates, just go up here and subscribe the notifications.
And what is super awesome about this, anytime that I update this version, bingo, you got a notification. And then, you can go in, and you can clone the newest version of the template. So inside of your templates, when you have a new version, just share the new version. If you are in here or if you are listening to this, you gotta act fast to do this, okay?
So you go to optionalpha.com/promo, and then you're gonna enter this code VIP INVITE, and that will get you. You can start a free trial right now. There's only like 50 or so of these invites left, so jump on it right now. If you're listening to this, later on, you gotta jump on it. If you're fast enough, you'll get in; you may not be.