Scripting Studies on thinkorswim | Ken Rose, CMT | 10-1-19
Well. Investors, and welcome to our webcasts, here today on using, think scripting, so last week we talked about strategies, this week we're going to use those strategies looking. At some of the Fang stocks Netflix. Amazon Apple. Looking, on those Fang stocks so we'll get underway here. So. Again investors welcome here to our webcast, my, name is Kendra is always great to be here to discuss investing, in the stock market, particularly we can use think, scripting, as a back testing, tool we'll be using looking, at applying that with some, of the things stocks here today just, a reminder if you'd like to you could follow me on twitter at, kr. OSE underscore. TD a. Well. That's C here we're gonna get started here have a little bit of a technical, issue going, on here but we'll have that wrestled. Right here there we go okay great, so, again twitter. At ken rose underscore, TD a we just need to run through a few disclosures, before we getting away here and in wave disclosers just. A reminder that in order to demonstrate the functionality of the platform, we need to use actual symbols, however, TD. Ameritrade, does not make recommendations. Or determine the suitability of any security strategy. Or course of action for you through, your use of our trading tools an investment, decision you make in your self-directed account is solely your responsibility. Also. Keep in mind in here we don't really track transaction. Cost and transaction, costs aren't important factors that should be considered when, evaluating. Any trade, and/or strategy, for that matter as well the. Paper money software application, here that we use is for educational, purposes only successful. Virtual trading, during, one time period is not guarantee, successful. Investing. Of actual funds during a later time period as market. Conditions do change continuously, we. Will talk about vac testing day and just reminder that back testing, is the evaluation particular, trading strategy, using historical, data results. Presented are hypothetical, they, did not actually occur and they may not take into consideration all transaction, fees or taxes, that, would actually, occur. Here's. A picture myself in here - pretty close to 15 years it's, been it's been nice a great place to work so we in here typically what we do is we with regards think scripting we identify, a goal we did that in a previous session we to ask ourselves can think scripting meet the goal we address that basically, what we did in previous session, is we, wanted to put together a think script that, would run a moving, average of on balance, volume. We put that together and. We ask ourselves is this something that could possibly use as part of a strategy so. We introduced. The concepts, of strategy, in our last session, so. If you if you feel comfortable the concepts of strategies, that's great if not feel free to continue to join us here today I do try to craft things so that we won't lose your anything strategy, is simple is just simply a back testing.
Process. That thinkorswim has available to investors. That are currently using their, website, and, right, now we're doing is we're applying the think script tools and that's what we're looking at today is primarily applying these tools these back testing tools as it relates to. The. Fame stocks okay, it's right here so just just in way of review. What. We have here is we have a custom, study that we wrote using things scrip, don't. Worry you don't, need to know things script in order to in order to use a study like this in fact what I'll do is I'll provide a link towards. The end of our session so if you'd like to you can go ahead and pull this up I'm, not recommending its, use I'm just saying that it will be available to if you like to use it basically, what it does is it, just takes the regular, standard on balance, volume the, on balance volume is this black line right here of course you can you can choose whatever whatever color you'd like to for these it, takes that on balance volume line, which tend to be which tends to be somewhat jagged by nature and it, creates a moving average of that line and, then it allows you to set, the time frame for your moving averages, so we have here, is we, have this custom study of on balance volume and we have it sets we have the on balance volume line then, we have a ten period. Moving average of on balance volume then, we have a 20-period, moving average, of on balance volume then. In addition to that we took this on balance volume and, we used it as part of a strategy and, the. Strategy that, we used to forward was it was fairly, simple to start off with we, just said that when, the when, the shorter, to movie moving average of on balance volume crosses. Above the longer term moving average that's, an entry see right here we have a little by right here on the, other hand when the shorter term moving average drops, down below the longer term moving average that's a sale sometimes. The line will vastly will go up and down that's why we have a quick, I hear in a quick cell here you. Got by cells and so this is this is the strategy now, notice. Down here that, we have what's what's calling up it's, called our profit, and loss here, and, on strategies, what's the nice thing about it is they think or swim platform has, this tool so that when, you are running back testing. You. Can you. Can you can get a rough approximation, of the. Profitability, of the strategy, that you did you're currently using so. This is a rough approximation why, do I say it's a rough approximation, because. The way that the way that the back testing, works in its current form and you know there are there are there are updates that come along but they come along the way but way, it currently works is you, set an amount of an investment. That. You take when you when you enter the stock and the, amount that said for this strategy is this $10,000. So, each time there's a buy here. $10,000, worth of the stock is purchased in other words you take 10,000, divided by the price per share and that's rounded, to, a number of shares and that's why I like like right here we bought 45, shares right here we bought 65, so here's 52 49, 47 but. Each time there's that there's a buy of $10,000. That's why I'm saying it's rough approximation, because in, reality, you may you, may buy, it down. Here, and then your $10,000. Will grow to a greater amount up here and. But. Rather than invest your new greater amount we're just going back to $10,000. So it tends to be when. You're when you're in an uptrending stock and things are showing profitability, it tends to understate, the profits, a little bit on, the other hand if you have an unprofitable, situation. If it has a tendency to possibly, understate. The downside, somewhat, as well so, we just want to keep that in mind so, looking at our first example here, with Apple. Notice. Again we're talking about basically setting aside ten thousand dollars to move in and out of Apple at equal, period, at, an equal amount and right, here in our profit our floating P&L, we, have a profit, here of two thousand, fifty, three dollars and seventy two cents this, is a one-year chart, okay. So. If we're gonna do a rough approximation what. They we say okay we're just invest, we set aside ten thousand dollars to move in and out of this stock with that, $10,000. Created, two thousand fifty-three, dollars over, over a one year period of time we, can divide that by our ten thousand dollars. That. Gives it that gives us a 20% return. Again. Hey theoretical.
Return A forecasted. Return and again it's not taking into consideration taxes. Transaction, cost in life well. What if we just bought, and held Apple, what, if we just bought it a year ago and held it where, would we be on Apple right now well, would would actually be down by 1.1 seven percent. So. For this one year period with. This particular strategy. This, appears, to offer, some. Possible opportunities. Right here okay. However. We do want it we do want to cover a couple of concepts, here by, the way let me just back up with regards those concepts, and our agenda here today with, regards to our agenda right now we're we're. Running the on balance, volume cross, strategy, in, addition. To this being part of our Jena our agenda we're, assessing levels, of profitability, we're, going to look at different time frames we're, going to look at different stocks the stocks we're going to be looking at or the Fang stocks but, we also want to discuss data. Mining, versus, refinement. Okay. So. In, in. Looking at this and we can see what's going on but we also want to look at different time frames, and we also want to look at different stocks look. At that in relationship, to data mining and refinement, so this is Apple do we see the same thing if we come over here and look at Google, I'm. Gonna click on Google right here in Google we. Got we got two hundred and ninety four dollars and 59 cents that's a very small. Percentage. Return, on our ten thousand dollars let's. Just round that to, 294. 294. Right here we'll divide that by our ten thousand. We. Got it we got two point nine percent return. Now. If we just purchased Google, a year ago what. It would have a point, eight two percent a little bit less than than a one percent return. So. But. But look, at some of this gut-wrenching here, you know there were times where we encouraged some loss another thing to look at on your on your floating P&L, right here is is. To look at look at look at look at look at your drawdown, the type of drawdown, that you're experiencing, and here we have a drawdown down to here which, takes us down to a loss of about a thousand, dollars that's about ten percent right, off the bat we come down here we're about a thousand, dollars that's about ten percent and, so. On and so forth okay. So. About, break, even if we're looking at Google if we come over here look at Amazon Amazon. Just, is not profitable, here Amazon, we, lost six hundred eight dollars. So. If we got six hundred and eight right here we divide that by ten thousand. We've. Got about a six percent loss if we bought and held Amazon for the last year would actually have a thirteen percent loss so a little bit better than that that's a loss nonetheless. Face, book look. At face book looks, like face book looks, a little bit healthier here face, book running. This strategy, real simple strategy, right we. Got we got twenty four hundred that's about a twenty four percent return on the ten thousand dollar that we set aside if, we, just would have bought in hell face but we would have bought it here, and held it would have a return of about of about eight point two three percent, so. In this situation again outside of transaction, cost it looks like this very, simple strategy related, to on balance volume could be something that could be beneficial. It'll. Come down here a last one here will be Netflix looking at Netflix right here boy this doesn't look pretty does it, ouch. So. If we bought and held Netflix, right here, we'd. Be looking at a twenty nine percent loss, if we ran our strategy, right here we're, looking at approximately of, forty eight percent loss. But. It could be more than that remember I said at the outset if, things are going nice it's probably gonna understate, the profitability, if things, are going down because it maintains that ten thousand dollar investment it, may understate. The loss okay, in any case it, doesn't look like this strategy performed. Very well here for Netflix, does it, so. This, is where we get into the concept, of data, mining, versus refinement. Now. I can take Netflix, right here and I can make some adjustments. I can make some adjustments with regards, to our on balance volume indicator, I could look to see where the entries. And the exits are and, looking. At those like I can make some adjustments so I could actually make. This a profitable. Situation it. Looks looks kind of hard right but given, time I could go in and I could definitely accomplish, that I just I just know that from experience, but. If I make it so that its profitable for, Netflix. Guess. What's gonna happen, to Facebook. Over. Here and guess what's going to happen to Apple over here, these.
Are Likely to become unprofitable. Or. At least not as wildly. Profitable as, they're currently at, so. That's that's, that's what we're talking about when we're talking about data mining we're. Talking about going in and making changes. To make that to make the to make it so that the data you have so it fits around your strategy, so that you have a profitable strategy, that's. Why it's important, to do two things, one, look at different time frames right now we're just looking at a one-year daily, chart look at different time frames and also, look at different stocks that's why we have different stocks over here and then. Try to find a balance. You. Know we may not be able to find ten things so that we're a successful, on Facebook, here okay. With all these but, maybe we give a little bit off of Facebook, and Apple in order to in order to maybe break even, on. A situation like Netflix, where we came down we move sideways look, at this sideways movement, it's just it's just tearing or something when we started moving to do a downtrend, if it bangs us up down here maybe, we can do some things to balance things a little bit now, one possibility, would, be, maybe. Put, something in there related to trend. So. I'm going to come up here where you have our studies and don't worry too much about the complexity, of this when you see this again, you, don't need to know how to do things scripting, in order to get some benefit from our webcast here today I share. The links openly when you have the links you don't need to do the script you can go ahead and use these things however if you want to use things scripting, we also do spend a little bit of time looking, under the hood and going into that going into the code let's, just make a little adjustment here though, I'm. Gonna come. In here and let's see we got here. I got. These moving averages here I'm actually going to make an adjustment to, the code I'm gonna, come, in here I'm going to make one adjustment so, that we're not only looking at changes, and on balance fine but we're gonna be looking at a. Trend, in a relationship, to two moving averages. Again. Don't worry too much about this part this should not take too long I'm just gonna see. What we got here, balanced. Crossovers. Let's. See what we want to do here folks so I've. Got a a. Trend. Moving, average right here so then I have an SMA, trend right here let's, just say that our SMA, trend. This. 30-day moving average, it needs to be moving to the upside I'm gonna make it a well, we'll, go ahead and leave it at 30 days max, I'm gonna I'm gonna tone it down just a touch I'm. Gonna make it. Let's. Try 20 days. And. I'm gonna add a condition here. This. Is what I want here this SMA. Trend, right here. Again. Don't worry too much about this stuff okay. We're. Just looking under the hood here for just a second, and, we. Should be done with this momentarily. This. For entry, I'm just gonna say and. SMA. Tree now that yes I did what this could be this is going to be the 30 period moving average we. Want the 30 period moving average to, be greater than. The. 30 period moving average from, one period ago and in, scripting, some, of you probably aware this you when, you when you have a variable and you follow it with with the number one in brackets, that's saying one period ago so it's going to be one caligo though so this is in essence is saying that we also want the the 20-period. Moving average to change here to 20 it'd be a little bit more responsive we one the 20-period, moving average to, be moving to the upside now.
Sometimes, In here we do have some little glitches, here because we have an apple operating system and it's kind of taxed a little bit I'm, going to click on apply here well no pretty quick whether or not we're able to do this, for. Today, and. It looks like we may be okay. Let's. Pull this down yeah that looks a little bit better we'll say apply here, and I'll say okay so, you can see already that we we cut off some things but we still took a loss here didn't we we, bought it then we sold it here. Okay. Oh you know what we took this gap to the downside, before we sold it so this this, gap on Netflix hurt us and it gave us a 1000. Loss here, so, now we're at a 10%. Loss versus, a 30%. Loss but. What kind of an impact did that make make us on some of the other situations, here is are we still profitable, on net on it on Facebook, yeah. We still have some profitability on Facebook notice, that notice that we're not doing as much trading. When we need that moving average line to be moving up so we're at a 15% gain versus we're looking at earlier which was I believe about a twenty four percent gain, become. A purely Amazon. Amazon's. Profitable. Here in Amazon I don't, believe Amazon. I don't believe Amazon was profitable before I think it had a little bit of a loss but not as much as 13%. Google. Here boy Google. Here probably. Need to maybe look at something, else in order to catch goober here but look at all the volatility, on Google big gaps here around earnings announcement, some. Investors would just look at the chart and say you know what these. Are earnings announcements, can be killers they can help you big-time but they can kill you big-time and, our. Charts not really responding him to him too much they may opt just not just to maybe, get off the table during or during earnings with regards to Google how about, Apple, how's Apple dude so, again, a lot less training here with Apple notice that we don't catch a buy down here, that's. Because the crossover. Bond balance volume occurred. Before. The moving average line moved out so. We can come in here maybe do a little data mining say maybe I want to shorten that moving average line up to a 10, instead of a 20, to, catch this, but, then see how it affects these other ones over here, let's. Just do that real quick then I want to send out these links so that you guys can use them let's. See we let it studies here, we'll make one final, adjustment here, on on balance volume I'm. Going to come in here where we have that at 20. Let's. Move that to now what I'm showing you here is an example of data mining this is what you shouldn't, do without. Comparing. It to everything, else we're. Gonna try to catch that entry, on Apple but we don't want to do it at the cost of everything else being being fairly poor, click. On apply there oh that. Is not healthy is it, that. Was not good, trend. Right. Here, and yeah that did not help us out here with regards to Apple. Yeah. Let's. That's. A little bit better so I changed it to five, now. That is that's right, now we're looking at data mining, and as purists, in its purest form we, shorten that up to get this by but, what does that do to Netflix over here. Well. Netflix, actually. Netflix. Is about the same it's about two hundred eighty-six dollar loss so it didn't burn us too much on Netflix. How, about Facebook. Facebook. Less trading, profitability, did kind of dig it up a little bit Amazon. Actually. Helped out Amazon, quite a bit denden now. We've got about an 8% on, Amazon, Google. Well. Yeah Google it burned up a little bit so basically when you're doing this you end up balancing, things, one. Thing you don't want to do is just fine-tune something for one stock without taking into consideration others, other stocks these, stocks do have a tendency to move somewhat together, another, thing you do is maybe get some stocks from from from different industry, groups okay, so, investors I do want to share these things with you here then keep, in mind that will continue to fine-tune, these things I want to have one additional session, in this area.
Then. Then, then, we'll call it good with regards to strategies, but I just want to come up here and let's get our on balance volume here, I'm just gonna, click. On this, so. That we have that link to share. And. We, should have that let me cancel this cancel, this. And. It's. One of. Bring. This up here there, we go here I'm going to make this big enough, so. That. You. Can see it to take a screenshot now begin folks I'm not recommending its use I'm just tossing it out here so you can practice with it become familiar with these things so. This, is the link for. This. Strategy, down here, okay. I also want to give you the link for our up for our on balance, volume here, so let me come in here and, come. In here and here's, our on balance volume down, here. We. Have an on balance volume strategy. Yeah. And we have an on balance volume study. So. We want to share that yep let's say share it, will. Do this will cancel this. Will. Cancel this yeah, and. We'll. Bring this up here, we go. And. Our properties, will, make this nice and big. Alright. Everybody so. This. Is the strategy again. It's. In a rough form okay but you can use it you can play with it you can go in if you can go in and and and, monkey around but feel free to do anything you want to with it this is the study this. Basically allows you to bring up on balance while I'm with two moving averages and you can set the time frame on the moving averages okay you can go ahead and take a screenshot of those if you like so, what do we talked about today well we talked about strategies. Right if. You felt a little bit lost here today you. It's, probably a little bit because of you're familiar with the TOS platform I'd, encourage you to attend our Monday's. TOS. Platform demo. That's at 5:30 p.m. with Connie Hill also, following. Our little session here today you have investing, in value stocks with Michael fair Barnes just a little bit of a heads. Up in relationship, to that already. Folks well let's go and wrap it up here today we are somewhat, limited on time on our sessions here so I do want to check over there in the question. Area, to. See what we got here. Can we see the indexes, you, know because. The challenge, you have with regards to index is is they don't have volume, on them so, if you want to run an index what you can do is you, can use something that is represent. A tree that is a representation, of, an index that also has volume, so. Kind. Of think about that a little bit I'd, actually like to just say the word, but. Yeah. There's there's that there's just there there's just let me let me just put let me just put like that if if I say the word that we need to have a whole new set of disclosures. Which which causes problems oh and I like this session to be to.
Be Archived. As soon as possible just think about that think, about something, that represents, an index that has volume attached to it and you can use those as less long as have some blame attached to it already. So. Sokol, I sent. You the link there you just use that link as, far as using that link let me just come back over here you got the link just come up here click on setup click. On open shared item paste the link in here click on preview, click, on open you have a little place to rename it after you rename it it'll, be available to you as a study, okay, and as, a strategy, notice. When you come in here you choose edit status, rat and it's out of studies there's a separate tab here for studies and strategies, so. If you have the strategy, you'll need to come in here under strategies, in order to find that that is a great question. Alrighty. Everybody. Okay. Well let's go ahead and wrap things up here then. Yeah. And just reminder, folks in order demonstrate the functionality platform. We need use access symbols however TD Ameritrade does not make recommendations, already term the suitability of any security strategy, or course of action for you through, use of our trading tools any investment, decision you make in your shop track account is solely. Your responsibility also. If, you like to follow me on twitter i'm at k ro s c-- underscore. TDA I'd love to see you there also invite your friends to come to our sessions here again I, they. Are their, main so that you don't have to do coding in order to get benefit out or if you do do to do coding we do occasionally look under that everybody, best of success you're vesting I hope you have a fantastic, rest, of your week and, good. Luck again and we'll catch you later bye everybody we'll see you thanks again.