TradingView Pine Script Tutorial 19 – String Concatenation and Securities

TradingView Pine Script Tutorial 19 – String Concatenation and Securities

YouTube Video

YouTube Video Transcript

[Music] hey this is David for big that’s in this video we are going to look at a brand new indicator that we’ve came up with here this was actually suggested by someone who was following the channel and contacted me through the YouTube comments and also through discord so this is called the finance Bitcoin alt ratio difference and I’ll explain what that means in just a moment but the reason I’m sharing this one is mainly because it has some pretty interesting use of strings to manipulate the Securities and by that I mean we’re able to change what security we’re looking at by using strings and I’ll show this to you how it works in just a moment but I want to show you first the end results here so with this indicator and what’s happening here we are looking at the etherium bitcoin alt ratio difference right now and we have the ability to select different securities from the drop-down here and you’ll see how that works on the code side in just a moment so if I change it to litecoin should take a moment and update yes there we go it takes a little while to pull the information and then we also have the ability to use a custom altcoin and these are all traded on by dance and they have to have a Bitcoin pair and also a USD T pair and I’ll explain that in just a moment I’m going to leave it back on aetherium okay and now we’re going to pull up the source code and I’ll kind of explain what the difference what the alt ratio difference is here so I’m going to go ahead and go to the actual calculation the alt difference is just the price in USD T of the altcoin you have selected so this would be the etherium USD T price divided by its price versus Bitcoin so that is a way to calculate what the price would be if it were priced in terms of its ratio versus a Bitcoin it’s a it’s not entirely effective for really trying to find any trends it might be good for some sort of arbitrage opportunities something like that I can’t really say the differences are pretty minimal though but just to show you what we’re talking about let’s pull up let me pull my calculator back over the side let’s pull up the etherium USCT pair on by Nance all right it’s at 159 ninety-two and let’s look at it on Finance here all right so we would take our 159 92 and then we divide that by the current price of Bitcoin in point zero one eight three six nine and that gives it a Bitcoin comparative price of eight thousand seven hundred and five point nine seven so let’s go back to the Bitcoin USD T price and that’s eight thousand seven hundred and fourteen so you kind of get an idea of what the indicators really intended to do just kind of see if the ratios versus Bitcoin or USD T are kind of out of whack and there might be some sort of opportunity in there somewhere and this was something someone suggested so if you have any questions on how to actually use this I don’t entirely know but they requested it so that’s what we’re doing here and of course if you have any suggestions please leave a comment below and of course I’m going to show you at the end where you can get the code for this as well now let’s go to the actual important part for the development series now that I’ve shown you the end result of what we’re doing here and also kind of the key parts of how it actually works as far as you know the result you see on the screen what we’re really interested in in this video however is our options that we’re using we’re working with strings in the title of the video is strings and manipulating securities essentially so how does that work well we have a drop-down for our alt and you’ll notice it’s pre defined options here in this array or aetherium litecoin and XRP and it defaults to the etherium and the dropdown you notice that when we pulled it up originally those are the three options there now we also have a custom alt which is default values xlm but you could change this if you wanted to just by typing in a different all tier now before the indicator will actually use that you have to check that you are using a custom all tear and then you can type it in so you see it changed the calculation to account for stellar here let’s change it back to aetherium and let’s actually take a look at this so one of the first things I did was I came up with a function that’s going to manipulate the strings to give us whatever the alt is it’s security the alt security versus USC team so we have to when we’re calling the Security’s we have to tell it the exchange we’re working with and then we have to give it the trading pair which would be whatever alts you enter in and for us to get the USD T price we also have to follow that up with us DT and we also made another function which we’re covered in previous videos so if you haven’t seen those please go back and check out in a series how to do that but we also have the ones where we can just insert the alts into the finance Bitcoin pair so all we really have to do is tell it what all we’re working with and it’s going to give us the correct string to look up in our security now you can see here the first thing we do though we have to have the Bitcoin price versus USD T because we use that to compare and since the whole third the health focus of this indicator is to compare the alt ratios difference to Bitcoin versus USCT we have to have that one price no matter what and we’re all using the same resolution on all these so to get our custom alt or our selected alt that we have in the drop down we have to call the security function again we want to get its close for the resolution but we’re checking to see if we’re using a custom if we aren’t using the custom we use the alt that’s defined in that first alt input otherwise we’re going to well also notice that we’re calling the alt USD function so it’s going to return that string from up here with whatever alt string we place in there so the default option is F it’s going to call this function it’s gonna place aetherium in here and you’re going to return by Nantz : e tah USCT alright but if it is custom then it’s going to call that same function but it’s going to use the custom alt that you typed in so it’s a really easy way to kind of manipulate the strings and also manipulate the securities I’m not sure where it’s gonna be too useful for you in in this but if you’re wanting to quickly cycle through all coins like this that might be a good way to do it instead of you know having to type in all the alt coins that you’re willing to work with now we also do the same thing for the Bitcoin price we check to see if we were using a custom one or not and we called the correct function based on whether there was a custom input or not now that we had those we were able to run our calculation I already showed you how that worked but the only other option we had was whether we wanted to show a dollar based difference or a percentage based difference and really the only other thing we did was we calculated that percentage difference and we just only showed whichever one was actually selected so really that’s all there is if you want to get a hold of the source code you can always check out my github but probably the best way for most of you is to actually check out my profile on trading view where you can go to the scripts page and you can actually see this indicator here I just published it earlier and you can see a little bit more information about it and also have access to the code alternatively you can also just go ahead and add it to your chart it may not be indexed quite yet ah no it’s not quite index in the public library just yet so that’ll show up in just a little while but it’ll show up like this in the public library soon enough if you have any questions please leave a comment or reach out to me on social media all the links for these things are available in the description of the video I also have a brand new tool that I’ve been using for my website that is posting the transcript of all of these videos along with an embedded video on my website on the blog so if you want to see the transcript and you weren’t on youtube for whatever reason you could do that there you can also contact me through the website many different other things so a lot of great things coming up but yeah if you liked the video please leave a like that helps a lot and so does subscribing of course so if you’re down there checking out the description looking for those other links or my tradingview profile please go ahead and like or subscribe but otherwise that’s it for right now thank you and have a nice day [Music]

YouTube Video Description

< br/> #bitcoin #crypto #cryptocurrencies #tradingview

Website: https://bigbits.io
Discord: https://discord.gg/rapMn4z
Twitter: https://twitter.com/BigBitsIO
Facebook: https://www.facebook.com/BigBitsIO/
GitHub: https://github.com/BigBitsIO
TradingView: https://www.tradingview.com/u/BigBitsIO

Referrals……
Trade on Coinbase: https://www.coinbase.com/join/johnso_dxz
TradingView: https://www.tradingview.com/gopro/?share_your_love=BigBitsIO
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.

YouTube Automatically Generated Transcript (up to video description character limit):