YouTube Video Transcript
[Music] hey this is David for big Vinson in this video we’re gonna take a look at our fancy moving average indicator that we’ve been working on and this indicator is capable of showing those multiple different moving average types along with many other settings duration what resolution chart the moving average is four and we’re gonna add another layer on to that in this particular video we are going to work with different candle types while looking at a normal candle chart or any type of candles you can plot a moving average for different types of candles and by that I mean we’re looking at a regular candle chart here but the moving average in the snapshot is actually for the fake and ashy candles which isn’t really a huge difference compared to what they normally would be with the moving average but what this does show is that you can use this if you are trading based off of those types of candles you can calculate those indicators from any different chart that you’re looking at and you can always have it use that particular types of candles that you like if you’re using something different so really nothing to it other than to adding a new variable and then using a new function we’re gonna continue to work with security function basically we’re gonna have our own custom code and every part of that function and it’s going to now call those different functions and each of the three areas in the security and then with the first part we are going to give it the tikar ID but we’re gonna get the tikar ID based off of a built in function for the different types of candles that were working with so I’ll go ahead and show you what we’ve got this is our indicator let’s go ahead and show you a little bit about how it works when we change the candle type we are using the current candle type which is just a regular candle type right now we switched it to the hey can – II and I probably am butchering the pronounce the the pronunciation there but that’s okay the Rinku you can see it’s calculating based off those different candle types and let’s actually leave it on Rinku and let’s switch to that particular chart okay you can see why the line was so different okay and if you understand how Rinku candles work then you’ll understand why the line looks so jagged here is because they may or may not update as frequently as the candle chart does here now now we have that you’ve already seen we’ve we’ve got our input here we’ve got these very different types of candles that we can work with so the first thing you’re gonna look at with the code is you’re going to be adding a new input and we’re gonna have a new set of options this is just like how we did our resolution we added in a whole array of different options we set the default value to the current one and you can select between the different types of candles now in order to convert these strings this array of strings these options in order to take one of those have it selected and converted into what we need we actually have to use a function to tell what the current value is that we have selected and then return the correct ticker ID in order to calculate the correct moving average now the reason we have to do that is because we can’t call the security function within an if statement or a for loop I believe the for loop as well but definitely not in the if statement and what that does is it kind of creates this constraint to where we have to create a function to return the tikar ID and then we have to do this security function on its own okay I’ll show you what I mean by that but let’s go ahead and take a look at the function you’ll notice our other functions here are moving average our resolution and now we have a new one called get ticker ID now we’re passing in the candle type this is going to be the string that the user selects in the inputs on the candle type okay so with our nested if-else statement here we’re going to first look at the current candle of course we’re going to return the current ticker ID okay at moving on this is pretty straightforward once you get the hang of it and you look at the reference the pine script reference you can tell what you have available for you and I just kind of went with the examples that they had the hakin is she this is a built-in function that you use to return the ticker ID for that particular candle type so we call that function we pass in the ticker ID it’s going to return this value from this function and we’re going to use that in the security call and you’ll notice some of these like the ring code all the other ones have extra options that you can define I’m using the values that we’re provided in the examples in the reference manual so if you want to change these to whatever you want you can I didn’t want to have these as inputs here because this would make a very long list I’ve put in a request or suggestion I should say to tradingview to be able to create input groups that way if we were to select the the Rinku we could have inputs for these two and also I would like conditional inputs to where they would only show up if we selected a specific value but that isn’t there yet so I’m not even gonna bother creating the inputs for it we’re just gonna go with the defaults and that should be good and like I said since you’re following along and you’re coding yourself you can probably just change those values to whatever you need if you think you need them as something different okay so we’ve got our function and really the only other thing we’ve changed is the security call when we are calculating our moving average we use the security function and like I said this can’t be within the if statement otherwise I would have created a function called calculate MA and it would have basically done the same thing it just would have used the tikar ID it would have been its own line in each of those really would have just saved us one line of code so it’s not a big deal anyway so within our security function we are calling get ticker ID that’s the new function that we’ve made using our ma candle type and it’s going to return the ticker ID based on whatever function we have selected and of course our resolution based on that function that we had and then finally the moving average which is the actual moving average calculation based on the values that we passed in for that so we’ve come a long way with this particular indicator I’m trying to think there’s anything else we can add to customise this particular indicator more if you can think of anything that you would like to see on this one please let me know or any other one please let me know in the comment section on the video I really appreciate that there’s a lot of things we can do here and if anybody wants any examples of anything just let me know and I’ll try to take a look at them when I get a chance so that pretty much does it for this video if you want to actually find this indicator on training view it is available in the public library just go to indicators and you can actually just search for fancy moving average you’ll see it available in the public library and you can actually add it to your chart like that you can also check out my trading view profile and go to the scripts section and you’ll find it there you’ll find a bunch of information about the particular script a copy of the source code as well this one is open source and you can also check out every everything else that I’ve done my ideas my scripts my followers all of that different type of information you can check that all out there so I appreciate you watching the video if you liked it please leave a like on the video that helps a lot also subscribing that helps a lot too but if you like this video then you probably do want to subscribe because we do a lot of videos like this where we are giving you development examples and tutorials on Pine script and many other things so please subscribe if you haven’t already but other than that thank you and have a nice day [Music]
YouTube Video Description
< br/> #bitcoin #crypto #cryptocurrencies #tradingview
Trade on Coinbase: https://www.coinbase.com/join/johnso_dxz
Brave Browser: https://brave.com/big406
DISCLAIMER: All my videos are for educational and entertainment purposes only. Nothing in this or any of my videos should be interpreted as financial advice or a recommendation to buy or sell any sort of security or investment including all types of crypto coins and tokens. Consult with a professional financial advisor before making any financial decisions. Investing in general and particularly with crypto trading especially is risky and has the potential for one to lose most or all of the initial investment. In simple terms, you are responsible for your actions when trading.