Thinkorswim Custom Scan Stochastic MACD

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi my name is Pete Hahn and thank you for watching this tutorial video be sure to visit w-w-w to-day i'm going to show you how to take an idea about an indicator let's say you have one of your favorite indicators and you like what happens to the price action when your indicator crosses or does something above the zero line whatever what I'm going to do is I'm going to show you how to take that idea that you spot on a chart and build a custom scan and thinker swings platform that will tell you whenever that pattern occurs on a stock and you can scan it against the entire universe of stocks or a select group to get started I will go ahead and reset the flexible grid and all I'm doing here is I'm separating this out into two screens I'm going to put a daily chart on the right and a weekly chart on the Left I'm going to turn off the customized grid and that will turn off the little control boxes in the middle now let's change the right-hand chart to a weekly timeframe before I do that I just remembered something I want to have a particular style on here let's put in a stock nothing in particular here again I want to emphasize nothing I'm showing you here today is intended to be recommendation to buy or sell any instrument of any kind I'm not trying to show you how to make money in the markets I'm not trying to show you profitable entries or exits all I'm trying to do is show you how to take an idea that you have and put that into a custom scan so I'm going to change the style to what something I've got saved here I call basic black and let's change the right-hand chart to a daily I'm going to access the settings and I'm going to access the time axis and I'm going to turn off show expiration Friday for our purposes today we won't be needing that let's also access the settings and for the time axis we want to have five bars on the right of empty space do that for both charts looking good now I want to adjust the zoom and first I want to check and see on the style menu you can go down to your aggregation period and you'll see that it is showing as a 3-year weekly three years of one-week bars so for the daily I also want to show I go to style and I change it to three years and select day for daily bars three years so I've got the same amount of data on both charts and I want to adjust the zoom on the weekly so that everything that's displayed on the daily is encompassed on the weekly so you see where I've got the crosshairs now what that means is on the weekly I'm going to move my cursor to that position I'm going to click and drag that is going to cause the weekly chart to zoom and now if you follow the cursor on both screens right and the left so now the daily chart on the right has a range that encompasses everything that I can see on the weekly chart on the left right from beginning to end it just helps me to line things up okay next I'm going to throw on a couple of studies you're going to be momentum studies I'll add the MACD histogram first and second I'll add the stochastic slope I'll hit apply and okay I'll do the same on the daily chart okay remember as I said what I'm trying to show you is how to take an idea that you spot on a chart and build a custom scan that allows the computer to automatically identify stocks that meet that criteria for you and so what's pretty simple to apply is something like let's say this stochastic here the slow K is bottoming out there's a little pivot right there and then it crosses above the slow D so K crossing above D after K goes below let's say the 50% level now we filter out some of the noise and look what's happening to MACD is doing the same you have a MACD that is pivoting okay from negative to positive okay so how would we plot that to pick up those signals first thing we need to do is we need to grab the code from each of these two studies and combine them into one of our own making so by clicking on the little scroll you can see the language and it's just a scripting language this isn't really computer code so don't get freaked out it's just the scripting language it's called think script and you have your fast link your slow length your MACD length these are inputs this is your settings 12 26 9 anybody familiar with the MACD should recognize those immediately just so you know where it's coming from and how the code is taking that information and using it in the formula and you only have one plot and it's the difference of the MACD Fast and Slow lengths so it's very simple we'll just copy this on to the clipboard we can press cancel here and I'm going to create a new study bottom left I'm going to call this new study scan MACD stochastic and I'll abbreviate stochastic and I named it that way because I plan to combine the two indicators into one custom study now I don't want to actually plot I'm going to change the plot statement here to a define statement so now we've defined a value called di FF that represents the MACD histogram pretty simple huh press okay and that will save it now we want to grab the code for the stochastic slow we'll double click the scroll scroll down we'll find the the plots that we want to capture are the slow K and the slow D so let's go ahead and grab the code for that all the way up to all the inputs we'll right-click select copy go to cancel and now from our studies if you click this search box drop down you can scroll to the bottom and select user-defined and here you will see a list of all of your custom studies and this is where you will find the one that we just saved what did I call it I said I would call it scan MACD stochastic so after we've captured the code for the stochastic slow let's click on the scroll icon for the custom study that we created scan MACD stochastic and now we can add a new line here by pressing enter a couple of times and I will simply right click and select paste now there's something I want to show you real quickly here let's expand this a little bit we a little bit more room and what happens is the compiler will highlight in red anything that is an error and all this is saying is that this appears twice and you can't have the same input defined twice so we're going to rename each of these ok so average type appears twice one for the MACD and one for the stochastic and in order to separate those we'll just rename them I'll add MACD to the end of the one that applies to the MACD and I will add st o CH to the one that applies to the stochastic and then all we need to do is update you see now it shows in red the average type because that input doesn't exist anymore because we renamed it so I'll replace it and then I'll do the same with the stochastic I'll select copy and then you see average type here that it's in red I'll hit paste and we'll scroll down there's one more place where that average type is used and then we'll paste there so now we've replaced the average type with average type MACD and we've replaced the average type with average type stochastic alright now the next thing I want to do is I'm going to replace these plot statements with define statements because we only want to define their values we don't want to plot them and scroll down here a little bit and we need to delete the style statements for the plots since we change those from plots to define they won't accept a style statement ok now we're ready to create our own plot so this is pretty simple you know for those of you who are interested in markets typically you're pretty good with numbers you know math is not a big challenge for you this is really just it's simple math maybe algebra but don't don't get you know freaked out because we're looking at some computer code here it's a scripting language it's very basic and if you follow the logic here it's really very simple we're going to create pair parentheses because we're going to create multiple conditions we're going to have a condition that's going to say alright look back to find a place where the slow K of the previous bar so I put one in brackets that's telling the code to look at the previous bar and we're going to compare that to the current bar so we're saying a slow K alright we'll put a semicolon at the end of this and the read doesn't disappear until we call this let's go ahead and say we'll just plot this as data and put an equal sign all right so the compiler accepts our changes let's add some empty space to the bottom to bring it up a little higher so the compiler says yep everything looks good and what we're doing is we're plotting a line called data and we're plotting every time the slow K from the previous bar is less than the slow K from the current bar we want to place an and and then another set of parenthesis and we what we want for the current bar is we want the current bars value of slow K to be greater than and the current bars value of slowdee and I just realized I made a small error here in this initial statement what I want is I want it to be the slow K of the previous bar has to be less than the slow D of the previous bar and the slow K of the current bar needs to be greater than the slow D of the current bar so what we've done is we've established a crossover let's go ahead and hit apply and okay and we'll hit apply and ok again and we'll check this out make sure it gives us everything we need let's uh double click on here and that will open up the weekly chart so we can see its entire range and let's make sure that we're getting exactly what we intended here everywhere this blue line here which is the line we just created with the custom code every time this line evaluates to true in other words the statement is true it gives a value of 1 and every time it evaluates to false it gives a value of zero so everywhere that you see these little spikes that's where the value is true so let's test this out for this bar the slow K is above the slow D and in the previous bar the slow K is below the slow D okay so we can get it maybe a little bit clearer image over here let's move that to the center so check this out okay so what this little spike here is telling us is that it found a spot where the slow K is greater than the slow D and the previous bar is the slow K below the slow D so we've got simple little plot here that identifies every place that it crosses over now we also have crossovers that are occurring while the slow D is well above the 50% level so let's say for some reason that your master plan to take over the markets and make a bunch of money is that you need to make sure this occurs when the slow K is below the 50 level well let's go ahead and take a look at that we'll go ahead and modify our code we'll go ahead and drop in another statement double parenthesis and within the parenthesis we'll type lowest value of the slow K in the previous three bars and we do need to tell the code that we want the code to look at the previous value of slow K for the previous three bars is less than 50 and let's see we need a closing parenthesis here somehow another that escaped me but there we go so we've got three conditions all three conditions must be satisfied to evaluate true let's hit apply and okay and as you notice what happened is we dropped off a few so now what happens is this crossover needs to occur after the slow K has dipped down below the 50% level now you can pick whatever level you want if you want it to be the 20% level of the 30% level you know eight this is your dream you put it in however you want you know but I'm just showing you how to how you can take an idea and put it into terms that a scan will understand so let's see the one last thing we want to include the MACD in this and what I want is for the MACD of the bar where the crossover occurs I want that MACD to be higher than the previous so I want both of the indicators to be an agreement so we'll go back to studies we'll hit edit studies we'll double click the scroll icon and edit our code and we'll add a fourth and final condition here by typing the word and open and close parentheses and within those parentheses will say that the di FF which is remember that's the MACD and we're going to say the d iff of the previous bar has to be less than di FF of the current bar we'll hit apply and okay and we'll hit okay so this is going to take out a lot of the other signals and romo only going to be left with signals where both indicators are in agreement and that's what we've got here okay so now let's take a look at this we'll double click this again that will minimize it back so that we can see both the weekly and the daily charts together we'll take a look at this and see okay this little spike here resulted in a daily chart that continued to climb higher a little bit it kind of flattened out what did this signal do for it here let's let's move this daily chart so that we can see I'll line up these cursors here as you can see the daily and the weekly that vertical line is the same on both timeframes so this is where the weekly signal occurs and it resulted in a pretty reasonable move so if you like this and you want to go ahead and build a scanner based around this well you've already got the code completed his scanner is going to pick up every time one of these spikes hits that's how it works pretty simple so let's move on to the scanning utility in thinkorswim and give this a test okay so now that we are on the scan page thinkorswim platform I'll just let you know that I had to log out of the paper trading side of thinkorswim platform because I found out that the ad study filter will not function unless you're on your live account so I went ahead and made some changes so you see some differences in the way the screen presents okay so let's get started first thing I'm going to do is scan in all stocks I'm going to intersect with a let's see a category of all optional and that's going to reduce by about up two-thirds the number of matches that we get then I'm going to change the first filter to the last price which is essentially the same as the last daily close I'm going to change that to $25 and I'm going to change the max to 500 and it's just reducing the number of matches that we get I'm going to remove the next two by pressing the red X's I'm going to add the first custom ad study filter and I'm going to change this to a volume average and I want to set the value to a tenday simple average of the volume and I want it to be greater than 500,000 and I want that set to daily good all right so now all we need to do is capture the code from our indicator that we created in a previous step and add that in as another study filter so let's go back to charts and let's go to studies edit studies and let's go ahead and double click on the scroll icon and then we can click and drag to select all of our code we don't need the first line we'll select a copy then we can press cancel and press cancel because we're not making any changes there we'll take you back over to the scan screen and for this custom study it's currently set to a DX cross over we're going to press the pencil that's the button in between the aggregation period and the red X by the way I want to change this to weekly because I only want the code to work on weekly timeframe so I click on the pencil the pencil opens up an edit window and you've got two tabs here condition wizard and think script editor what we'll do then is we'll highlight any existing code that happens to be in there and delete it then we can right-click and select paste and this is our code the only thing we'll need to do is change the description here in the previous code I had put in the word data here I'm going to change it to the word scan because that's what the scanner accepts so we'll plot once and we'll plot it in the name of scan and we'll use our four conditions and we'll press ok and then we can press scan so we have our results we returned a total of 47 stocks and our scan results now I'll show you how to use these in a watch list and link to watch list to your charts so that you can thumb through these just by clicking on them so go back to charts and while I'm looking at charts we'll go ahead and click the show gadgets button it's in the bottom left and you notice that I've got a watchlist setup here if you don't have a watchlist setup then you can simply click over here and change whatever's there to you know you can say switch gadget and then you can pick watchlist and that's how you can change whatever you've got to let's say you had live news you know you can just change that to a watchlist simply by hitting switch gadget and then changing it to a watchlist pretty simple and you can collapse that if you don't want to view that so alright right now it's set to a watchlist that I've previously saved and so to find your scan first you have to save it okay it's going to show up under personal but we need to make sure that we save that scan so we'll go ahead go back to scan and we want to hit this button up here on upper right and we want to say save scan query we're going to name it scan underscore Mac D underscore sto CH and underscore one more time and we'll put weekly in there to remind us that this is a weekly aggregation period let's save and hit OK if you've already saved it before it'll just maintain this the changes that you made so now we'll go back to charts and we'll click the gear for the watchlist and we'll go to personal and we'll scroll down until we find that scan that we just saved scan MACD stochastic weekly click that and it will take a little while to refresh there we go and notice that I've got this link set up to number nine sky blue and it's that way also on the charts sky blue for each the daily and weekly links ok so what that will do is it will ensure that any time I click on stock on the watchlist it automatically updates the charts ok so true to form as we told the scan we wanted to know anytime that the custom code that we created evaluated to true or a value of one so here you see the little spike and for the week that's closed I'm doing this on a Saturday so if you're ever doing a weekly scan you always want to wait do them at the end of the week whether that's a Saturday or a Friday Friday sub market closed day then you can do it on a Friday but always make sure the week is complete before you run any weekly aggregated it scans otherwise you're going to be running in the middle of the week and you're not going to get the final weeks signal it will change so let's scan through a few of these and you can see as I scan through each one they all have that little spike on the most recently closed week the current closed week bar so we'll click through here a few of these and you can see that the scan faithfully picks up everywhere with every place that this little indication appears and this is simply our logic we said we want to know anytime that the slow K crosses above the slow D after the slow K has been below the 50% level and we also wanted to confirm with the MACD climbing higher and that's exactly what it's giving us okay so that's how you take an idea something that you spot on the charts and if you've got access to the source code any any of the standard built-in indicators for thinkorswim you'll have access to the source code you just copy and paste it into your own build it and you can add multiple layers I only added two indicators you can add three or four you can add crossovers of moving averages there's a whole lot of different things that you can do and it's really pretty easy because it's not really computer code it's just think script and it's it's it's pretty easy it's pretty logical to follow so there you go that's how you create it and hope it helps Thanks thank you for watching this tutorial video be sure to visit WWNT comm for the full library of tutorials I hope this video increases your knowledge and helps you become more efficient with this topic whether for home or work please support this channel by sharing these videos with your friends and colleagues thanks and take care
Info
Channel: Hahn-Tech, LLC
Views: 86,536
Rating: 4.9318733 out of 5
Keywords: Thinkorswim Custom Scan Stochastic MACD, Thinkorswim, TD Ameritrade, Stochastic, MACD, Trading, Stocks, Options, Futures, Forex
Id: VOJwH9U0aL0
Channel Id: undefined
Length: 24min 21sec (1461 seconds)
Published: Sat May 09 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.