Arrays Are Now Available In Pine Script! What’s New In TradingView

Arrays Are Now Available In Pine Script! What’s New In TradingView

YouTube Video

YouTube Video Transcript

[Music] hey this is david for big bits and in this video we finally have a raise in trading view it has been a long time coming this is a feature uh where more experienced programmers or even those who are you know just in the introductory levels have been looking for this feature for some time arrays essentially just allow you to hold an array of different values assorted together so essentially what we’re talking about here is like a bundle of values that we want to keep together so in the past what we’ve done is we’ve stored values and variables now think of a variable as a single unit you can think of an array as an array of those single units so you can have one two three four you could have as many well within the limits of the system you can have a lot of different values within an array that you can manage and you can use there’s some really cool features about arrays for those of you who aren’t too familiar with something like link with c sharp to where you can actually use math functions on your arrays that you’re working with there’s some really cool stuff in here that you’re going to be interested in but the first thing we have here this is the blog article that they’ve came out with they’ve been working on this feature for a long time and they did a really good job on a first implementation here there’s a lot of features built in with it for this first release of arrays and i’m sure they’re going to build on more stuff like they do a lot of other things but for this to be their start it’s really good all right so again this is the blog post for it you can see they’ve added this feature and let’s see did i miss something here calculate okay so you can use float it or color in your arrays so uh color that’s pretty interesting so these are just different data types that you can use within the arrays a float you can think of this more of like a decimal value and if you remember from math integers are a whole number and that is important to keep in mind boolean that’s true or false and then color is uh they have their own namespace for that and if you’re not familiar with what a namespace is essentially when you’re doing your code and you type in color dot white the color dot is the name space essentially anything you put after that is just a different property that has a different color value so the color keyword is just the namespace all right i don’t want to get too in-depth on that but the next line that you see here is used to create an array called levels and it initializes the array creates the array in memory with the initial value of n a so when you are plotting things on the chart if you’ve been following the tutorial series you’ll know that if you plot n a it doesn’t plot anything it’s a null value essentially there is nothing there not even a zero you can literally think of you know if you’re looking on this day what happened you know two years ago that was really important if there was nothing there was nothing absolutely nothing okay but that could be represented as a zero because nothing happened there and what really null is is trying to reference a day that doesn’t even exist so so today is september 11th when i’m recording the video so say for example we wanted to reference august 34th that is null it would give you an n a value back so that’s just one way to think of that and again i’m trying to i’m trying to keep myself from going too in depth on what we’re talking about here but i want to make sure everybody understands what these mean because this video probably not going to be early on in the tutorial series and a lot of people are going to find this before they get to the tutorial series where you’ll probably see a lot of stuff in action all right so they have some really special functions that i talked about specifically with math you do some transformations on your arrays copying sorting slicing and then the special math functions these are super valuable so you can get and store within your array a bunch of numbers and you can call the array.min function like this and it’ll give you the minimum number out of it same goes for max it’s the maximum function and you can actually call standard deviation average and median as well and there’s a lot more to it and you can actually go to their documentation to find out a lot more on here about this and there is some error handling that we’re going to take a look at in just a moment but you can see there is a pretty good set of documentation here for the arrays themself and i’ll try and post a link to this in the description of the video and if i don’t just remind me and i’ll go back and i’ll try and do it all right so this bit of code essentially shows us how we are going to be using arrays or how you can use arrays i’ll kind of walk through this code just a little bit and then we’ll actually look at it down here to see what it does so the first thing you’re doing is creating inputs one for levels and one for the source we’re going to be using 20 levels let me zoom in here there’s going to be 20 levels in this example and there’s going to be a source using the hlc 3 high low close divided by 3. then you initialize your array with the number of levels okay so you’re going to create an array with 20 items in it so that is the size the size of the array is 20 for the 20 different levels that means we’re holding 20 different float values within our array now this checks to see if the volume is rising and then if it is we remove the oldest level from the beginning of the array and to do that you shift on the array this is a function called shift and you call that on the array and then you do that with the number of levels and it’ll take care of it there for you all right and excuse me that’s not the number of levels that is actually the array itself levels here okay uh i was looking at the wrong thing when you call this function array.shift you pass in the array levels and it will shift that and remove the oldest value and at that point the size of your array i believe may change depending on how they’ve implemented the array i believe it should change when you do a shift typically it will remove an item and when you do a push it’ll add a new item okay and you’re doing that here as well and when you add using the push function using this levels array that we’re storing all of our data in you’re adding in the source for the current candle and that is the hlc3 and you’ll notice that it’s the current candle because it doesn’t have the index at the end of it there then at the end of that you’re going to calculate the average of the levels in the array excluding any of the n a values so all you have to do you create a new variable here just called level so this is the level that it’s going to be using to plot on the chart you call the average function with the raise you pass in your array for the levels it’s going to take all the numbers in there it’s going to create the average level for you it’s pretty simple uh all the hard math as far as doing an average is done for you and you don’t have to keep track of a bunch of different variables so it’s pretty handy as opposed to what we were having to deal with before having to hard code a lot of things they’re a lot more flexible uh to work with and really just something that’s been lacking out of pine that now that it exists is going to take pine to another level and really you’re going to see some really really interesting scripts now that you can have arrays and this sort of flexibility in the code as well all right then all it does is just plot that level that it just calculated using the array average and you can actually see that here it has a condition here to see whether the price is above or below that if the price is above that calculated level that line zoom in here that line is green and if it’s below then it’s that fuchsia color so that about does it for the uh basically the blog post here i’m not going to dig into actually doing code in this video i really just wanted to make sure you’re aware that arrays now exist we’ll probably do a video specifically on using arrays at a later point but for now we’re just going to cover that these are in here some of the basics on what arrays are and some of the basic functions showing you the example that tradingview provided you and then you also have of course the manual page for the user manual on pine i’m going to try to link that in description of the video and then you should also check out some of the script examples that they’re showing you below i mean you can look at this script to see kind of what’s going on something kind of different i haven’t seen something like this myself but pretty interesting that you can create something like this on the chart and they’re doing these with arrays i assume because they are added in here as examples yeah so uh ricardo santos and i’m just gonna call him duck i’m not sure how you would pronounce that but duck uh ricardo santos and ducks did a lot of testing on the arrays and let me tell you guys there was a lot of testing there’s a lot of work on the arrays uh following the pine coders and all their communication they’ve done a lot of work the team’s done a lot of work to get a raise so i’m sure they appreciate it very very much the testing from the people who actually worked on this but yeah that’s it guys i hope you all enjoyed the video please make sure to like the video if you actually did like the video and if you did like the video you probably want to subscribe to the channel i do a lot of videos like this and i’ve mentioned throughout the video we do a pine script tutorial series where we talk about how to actually create your own scripts for your own indicators and strategies throughout from the very beginning for a very novice programmer who knows nothing about programming all the way into making some fairly complex code but that’s going to do it for the video guys thanks have a great day you

YouTube Video Description

< br/> ???? IMPORTANT LINKS BELOW ????

Arrays Are Now Available In Pine Script! What’s New In TradingView: In this TradingView Pine Script Tutorial/TradingView Update, we discuss one of the most important updated ever to the Pine language on TradingView – Arrays. Arrays are going to change the game and are a huge step forward for the team at TradingView. 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.

https://www.tradingview.com/pine-script-docs/en/v4/essential/Arrays.html
https://www.tradingview.com/blog/en/arrays-are-now-available-in-pine-script-20052/

??‍♂️??‍♂️??‍♂️??‍♂️??‍♂️??‍♂️??‍♂️??‍♂️??‍♂️??‍♂️
Social and other public profiles
??‍♂️??‍♂️??‍♂️??‍♂️??‍♂️??‍♂️??‍♂️??‍♂️??‍♂️??‍♂️
? 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

???????????
Referral links
???????????
? 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!