YouTube Video Transcript
[Music] hey this is David for big bits in this video we’re gonna do a another look at an educational topic we are going to discuss a strategy or an indicators configuration settings and now I’m sure you’re probably familiar with this on training view you go to your indicator settings here the inputs as a lot of them are referred to and you can see there’s a moving average one length and a moving average two lengths and you can change these but what we are going to be doing in this video is we are going to be adding another setting and this is just going to give us an option to choose for pre-configured different settings for these moving averages so by default it’s 10 and 30 we’re gonna set these to having a different option to where there is a 50 100 and a 50 200 available as well so I’ll go ahead and walk us through that in just a moment but if you haven’t already please go ahead and like and follow here on training view I do educational videos like this fairly often and also have a YouTube channel where I also post these videos and also have much other pond script tutorials that I’ve already made as well so if you would go there and like and subscribe as well to get those videos as well alright so the first thing we’re gonna do is we’re going to pull up two ass wonderful script that I have and I am gonna publish this update after we’re done with it and we will look at our inputs let me zoom in down here we have our inputs and what we are going to do is we are actually going to copy these okay now essentially we have two inputs but that’s not what we really want we want to set these default values on both of them and I’m sure you’re wondering there’s already a default value up here just be patient you’ll see exactly why I’m doing this so these are the particular values and we are going to you want to make sure we declare these as integers and you’ll see why in just a moment so we are going to add a new input I’m going to call this config and this input the default value is going to be default how about that and for this we are going to have options I believe this is how it’s done it’s kind of hard for me to remember off the top of my head we have default and then we’re gonna have 5100 and then we’re gonna have 5,200 as well we’ll save those and let me zoom back out let’s save this and see if it didn’t give us any error messages and we actually need to rename these real quick just to make sure we don’t get the errors we don’t want use the same name twice okay so that looks good let’s make sure that our options are working the way we would expect yes the default value is set to defaults now we have options 50 150 200 as well so back to our code again we can go back and we can actually change these because these values the inputs the name of these variables were already being used down here so in order for us to use our custom values we’re going to use those names of the variables here and we’re just going to add a capital I to the beginning of these and these are our input values and these are the variable values that we’re actually going to use so now we’re going to set the actual values we’re going to use based on our configuration options so to do that we’re going to use an if statement and we’re going to compare our config string to whatever we have selected and we don’t need to do default first we will just save that one for last and we really only need to worry about our special ones that we’ve created so if the config if the selection is 50/100 we can set our ma one length equal to 50 and our ma 2 length equal to 100 and then thanks to a recent update we can do else–if and have our config and check it to see if it is equal to 5200 then let’s just copy this bit of code here and instead of being 50 100 will be 50 200 and finally just in case we’ll do our else and this will cover the default option and as well as any other mistakes we might have made and we will just set our values here again and we will just make sure that these are set to 10 and 30 as well which our defaults now there is a way you could probably have this to not be equal to that you could probably even use the default values here themselves but if you want to do like a catch-all say you made a typo in one of your inputs or in one of your if statements this would kind of catch-all instead of just doing else if config equals default so you could probably do in a one length equals the input for ma one length and we might even try that again in a minute but if you wanted to catch every mistake you could make as the default values just have your input defaults match your defaults in the else statement of your if-else branch so let’s actually take it out of zoom let’s save this and let’s try it ok that worked let’s go to our settings and let’s choose the 50 over 100 hey there you go we’re in add a 50 100 but you’ll notice our input values don’t change but you can see the configuration value apparently zoom in actually you see the configuration value changed but not the inputs so if we select the 5200 one of those lines stayed the same and the other one changed to the 200 so this is working exactly how we wanted let’s change it back to default there we go we’re back to our default options again so that handles that now let’s actually go back and set this here and excuse me for just a moment as I do this there’s really no need to zoom in here we are just setting the links here equal to the input okay and we want to do our input values I will zoom in now so you can see this I have added an l-sit for the default we’ll do two here and this is why it was important for us to declare these as integers because our input type was an integer and if we’re going to set these values equal to the input the datatypes have to match essentially you can only set an integer to the value of an integer and now what we have is we have the 50 100 250 200 and the default but like I said earlier if we made a mistake this would catch it and I’m not gonna change these values because they’re not going to be hit based on what we have selected here so we’re just gonna save this and we’re just gonna make sure that our default options work there you go 50 about 130 and that is using the default configuration so I hope you enjoyed this video I hope you learned something from it if you have please like the video if you’re on YouTube while you’re down there liking the video please also subscribe as well make sure to check out anything else that’s on my profile as well that’d be great but that will do it for today thanks and have a great day [Music]
YouTube Video Description
< br/> 🔻🔻🔻🔻 IMPORTANT LINKS BELOW 🔻🔻🔻🔻
How To Configure Indicators and Strategies With Custom Predefined Settings: In this TradingView Pine Script Tutorial/TradingView Update, we discuss how to create custom configurations for your indicators with a new input with options for predefined sets of values for your indicator settings. I’ll show you how to configure these scripts for your indicators with several different configurations as well as using the default input values as well. With Pine Script it is very easy for even beginners to create their own indicators or strategies that have many other indicators within them. Once we have completed the script, we can see our results immediately and begin working with more functions, indicators, and strategies.
Social and other public profiles
💻 Website: https://www.bigbits.io
🎮 Discord: https://discord.gg/rapMn4z
🐦 Twitter: https://twitter.com/BigBitsIO
📔 Facebook: https://www.facebook.com/BigBitsIO/
📈 Buy, Sell and Trade Crypto on Binance.US with LOW fees: https://www.binance.us/?ref=35105151
🙋♂️ Want to buy crypto? Get $10 of bitcoin w/ your first purchase over $100: https://www.coinbase.com/join/johnso_dxz
📈 Sign up for a paid plan at TradingView and receive a $30 credit: https://www.tradingview.com/gopro/?share_your_love=BigBitsIO
💻 Browse privately and get rewarded with Brave Browser: https://brave.com/big406
🕹 Receive bonus perks when purchasing Lightnite Game: https://lightnite.io/ref=BigBits
VIEW ALL HERE: https://bigbits.io/bigbits-referrals/
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.
#bitcoin #crypto #cryptocurrencies #tradingview #binance #binanceUS #coinbase
This channel focuses on Bitcoin, Ethereum, LiteCoin, Ripple, Link, Basic Attention Token and almost all cryptocurrencies that demand attention. Please like the video if you liked the video, and subscribe if you like these types of videos. David from BigBits is an experienced Software Engineer, but no one is perfect, If you find any issues with any of the open-source, free code, or code shown in videos please comment to let us know what to fix, we listen to our viewers!