- Create a new bot using the MACD indicator as the core signal.
- Scan for MACD signal crossovers to sell opposing credit 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 MACD crossovers.
- Use custom inputs to create flexible variable fields.
MACD Indicator Bot shared in the Community.
In the workshop today, we’re gonna be building out a brand new MACD indicator bot. We should go about an hour, just depending on questions and how many questions we get during the workshop together. So we’ll try to go at a pretty good pace, making sure that we don’t leave a lot of people behind, but at the same time, we’ve been at a pretty good pace here.
So the goal for us is to build out a new bot using the MACD indicator as the core signal and then scan for MACD crossover signals to sell opposing spreads. So the idea is that when you get a sell signal on MACD, you would sell a call spread. When you get a buy signal on MACD, you would sell a put spread, and you can go back and forth. And of course, you can make any kind of modification and changes to this if you want. We’ll post a copy of the template in the community, so you can grab and copy that inside of the community right after we’re done here today.
We’re gonna use some more decisions to prevent the bot from entering multiple positions at the same time in the same underlying ticker symbol. And then finally, we’re gonna use some monitor automations with a lot of different management decisions from multiple exit points.
The goal for me is to get a very simple bot template out there, and then you guys can come back in in the community, make your own modifications and your own versions of it and then post it right back to the same thread so that we can all share different versions or ways of doing it. Works out really well. I think everyone kinda likes this model.
So, all right, so here’s what we’re gonna do. We’re gonna go ahead and start creating this new bot. So creating a new bot, super, super easy. We’re gonna do it all from scratch here and just build it out together. We’ll kinda talk through it as we go, but we’ll call this one our MACD Indicator Bot. So again, we can create a custom icon. You can do whatever you want with it. You can give it a custom little logo, or icon, make it just really simple, you know, personal to you.
Next thing you have to do is choose the account. So this is where you’re gonna choose what account it’s actually linked to. You can start with your Option Alpha paper trading account, or if you want to, you can directly link it toward one of your brokerage accounts. So if you got a broker connected in here, you can connect it to one of your accounts or connect it to any of your sub-accounts as you’re going.
We’ll just leave it at our paper trading account for now. Next thing that we’re gonna set up here is our allocation. This is where we’re gonna tell the bot how much capital it has to allocate to open new positions. This is your fail-safe, your backstop; bot is never gonna go over this capital allocation amount for new positions.
So this is where you can say, look, I want the bot to trade and then only do up to 5,000 at most. Now, this is not the only place you can set some limits. You can do that when you actually enter a position as well, and you can set some limits on number of contracts, or how many shares you trade, or up to certain percentage of the bot its allocation. But this is kinda like that last final fail-stop at the end, okay?
Next thing that we’re gonna set here is our position limits. So position limits are super cool because they allow us to automatically turn off the scanners. We’ll send them into a dormant mode whenever the bot reaches these limits. Now again, there’s no limitation on closing positions. You can close position at any time. You can override positions at any time too. But this just tells the bot, look, you can enter one new position a day, or in total, you can do two new positions at any one time, right?
So we can just do, for our example, we’ll just do, say, three positions in total, but no more than two positions in one day. Okay? Any question on this so far, let me know. If this is all working out well, you guys are enjoying this; we’re good keens, let me know. I don’t know. I think you can do thumbs up in here or something. Okay?
So you go ahead and now create your bot, and then you can go over and view your bot. So inside of our view here, this is where we have our empty shell, and of course, all of the automations are turned off by default. So now what we’re gonna be doing is we’re gonna be going over and adding automations.
So, again, automations are where you tell the bot what to do, okay? You’re telling the bot what to do in the automations. And you can trigger your automations to run using scanners, monitors, or events. In this case, we’re gonna start off with a scanner. All a scanner does is just simply tell the bot to run through an automation, make decisions, and potentially open a new position.
So scanners are gonna be keying off those daily position limits that we set earlier where we’re telling the bot, look, you can open two positions per day. So once you get two positions, the scanner goes into a dormant mode and start sleeping until the next day, right? Where it has an opportunity to maybe grab some new positions.
So in here, we’re gonna add a new scanner, and we’re gonna create a brand new automation to run inside of this bot. We’ll call this one our MACD Indicator Scanner. You name it whatever you want, doesn’t matter. I usually name it something like scanner, or monitor, or a bot button, or whatever, so that when you save it into your library, then you know exactly what the automation is or what it’s using or what it’s intended to do. Okay?
Now in here, we’re gonna start with an action. The first action that we’re gonna add in here is we’re actually gonna add a symbol loop. So here’s what symbol loops do. Symbol loops do exactly what they sound like. You basically can type in a list of ticker symbols. And then what the bot would do is the bot would loop through those ticker symbols, and as it’s looping through those ticker symbols, it’s going to make all the same decisions for every single symbol. Does that make sense?
So now what we’re gonna do is we’re gonna put in a list of symbols that we want the bot to loop through. Maybe we want this bot to have the ability to trade these five ticker symbols, whatever they are, right? You just put in your ticker symbols here. Once you put in your ticker symbols, you can then select done and then save that to your automation.
So these are really easy way, and this is probably the most traditional way to start a scanner automation. Now what you can do is you can say, bot, you have the ability to loop through and check SPY, GLD, XOP, DIA, USO, etc., etc., okay?
Now we have to tell the bot, okay, when it’s looping through those, what decisions do we want it to make? Notice now we’ve already added our symbol loop. We don’t have the ability to then loop another set of symbols. We’ve already told it what symbols we’re gonna loop through. So now we’re gonna go ahead and have the bot start to make some decisions.
This is where you actually have to start really thinking out how you’re building your bots, and again, hopefully, this is part of this process and come into our workshop here, so we can talk about this together. But one thing that we want to do in our particular bot is we don’t want the bot to open new positions in the same symbol. Okay?
So we don’t want the bot to open new position in the same symbol. So what we can do is we can add a couple recipes to first check and make sure that the bot can open a position and that the bot doesn’t already have an existing position in that symbol. Because what we don’t want is we don’t want the bot to open a new position, then another new position right away. Maybe, in this case, you could do that if you want it to, but in this case, we don’t want to double up our stack positions on top of one another. Okay?
So the first thing that we can do here is we can go down to one of our bot recipes, and we can check and see if the bot already has a position with this exact symbol. Notice that we can check recipe like this like the bot already has a certain type of a position, or a certain position with a symbol, or a type of a position with an existing symbol. Right? So if you want to do it really granular, you can do it really hyper-focused here.
In our case, we just need to use this one here, which is that we’re gonna check and see if the bot has exactly zero positions with a symbol. I like to do it like this because I like to make sure that my bot gives me an affirmative yes. I have zero positions with whatever symbol and currently looping through.
Notice here inside of this symbol field; we can actually select the symbol. But if we actually choose the symbol like SPY here, then every time the bot gets to this decision, it always checks SPY. So what you can do instead of manually selecting it is you can connect this field to whatever symbol the bot is currently looping through.
Now we can do this using custom inputs and notice this little blue icon here represents our custom inputs. Custom inputs are just little connectors that you can place throughout your automations. And they allow you to then to use dynamic fields as you’re going. So instead of filling an SPY, I’m gonna connect this to whatever symbol is currently being looped through at the time.
So, it will independently check each individual symbol, and the bot will quickly, in less in a fraction of second, check and see do I have exactly 0 positions in SPY? Yes or no. Do I have exactly 0 positions in GLD? Yes or no. Exactly 0 in XOP? Yes or no. So once you’re good to go here, you simply hit save. Okay?
So that’s our first decision, and then we can save it and add it to our automation editor. So now what’s gonna happen is the bot’s gonna loop through each position or each symbol, and then independently, it’s gonna go ahead and look at each symbol and make a decision. Do I have exactly 0 positions in that symbol?
Now in our case, we’re only gonna now fill out the yes path because we only want potentially enter a position if the bot already doesn’t have a position in that thing. We don’t wanna double up on it. So we’re gonna leave the no path empty. If it’s got a position already, just let the automation for that particular symbol end.
Next, what we’re gonna do is now we’re gonna start to make some decisions to check and see some of the technical indicators. Again, there’s a lot of other decisions you can make in here. This is just an example on how you can do it. But we’re gonna go down to our indicator field, and we’re gonna select the new recipe that we added just a couple weeks back for MACD.
So this recipe is specifically curated for MACD because it’s got its own little quirks and little ways of setting it up, so it needs its own brand new recipe inside of our bots. So we’re gonna select this recipe, and again, rather than choosing the symbol manually, we’re gonna do what? We can connect the symbol to whatever symbol is currently being looped through in the bots.
Notice that we can use this custom input throughout the automation. So that we don’t have to go in and manually change everything 100,000 times. Just simply connect it to whatever symbol it’s looping through. Next, we’re gonna choose all the variables from MACD settings.
Now you can go in and choose and modify yours. We’ll just keep the very simple, standard, traditional settings for MACD for this bot example and workshop. But you can go in and modify the fast period, the slow period, the signal period and tell it what type of exponential or symbol moving average to use for those periods.
Next, we’re gonna choose the variable here for the MACD line being above or below either our signal or zero line. So for MACD, there’s two different ways you can use it. You can use MACD where the actual MACD line crosses above the signal line or crosses below the signal line or when the MACD line itself crosses above or below the zero line.
The zero line is where you typically see a lot of traders use like a MACD histogram. That’s really judging, kind of like in some cases [11:31 putting it upside up] the zero line. In our case, what we’re gonna do is we’re gonna use the signal line. We’re gonna use MACD crossing above or below the actual signal line. And when you do that, then we can actually check and see if we’re getting a buy or sell signal.
All right, so the first thing that we’re gonna do is we’re gonna set up all of our overbought signals from MACD. So, in this case, we’re gonna go ahead and use the symbol MACD line is currently below the signal line on an intraday basis. This would again represent that the MACD line is now been overbought and now starting to turn the other way.
And so, when the MACD line crosses below the signal line, that might represent a potential sell signal or overbought signal for the underlying security. So once we do that, we can now go and confirm all of the other fields, including that we’re gonna check this on an intraday which just uses the most recent data whenever the automation runs. And we’re gonna go ahead and save.
Now there’s one other thing that we could do here if we want to, to make sure that we’re actually checking for a true crossover. So if we leave this right now as it is, then what’s it’s gonna do is just gonna check and see if the MACD line is below the signal line. But that doesn’t necessarily mean when you start your bot that it actually is going to look for a crossover at that moment or today.
So if you start your bot and the MACD line has been below the signal line for ten days, it’ll still answer yes. And you might wanna start your bot that way where you just gonna start it with whatever the signal is at the current time, whether it’s a buy signal or sell signal. But if you want to use this as a crossover, what we can do is we can actually create a grouped decision.
So we can go down here, and we can go to the same recipe. We can set it up exactly the same. So, connecting our symbol. And now we can check and see if the MACD line is below the signal line, or sorry, not below. But was above the signal line, not on an intraday basis but one day ago. So in this particular case, with this recipe here, we’re also checking to make sure that the MACD line was above the signal line yesterday. And then, if we add this to our group here, now this gets us a true crossover.
So, in this case, we’re checking for both things to happen. We want the MACD line on an intraday basis to be below the signal line, but we are also checking through the use of and statements for the MACD line to be above it one day ago. This gets us the true, valid crossover which actually for SPY happened today. Yesterday was above; today was below.
So then your bot is literally looking for that actual crossover for the first run. So it really only happens for the first run cause if you start running it over and over again, it’s always gonna be the case where you get the crossover. So now we’re gonna go ahead and just save this to our actual automation.
So that gives us one-half of our signal for our scanner. So now what we’re gonna do is we’re gonna build out the other half. I like to do it this way. I like to build out all the signals; then, I kinda fill in the actual trades. So, in this case, that’s all of our signals that would be our overbought signals.
If we wanted to, we can go in here and edit this caption and change all of this and say something like, is the symbol overbought and turning lower? Or whatever. Whatever you want, put it here. You can edit your caption and make it a lot easier and just kinda clean up your automation if you want to.
Now, down the no path. So if that’s not true, then what do I wanna check? Then what I can do is I can add another set of decisions. This time I’m gonna check all the same stuff, just in reverse. So I’m gonna go down to my recipe list for MACD. I’m gonna select the MACD symbol. I’m gonna connect this to the symbol it’s looping through. Now I’m gonna check and see if the MACD line is above the signal line on an intraday basis.
So that’s the first way. Just use a very standard setup for this one. Then I’m gonna add another one to check and see if it was below the signal line one day ago. So I connect it here. Again, go over here to below the signal line and change intraday to just one day ago.
Now again, the difference here is that intraday uses today’s actual values for the last calculation. So it’s always using the most recent one, whereas one day ago is checking the value yesterday, right? One day ago, or two days ago, however you wanna use it. Once you’re good to go, you can just again add this here and then simply save it to your automation.
Now that we’re going through this, we’ve got basically both of our signals set up. And I won’t modify the custom input here for this one; I will just leave this one here, okay? Or the caption here for this one. Now what we want to do down these different paths. Well, if the symbol is overbought and turning lower, so we’re getting all of these sell signals essentially with our MACD indicator, then we might want to sell a call spread.
So what we’re gonna do here is we’re gonna go ahead and add an action to open a new position. We’re gonna tell the bot that we wanna open a new position, and we wanna sell a short call spread. Now again, we can choose the symbol, and we can always use the same symbol but doesn’t really help us if we want to do a whole portfolio of different trades. Instead, we’re gonna use this beautiful custom input here and connect it to that same symbol.
Does this make sense on custom input? If you’ve never seen custom inputs now, you’ll probably loving custom inputs because it makes it so much easier just to connect all the wires and loop everything together.
Now we have to fill out all of the information for our particular call spread. I’ll let you guys do that on your own version of this. We’re not gonna spend time doing this, but you can make all kinds of modifications to this. You can target at least certain days of expiration or expirations between a certain series or on or after a certain date.
Then you can do all kind of stuff where you can go ahead and choose exactly what strikes you wanna use. You wanna use the money strikes, you wanna use based on dollars, or standard deviation above or below, you can base your other strikes off of other strikes so that you can say my long strike is $20 below my put strike or whatever the case is. You can do all of that when you set up your actual strikes.
Same thing with amount of contracts. You go in here, and you can choose and tell the bot, look, you can do one contract at a time or up to certain dollars amount of risk. You can do 5% of the bot’s allocation, so it’s always on a floating basis that’s usually using the 5% risk and then round the down to the nearest contract. So you can do a lot of stuff in here and kinda really customize your actual order.
The last thing that you can do in here is you can also set up your custom smart pricing. So you can tell the bot exactly how you want it to start sending orders over to your broker. You can tell the bot, hey, look, use normal smart pricing. So try, if available, the spread’s wider try four prices. If the spread’s narrow, it may not try four prices because the spread’s pretty narrow, but it’ll try up to four prices, space out the orders ten seconds apart.
And then you can even set the final price. You can tell the bot, look, don’t go more than 50% of the bid/ask spread. So stop at 50%, try again at the next interval. This means that it will try all day for you trying to get into a position, hearing to your exact rules. Okay?
Do you guys use smart pricing? You’ll love it. I don’t know if you’ve watched this happen before, but if you haven’t done it yet with a live trade, when you get to the point of using smart pricing, it’s bananas. When you just watch it, fire orders back and forth, it’s crazy, and you’re gonna love it.
So once you’re good to go, you simply hit save, and then go ahead and add your open short call spread to your bot. So now, what the bots doing here? In this case, is it first check and see if it doesn’t already have a position in that symbol. Then it’s checking to see if the technical indicators are working for that, like giving you a sell signal an overbought signal for that particular symbol.
And if so, then it would go to the next step of trying to open a position. Now the beautiful thing about using the automation here is you can test this logic right inside of your bot. so we can run a test here and just kind of quickly test the logic that we’ve built out. So for SPY, which is just looping through the first symbol here, you can see it’s using SPY as the data.
Does the bot have exactly zero positions with that symbol? Well, yes. We just started it. The bot has no positions. Did the bot encounter the first decision block and get to a yes answer? So, in this case, you can see all the data that the bot is using. Here’s the MACD line, here’s the signal line. Here’s the MACD line one day ago, and it was above the signal line, which was at 3.13. All of that are here in the decision log. In the case of SPY, it would have resulted in a yes answer which would have sent it down to a yes path to open a new short call spread.
Now it didn’t actually open a short call spread, right? Cause it’s just a test. But it helps you stress test the logic that you’re building out in your bots. And I highly, highly encourage you to keep using testing inside of your bot as you go. Now we can go over to the next ticker symbol. We can check GLD. Notice with GLD; it resulted in no answers across the board. And that’s great. Yes, the bot has 0 positions, but no, it’s not overbought nor oversold. It’s not giving us an actual indicator signal to go ahead and enter positions. That’s great. Our just simply ended.
And this is really what you want out of your bots. You want your bots to do all the heavy lifting and checking, and then basically just go ahead and end the automation for that scheduled run and check it all over again. So you don’t have to do that. Then you can worry about, you know, focus your time on building bots and strategies and learning new techniques. Let the bot do all the checking and manual tedious processes for you.
All right, let’s keep going here. So now what we’re gonna do, we built out or short call spread, and now we’re gonna build out our short put spread. So we’re gonna use the same kinda mechanics here. We’re just gonna build out that open position action. We’re gonna go down to a short put spread this time because that’s what we wanna do if we’re getting a buy signal and the stock is oversold. And then we’re gonna go ahead and connect this to our symbol and fill out all of our fields and then go ahead and save, okay?
That was a little bit faster than what you would probably do because you would probably fill out all your different fields, but you get the idea of how you could put in that actual position. Now, in this case, I wanna do one other thing here which will help you out, but I’m sure when you’re trading, you don’t just normally enter new positions without checking things first.
What I’d like to do with mine is I like to actually build out the trade that I want to get into first. So that’s how I did inside of this demo. I built out a trade that I wanted to do first for the particular bot. Then what we can do is we can come back in and add opportunity filters.
So what opportunity filters do is they allow us to check information before we send the trade to our broker. So you might want to check open interest, or you might want to check a really easy one is bid/ask spread. So once you’ve already built out your actual trade that you want to send to the broker, it makes using opportunity filters a lot easier because the bots are smart enough to recognize the opportunity that you already are trying to get into.
We call it an opportunity filter because that’s exactly what it is. You haven’t made a trade yet; you’re kind of evaluating an opportunity. So what we’re gonna do is we’re gonna actually proceed this short call spread with another decision. Because it’s already built out, this will help us with our new opportunity filter.
We’re gonna have the bot make one decision before it gets to the point of sending the order over to our broker. And that new decision that we’re gonna make is we’re gonna check just a very simple bid/ask spread to make sure the bid/ask spread of whatever we’re trying to get into is tight enough that would really represent some liquidity.
Again, you can use open interest, you can use volume, you can check individual leg open interest, or volume, or the bid price or the whole thing together. You can check a ton of these if you want it to. This is just one way you could potentially do it. So here we’re gonna use this recipe, and we’re gonna first then select our new opportunity.
Now because we already had built out these two different trades, the bots are smart enough to recognize; hey, do you want to use one of the recent trading potentials that you’re about to get into? So you just say, yeah, I want to use the short call spread that I just built out. Confirm the details of the one you just built out, and then go ahead and save that as your new opportunity.
Now what this does is this tells the bot; look, look up this exact trade. That’s what you’re telling the bot to do. Look up this exact trade and check and see if the bid/ask spread is less than a certain amount. In this case, you can type in an amount like; I don’t know, 7 cents. What do you guys use as a filter? Ten cents? I mean, it probably depends on some of the variables, but yeah, like five, six cents, right? Whatever it is.
But it’s gonna make sure that the bid/ask spread at the time that it encounters this decision and runs the automation is less than that amount that you set. This is a really smart way to prevent the bot from entering positions of massive spread quantities, right? So you really don’t want to let the bot do a real massive spread amount.
So you can’t use percentage right now. You just use penny amounts. But soon, with formulas, you’ll be able to calculate a percentage if you wanted to and get some really crazy like percentage like calculations and put in there as well. So you can just use pennies for now, but formulas will help you do that.
So here's the thing though, in this case, I can put in seven cents, and I can use seven cents. But if I want to reuse this amount for, say, my short put spread or another automation. What I can also do is I can create a custom input for this field. So I can create my own custom input for this particular field and call it my bid ask spread threshold. Then I can put in a default number like seven cents, and I can save that as new custom input.
Now, this is really cool because when we do this for our short put spread, we can reuse the same field. That means we'll never have to change it once moving forward, right? So now that bid ask spread threshold can be used throughout my automation, and if I've got a bunch of different ways which I could have the bot check for positions or open things. Now I've got a custom input that later I can just change one time, and it changes and flows throughout the rest of your automation. That is like super cool.
Okay, so I'll just go ahead and add this one simple decision, and I'll have it precede down the yes path. So now, if we get a signal on MACD, now I first want the bot to make sure that the spread I'm about to send over to my broker has a spread width or a bid ask spread less than my threshold. So how cool is that? And if it doesn't, then it won't send the order. And then next time, if it does, then it will send the order, right? It will go down the yes path.
This is really good. You should do a lot of this stuff. You should add some volume filters; you should add some open interest filters if you want. The bid ask spread is kinda like the lowest hanging that you can possibly add because if it doesn't have a tight spread, probably doesn't have a lot of liquidity, or liquidity is low. But it helps prevent the bot from trying to force a position in a really widespread.
And even if the long leg is $2 above and the short strike is $5 above or whatever it is. It's still gonna check that same bid/ask spread for the whole opportunity. So even if it's different, it'll still dynamically enough check that new opportunity that it's looking at.
So we're gonna do the same thing here for our short put spread. It makes it really easy to do with the short put spread as well. We're gonna add a new decision proceeding the other one. We're gonna go down to our opportunity filter. We're gonna check and make sure that our bid/ask spread is less than a certain amount.
Notice we can reuse that short put spread we're about to get into. That's our recent opportunity. Confirm all the info, and now we're gonna go to our bid/ask spread amount. Now because we've created a custom input for this field, we don't have to type in a number. We can just connect this custom input to the one that we just created a couple seconds ago.
So now we can reuse that same custom input across multiple decisions inside of the bot. I go too fast on this or going at a good pace? So now, not only are we checking for the MACD signals, but we're also doing a very quick little liquidity check to make sure that the bid/ask spread is low enough for this potential opportunity before we send it over to our broker.
So once we're good to go here, we're gonna go ahead and just exit out of our MACD scanner automation. Notice when we exit out of our scanner setting screen, a new custom input showed up. Right? So if we want to modify this, we can say, hey, you want? We want to change this to five cents. We just change it to five cents.
We want to change it right here? Just change it right here. You say, ah, I want to change it back to seven cents. Now when we save this, every time the automation runs, it's gonna use that value for our bid/ask spread threshold. Once we're good to go, we just simply hit save, and now it gets added as our new scanner. Again you can go right back in here and double-check this. And then you can change this. You know what, I wanna go in here and change this to just five cents. So this is really easy because now you don't have to go open the automation editor to find all the places that you're using it. Nope. You just do it one time with your new custom input.
Okay, so our scanner automations built out. Now we're gonna go down to our monitors. Monitors are super awesome because what they allow us to do is monitor positions when they get opened. And the way that we set up Option Alpha, the way that everyone thinks like who it's set up right now, is that you have scanners that basically run to tell the bot it can open new positions.
But you might manage positions the same as other strategies, or you might manage positions differently. Right? So in our case, we're gonna use one monitor automation, and we're gonna split the monitor automation in half based on what type of position the bot has at the time. Okay?
So we can use one monitor automation. We could use two; one for our short put spreads and one for our short call spreads. We’re gonna actually do it with one monitor automations so you can see how it works in one full sweep, basically.
So the monitor automations will start running whenever the bot has a new position open. It means that they don’t run, or they stay in a sleep or dormant mode when the bot doesn’t have any new positions open. Now, in our case, we can reuse an existing automation that we have. We can create a copy of this one, so you don’t wanna build it from scratch. Create a copy and then just modify that one and create a new monitor automation.
But because this is a bot workshop and we love doing things from scratch, we’re gonna build out a brand-new monitor automation from scratch. We’ll call it our MACD monitor with spreads, okay? As always, when we start our automations, we have to start it with some actions. In this case, we’re gonna start it with now a position loop.
Position loops are almost identical to the symbol loop that we created in our scanner. Except this time, instead of looping through symbols looking for potential trades, we’re looping through actual positions. So we use a position loop to tell the bot, hey, pull in all the information on some positions so that we can start to make some decisions on how we want the position managed.
When you add a position loop, you can actually filter your position loop right away by certain types of positions. So you can say, hey, look, I only wanna manage in this particular automation; short call spreads. So basically, if you add it like this, you tell the bot, look, ignore all other position types. Only send short call spreads down my path, right? Like I’ll ignore and take care of the other ones myself with different automation, whatever the case is, but in this case, I only want short call spreads.
On our example, like I said, we’re gonna build it out so that we pull in all the information on every position, and we can divide it out later if we wanted to inside the automation. Again, it’s only pulling in position information. So if you don’t have a position, then it’s not gonna be pulling in information. Bu the second that the bot has a brand-new open position, it’s gonna start pulling that information into the bot.
Now we’re gonna add a decision. What do we want to do with these positions that come in? In this case, what we’re gonna do is we’re gonna first check and see what the position is. Again, this is just one way that you could potentially do it. You don’t have to do it this way. You could do it a number of different ways. There’s a bunch of different ways that you can do it, but we’re gonna use a recipe to check and see what type of position we’re currently looking at.
So, in this case, we’re gonna use this recipe, and we’re gonna check to see if the position type is a certain type of option strategy. This way, we can now start to send different types of strategies down different management paths. Maybe we wanna take 50% profit on the short put spread but 25% profit on the short call spreads. Okay?
So we’re gonna select the position. Now, of course, we can just use the custom inputs like we do all over the place and connect it to whatever position the bot is currently looping through. So if the bot has ten positions, it’s gonna check each position one by one. Is this position this type? Is this position this type? Is that position another type? One by one as we go.
Next, it’s gonna go and check and see if the position type is or isn’t a certain type. We’re gonna just use is, which makes it really easy. And we’re gonna choose short call spread. So we choose our position type here, and then we just simply save. So now we’ve added our first decision. First, check and see is this a short call spread. Yes, send it down the path, right? Send that short call spread down the yes path then we can manage it differently.
If it’s not a short call spread, let’s go ahead and add another decision to see if the potential position is a short put spread. So we go down here to the same recipe, we’ll connect it to our position and say, is this position a short put spread? And then we’ll go ahead and save it to our automation. So we now get basically like the first shell set up. Again, you don’t have to do it this way. You can set up two different monitor automations. One for call spreads, one for put spreads. This is just another way you could do it, fun way to do it on the workshop. Okay?
Now for short call spread positions, if they are short call spreads, they’ll go down this yes path. If they short put spread, they’ll go down this path. This is where you start building out all of your management decisions for this particular bot. So what might be something that you want to do with your brand new position when you look to manage it?
Well, you might want to check and see if the position has reached a certain profit target, right? So for short call spread, maybe that profit target is 25%, right? Maybe whatever it is for you, you can put it in here. So we’re gonna use this position recipe which, of course, if it’s a position recipe, it needs to be under a position loop because it’s pulling in data on a position.
We’re gonna check and see if whatever position it’s currently looping through, so connect it to those inputs, has decreased by 25%. Now, remember, we say decrease because, in this case, for our potential trading strategy, we’re selling short premium. So when the value goes down by 25%, that represents a profit.
So we’re gonna tell the bot, look, constantly check and see if the position decrease in value by 25%. If that text is confusing to you because you can use it both ways, you can say, do I have a 25% profit? You can go ahead and save your new caption. So if we do have a 25% profit, and it’s gonna check all the time as the position’s open, what do we wanna do?
If the answer to that question is yes, well, we wanna tell the bot close the position. You connect it to whatever position it’s currently looping through, and then you go ahead and tell it exactly how you wanna submit the orders to your broker. Once you’re good to go, you just simply hit save.
Now you’ve told it one way in which it could close your short call spread position. So do I have a 25% profit? Yes, go ahead close the position. If I don’t have a 25% profit, what else might I want to check? Maybe I’m close to expiration. Maybe I’m getting challenged, right? Tens a time.
Let’s add another decision. If I don’t have a 25% profit and the answer to that question is no, let’s go down to the position recipe for the position expires in a certain number of days. So, in this case, I connect it to the positions still looping through using custom inputs. And I say does the position expire in less than two market days? Whatever you wanna use here, it’s up to you, right? But once you’re good to go, you simply hit save and then add your new decision to your branch.
So with short call spreads, it’s first gonna check and see do I have a 25% profit? Yes, close it. Does the position expire in two days? Yes, do the same thing, close the position. Simply connect it to the positions looping through and hit save.
So this is what’s really cool, and I think about bots, but I’m biased, totally. I’m bot biased, but I think it’s so cool that we can tell the bot under all different scenarios when we want to close the position. We tell the bot, look, you can close it here, or you have approval to close it here, or you have approval to close it here, here, here, and here. You can build out as many this different yes no, yes no paths as you want to in your particular automation.
Now let’s fill out the position type being a short put spread. Same thing is gonna happen here. We’re gonna go ahead and add some decisions. And let’s add some new decisions for checking the profit for this one. So we’re gonna add a new one here for do I have a profit on this one and we’ll say that the premium decreased for short put spread which will again be a profit of 50- excuse me, let’s do something a little bit higher like 75%.
Doesn’t matter; you can make it whatever you want, use your own modified version, okay? So now do I have a 75% profit? Then you can edit this one, and you can say I want to check and see do I have a 75% profit? Modify your actual caption. So if I do have a 75% profit, again, which is different than how I’m gonna manage my short call spreads. Maybe I’m a little bit more wary about short call spreads. Maybe for my short put spreads, I’m willing to let it ride a little bit longer, right? Whatever it is for you, doesn’t matter—just an example. But if I have a 75% profit, I want to go ahead and close the position.
So I connect it to the existing position here and then add that closed position action. So it’ll start sending those orders and start tyring to close that position. Make sense? What if I don’t have a 75% profit? Well, this is where you can start doing some other cool things like using a smart stop.
Smart stops are our own proprietary way to use a more intelligent, we think, way to use smart stops or to use a stop order with a hurdle, okay? Does that make sense? To use a stop order with a hurdle. So smart stops are this recipe here, where we can start trailing a position once it reaches a hurdle or target. So the way that we build out smart stops, which is one of the most requested features when we were in beta, was that you have to set a target.
So maybe you first want to make sure that the position reaches a 50% profit. And then after a 50% profit, you’re willing to trail that 50% profit, by say 10%. That you want to get precision two of 50% profit first, then when it reaches a 50% profit, try to intelligently trail it up to, in this case, it will trail it up to it reaches that 75% profit because we’re gonna also check for that as well.
But it gives you the ability to now let the bot do a little bit of dynamic playing around with the position where it doesn't exactly close it, but it's still monitoring the highs and lows of the position. That's why we call it smart stops because this is smart way to use stop orders. Instead of just using a traditional stop where you say always trail by 10%. No, no, no, let's use a target stand which is more intelligent. Use a target and trail it only once it reaches that target.
Now, if it reaches that target and starts to trail it and backs off of that price by 10%, then go ahead and close the position. So same thing, we're telling it here's another way you can close the position. If the answer to that one is still no, we can do the same thing and starts checking to see if the position expires in a certain number of days.
In this case, we can go down to our position recipe for expiring in a certain number of days. And instead checking for less than two market days, maybe because we, I don't know, trade differently with short put spreads, we're gonna trade and take the position off if it expires in less than three days. So again, you can do a little bit dynamic. With our call spreads, we did two days, but our short put spreads maybe we do three days. Just try to give you guys as many possible examples as I can.
So with our short put spread, let me just zoom out a little bit here on this. With our short put spread, we have three different ways in which the position could be closed. This is different than our short call spread which only had two different ways. I say only, but these are still intelligent ways that most people usually manage their positions anyway. With our short put spread, if we have a 75% profit, which kinda like our highest watermark, take it. Like 75 or higher, take the position off. Don't mess with that anymore, doesn't matter.
If we don't have a 75% profit, did we hit a 50% profit? And then trail that 50% profit by 10%. Basically, like did we have a profit, and we've backed off enough that we wanna take the position off. Okay, great, take the position off. Go ahead, yes, close it. Or, if none of these are true, does the position expire in less than three days. And if it does, regardless of profit, loss, whatever, doesn't matter. Just take position off. Go ahead, bot; it's nearing expiration. You wanna go ahead and close the position.
You can even get more granular than this and do one other thing here. So because we have a little bit time here, I'm gonna show you how to do this. So instead of just checking does, it expire in three days, what might you also want to check if you were trading manually? Well, you might want to check and see if the positions even in the money at all. Because if the position's out of the money, and maybe hasn't had its profit target yet, but it's not really being challenged. Maybe you don't want to close the position.
So you can have another check here. You can say, okay, I wanna go ahead and make another decision inside of this group. Now I want to check and see if the position's actually getting challenged. So I wanna make sure I'm inside three days, and I wanna see if the position underlying price is trading below my short put strike. So I'm gonna use this decision recipe to check the position, check its underlying price, and see if that underlying price is below my short put strike.
Now, if it is below my short put strike, then that means that I'm being challenged on the position. So now I only wanna take the position off if both of these statements are true. One that it expires in less than three days. Two that the position is also being challenged and the underlying price is below my short put strike.
So I can add both of these in here, and now I only close the position if I'm challenged, and it's inside three days. Otherwise, the position can just keep going down the no path and expire worthless. Collect this much premium as profit as I want to, and again, you're gonna probably take things off when you start to get towards 75%.
Please, when you guys get a copy of this in the community because we're gonna post it here in a second. You get a copy of this, create your own modified version of this and share it back into the comments. There's a lot of different things that you can do here. So one thing that you could do is instead of checking, and I'm just gonna give you some ideas. It's not homework, but if you wanna do this homework, you can. Right?
Here's an idea. Instead of checking right away for a potential profit, check and see if you're actually close to expiration. If you're not close to expiration, you could make a whole different set of decisions based on how far you are from expiration or not first. So you might set up a version of this that says, look, if I'm three days from expiration and I have a 10% profit, take it. If I'm not three days from expiration, and I'm 20 days from expiration, then I wanna check for a 50% profit. And if I'm not 20 days from expiration, I'm more than 20 days from expiration, then check for a 75% profit.
So now you can subdivide this and say, I wanna check for different profits based on how close I am to expiration. You can also do things like checking to see how close you are to actually being like deep, deep, deep in the money. So is my position just lightly touching underneath of my short put strike, or am I $4 underneath of the position?
So you can do a lot of different things even inside of this one simple management automation. Whenever you’re good to go, and you’ve made all of your criteria. Just simply close out of this and go ahead and save this to your monitor list.
So now our bot truly is fully built out. We have our scanner automation in place that’s going through and looping through those potentials symbols, looking for a potential trade. And then we have our monitor automation that is gonna be managing and monitoring this position. Let’s go ahead, and we can just turn on the automation and let the bot starts running.
Now, the bot will run at the next interval and start looking for positions if it’s got capital and has the availability to enter new positions, right? We can actually force a position in here if we want to; we can run an automation instantly and say I wanna go ahead and run our MACD indicator scanner. Go ahead and just run that automation right now. We can go over to log and see what the automation determine.
In this case, when it ran, it was checking SPY. Right? Which we know we don’t have any symbols. We know that it has a right signal, but guess what? In this case, the bot prevented it from entering a position because the bid ask spread was too wide. This is awesome. This is exactly what you want out of a bot.
You want the bot to make this decision for you because if you forget, or you don’t check, or you come in too late, you want the bot to checking these things for you. In this case, it got the right buy signal or sell signal for MACD, but it stops it from sending the order cause the spread was too wide, right?
Now, we can modify this if we want to. And again, not telling you to do this all the time, but just to get this one in here, we can say, okay, fine, go ahead. Enter even if the spread is $1 wide, right? Okay, this is not what you want to do, but notice that now it’s starting to open a position because we said, okay, go ahead open the position.
So it started to send the orders and starting to fill the trade and use smart pricing to submit orders back and forth to your broker, right? Canceling one order, working on another order. You can just refresh here, and you can see it’s still working on that order, tyring to make it as realistic as possible for fill prices.
We built in a lot of logic, by the way, with our fills on paper trading to make it a lot more logical and realistic. In some cases, you may not get a fill on something if you’re trading an unrealistic price vs. some brokers which just fill the trade regardless on paper trading—trying to make it as realistic as possible for you. Okay?
So it’s just gonna be here working, trying to fill the position. It doesn’t fill; it’ll try again in the next interval; keep trying. The fill timeout are about five minutes. So, it will keep trying till it tries to fill that position. Notice again it’s just working at that level, maybe the spreads are a little bit too wide for this particular position, and it may not fill the position.
But now your bot’s on and starting to work. Starting to work through new positions, right? You got your whole set of automations up, and you can start running your different test and start paper trading this moving forward.
Okay, so here’s what we’re gonna do. Whenever you want to, you can save a bot as a template. And what a template does is it just memorializes that bot’s settings. You can think about this like storing the bot in a library because that’s where it goes. It goes into your actual library. So we’re gonna save this one as a template, and we can name it whatever we want. Everyone can name it, totally up to you. Set your position limits for your base template, then go ahead and simply save.
Once you save it, it’s now in your library. This is a memorialize template that you can use to spend up a new bot. The beautiful thing about template is there’s no limit on templates. Go crazy with templates. Save a bunch of things as templates. That way, you can spend up a new version or new bot anytime you want.
Whenever you want to spend up a new bot, just simply clone this one make any changes you want to it. That’s a new version, but your template stays the same, okay? Then what you can do is you can use this template and share it into the community. Like I’m going to do right now into the community. So if you’re into the community right now, you’re about to get this bot template.
Give it a nice description, something maybe a little bit longer than this one that kind of tells you exactly what the bot is doing and kinda helps people along. If you have any research associated with that or if it’s based on strategy, just kinda give people a heads up on like what it is. But this template now shares the template into the community for other people to use.
It doesn’t share your bot stats or your personal information; that’s all still not ever shared into the community. Just truly shares the actual raw strategy. And then people can create their own version of it, like you guys can do right now when I share this. Once I share this and go make your automations to it. Okay? So I’m gonna go ahead and create this post. And now, share it right into the community.
So if you go into the community right now, the top of the template section, under recent, you’ll see this brand-new bot being shared. So you can come in here, create a clone of this bot, and now you can take the actual bot that we built out today. Create your own version of it, and then like I said, please come right back in here to this exact template screen where you got the template, and add your own version right back here.
So if you create your own cool version of it that uses a different set of indicators or different set of filters, or maybe you manage the position completely different. Go ahead and add that back in here so that we all have the ability to use different versions and get different ideas. This is the whole idea around crowdsourcing intelligence and being able to share these strategies back and forth. And it really works best when you guys help each other out, which I know you will. I know lot of people here right now are super helpful in the community, always answering questions, always sharing different ideas, but hopefully, that was helpful.
So if you guys enjoy this today, please let other people know about what we’re doing here at Option Alpha. Invite your friends and your family, get some other people involved here in bot trading. Be on the lookout for the next workshop; we’ll post it up here soon so you guys can register for that one. And we’ll talk to you guys soon. Until next time, happy trading. Take care.