YouTube Video
YouTube Video Transcript
[Music] hey this is David for big bits and in this video we’re gonna kind of continue off where we were last time I haven’t made any changes since the last video I’m actually recording it immediately after the last video so hopefully nothing has actually changed what we’re going to do in this video is we’re gonna continue working with our scoring model and we’re going to add a new indicator to the scoring but we are also going to be adding another condition another way to add points just to show you that there’s more than one way to do this in a single time now you could also use functions but we’re just going to do it all in line and it’s gonna be pretty simple hopefully you can follow along and keep up and eventually this will all be posted on my trading view profile and stick around and you can get more information on that at the end of the video now first thing I want to do is actually kind of clean this up a little bit I’m gonna essentially name this region of code indicators I don’t like all these line breaks these empty lines I should say and what we’re going to do is we’re actually going to go ahead and add our new indicator I want to use the stochastic indicator and to do that we’re actually going to need three different variables to say that information we’re going to need the stochastic and that is going to be set to another built-in function and we have to pass in the following parameters now if you’re not familiar with stochastic there’s plenty of information out there on that on how the calculation is done I believe there’s even a wicked a tradingview wiki post on and I’m sure you can check Wikipedia as well for how stochastic is calculated but in order to match what’s on the tradingview indicators we need to use the calculation just like this and we’re going to use built-in inputs hard-coded values for the settings for it so when you also have the stochastic D and that is going to be a simple moving average of the stochastic and double check that yes that is correct and then we also have stochastic K and these might be referred as different things on different indicators or different burgers and excuse me different versions of the stochastic but this is actually I got that backwards I believe K should be the fast one and D should be the slow one my apologies about that so that’s how I believe that they are done if it’s not how you used to and then I apologize but that’s how we’re gonna look at things now let’s go ahead and plot these values as well so that we can see what we’re going to be getting into what we don’t need to plot this stochastic itself we just need to plot the stochastic K and the stochastic D alright let’s go ahead and save that Oh No what did I mess up oh of course I didn’t give it a value area hopefully that takes care of it and it did so let’s go back to our indicators let’s look at the built-ins let’s use the stochastic that’s built in this is on trading units their built-in value let’s skip to the end here make sure our numbers match and sixty three point one five on our indicator and sixty three point one five on the stochastic you can see those values I’m talking about here and here that’s where they matched let’s go back to the end you see sixty three point one five again and the next number over is also forty four point nine six on both so RK and RD are correct the fast line which is the blue line on the trading view is the one we call decay and a slow line which is just a simple moving average of the fast line is the orange line on the built in here so I’m actually going to leave that up here that might make it a little bit more sense later on let’s go ahead and remove those plots since we know those values work and we’re going to create a another batch of points for this call it stock points and let’s do the same thing that we did with the RSI now if you haven’t watched the previous video I really recommend you should because it’s gonna make this whole thing make a lot more sense I believe and it was a little bit longer than normal but you’ll kind of understand the concept a lot better if you’re kind of having a hard time with this particular video now once we add this indicator now we can add the points to it and what we’re going to be doing is exactly what we did with the RSI except we’re gonna have a little twist now the RSI we gave it one point for every point it was below 35 and if we did that was stochastic you can see we did we did that it would have been worth more points to further real intent excuse me I lost my train of thought there for a moment anyway as it goes down it’s gonna be worth more points now I said there’d be a twist on it I think that’s actually in the next video I apologize I kind of get ahead of myself here there’s a lot of really cool stuff going on in this one so let’s look at this stochastic K which is the fast one we want to give it points as soon as it goes below this value we’re gonna keep this value at 35 so if the stochastic K goes below 35 we’re gonna return one point for every point that indicator is below it so do 35 minus the stochastic K all right excellent and if it is not below the stochastic K we’re gonna return to zero points now we need to make sure we add these new points into our total points very good and let’s save that now you can notice things look a little bit different the values go considerably higher compared to what they were before let’s take a look when the stochastic gets really low here all right so we can see where are we below 35 on this particular candle here all right stochastic K which is the blue line is eight point one seven so 35 minus the eight point one seven what’s that leave it at twenty six point eight three all right so it’s gonna at least be twenty six point eight three even if the RSI isn’t that low so yeah and it’s a green candle so that was give us three more so you kind of get the idea it’s worth more points to lower it goes and of course the RSI is lower let’s go ahead and add the RSI because it’s gonna help make things look a little bit better I’m gonna my scripts actually add that one back in all right excellent so on that candle the RSI was not below 35 so it gave us zero points the blue line on the stochastic RSI should have given us twenty six point eight three now you can see the on this value I mean I want you to pay attention to this number here when I put it back on that particular candle you’ll notice that ends in point eight three so that means we calculate the last two numbers correctly and if I’m wrong on the twenty six maybe it should be twenty seven I’m not entirely sure but we’re gonna add you know no choice six is correct so we’re gonna add three points because this one zoom in even further here it’s gonna getting kind of hard to see it was a green candle so that was three points so twenty six point eight three plus three is twenty nine point eight three so how did he get three more points well the SMA was moving up you’ll notice the SMA value is up here right now it’s in a but let’s see where we were right here all right it’s eighty five point five nine if it was below that on the previous candle it should have added three more points because it was trending up and it was it went up six from that candle to this one so we got three points for that three points for being a green candle no points for the RSI being below thirty five and we got twenty six point eight three for being below the stochastic value of 35 so hopefully you’re able to follow along with all that it shouldn’t be too much if you watch the first video but if it is please let me know in the comments and if you have any questions I can answer those for you but essentially we’re just giving more points to our new indicator the lower the stochastic gets and I’m going to leave the stochastic up there because I’m gonna end up using that in the next video but for now we’re good with the stochastic we don’t we don’t really want to do anything else with in this particular video now one thing I also said was going to do is we’re going to look at multiple ways to add points to the same indicator now in this indicator so far with the simple moving average what we have done is we have added three points to every single case that the SMA is moving up so when you’re in a long uptrend like this they’re all gonna have this kind of base value of three points because they’re all in this upper trend now one of the things you may want to do is spot when a crossover occurs and that is well when the indicator changes directions I should say it’s similar to a crossover except it doesn’t really crossover in any other lines what it’s actually doing is it is changing directions so it was going down so when it changes directions upward then we will give it more points now with a simple moving average this may not be the best thing to do ideally I would use a much quicker moving average but this is all just for an example anyway so let’s go ahead and add that in we take a look at my code I’ve already got done so I can make sure I do this correctly I don’t want to waste anyone’s time here so we’re actually going to add these points onto the existing ones so we’re gonna keep it to where there’s three points if you’re in an uptrend but we’re also gonna add more bonus points and be more on that in the next video but we’re gonna add bonus points for if it was a crossover candle as well now this is very unlikely to ever happen on a candle that has a lot of points just because we’re looking for low RSI and low stochastic values so adding these bonus points on one of those candles probably isn’t gonna occur when it’s thick a stick and the RSI slow that’s just kind of how it’s going to work out but just for the examples sake let’s go ahead and the first thing we’re going to do is we’re going to come up with our condition it’s a two part condition and we’re going to check if the SMA of the previous candle was less than the SMA of the candle two periods back now a reason that’s important is we are checking if this candle its SMA value is less than this candles SMA value so in this instance that’s true because it went down from the second candle back to the first candle back so that part of the condition would be true there and now we actually need to check if the current SMA and I just realized I’ve even capitalized any of these and it’s not gonna work unless I do that let me fix that really quick and then I’ll explain this condition again all right so now we need to make sure that the current simple moving average is greater than the previous moving average and there I go make it a lowercase again but it makes perfect sense your newest candle oldest candle newest candle oldest candle this is how we detect that the SMA changed directions it was heading down now it’s heading up and you have to make sure that it moves down here up here that’s all there is to it you might also want to look into adding the less than or equals to on one of these sides or just to have N equals two as well on one of these two just to make sure you catch all the possible options but chances are it’s not gonna be equal to in any case so that’s just something I’ve noticed and we’ll go ahead and take a look I’ve put parentheses around these to combine these two conditions just to make sure I see it cleanly that’s just one of my habits with my code now since we’ve checked both of those conditions as one they both have to be true and that means we’ve checked for our trend change on the simple moving average so we can give it points so let’s actually give it five points for the trend change and if it’s not changed then we give it zero now this is only gonna happen one time whenever the trend changes direction so if it goes down then up it happens if it continues to go up it does not continue to give it those bonus points let me change these values to match what I have in my example because I want those to match so everything turns out the same as what I’ve started working with now we didn’t have to change anything with our total points because we’re adding this on to our SMA points when we’re doing these condition checks so everything is kind of done in line here and it’s completely taken care of so let’s hit save all right so you’ll notice just kind of out of nowhere here we have the SMA moving up because we have a random jump in the points here it’s got 15 points I can tell you just by looking at the chart the RSI is probably not low enough to qualify for points and the stochastic definitely is not low enough to qualify for points let’s zoom in on that particular one if I can find it now where was it of course now I’m not gonna be able to find it I think it’s this one zooming a little slower my apologies okay let’s got 15 points and it’s got five points for being green now we changed the point values it’s a green candle he gets five points for being a green candle the SMA points it gets five points for being in an upward trend the first part of this but it also gets five points because the trend changed the SMA went from moving down so moving up so you’ll notice in these light gray values it’s gonna be really hard to read so let me see if I can’t change this to a different color and give you an idea of what it actually is yeah all right so now you can see those numbers a lot more clearly in the yellow on this one it went actually on this one it went from ten thousand four hundred eighteen point eight eight down to ten thousand four hundred fourteen and then it went back up to ten thousand four hundred twenty so that was our trend change right there SMA down then up and that can happen a lot as the price goes kind of sideways here so I was just something to keep in mind that’s why I said this probably isn’t really ideal so that pretty much covers it I’ve shown you how to add another indicator in here well it’s multiple parts and then I also showed you how to do extra conditions and give more points on a single indicator if certain things are true with it now that pretty much covers it for this video but there is one more video and it’s going to cover some really important topics for pond script and the first one is the loops I haven’t covered loops yet in any of the videos but we’re gonna be looking at loops and we’re going to be using the loops as I’ve mentioned in the last video and this one I believe already to try and capture these moments where we’ve already got a lot of points but the price continues to go down so what we’re going to do is we’re gonna look back with a loop and see if our price is still going down and continue to add points so that we don’t have this huge dip here and even if we bought as the price continued to go down as the as the points accumulated quite high we would also end up having the points continue to grow as the price continues to drop and I’ll take a look at one way we can do that in the next video and that’s by using the loops now the other thing we’re take a look at I believe that’s that’s mostly it but there’s also one other thing we’re gonna look at self referencing so what we’re gonna do is we’re gonna keep these points as a base value and we’re gonna add bonus points as well by working off of this value so we’re actually gonna have two lines on the chart we’re gonna have our base points and then we’re gonna add a second line that’s bonus points and just kind of show you what’s going on where we’re getting more points for the price or for our points to have stayed at a high level for a long period of time that’s essentially all there is here and that’s it for the video thank you if you liked the video please leave a like if you like these types of videos please subscribe especially because you’re gonna want to see the next video we are gonna publish this code once it’s complete on to my trading view profile under the script section I already have quite a few we have quite a few followers and likes already this stuff still growing so please check it out if you haven’t already go on and follow me there so you can see when this particular indicator is going to be published now keep in mind this is all this indicator is just a complete sample it’s just an example of what we’re gonna do and even when it’s posted you’re gonna have to apply your own indicators to it and if you need help with that you can feel free to ask me questions but that’s it for now and thank you and have a nice thing [Music]