Custom Candles and Custom Bars on TradingView with Pine Script

Custom Candles and Custom Bars on TradingView with Pine Script

YouTube Video

YouTube Video Transcript

[Music] hey this is David for big bits in this video we’re gonna talk about plotting your own custom candles on trading view using pine script and we are going to share with you a very simple script I’ve already published it and we’ll talk about that a little bit more later but the first thing you’re gonna have to learn is to hide the built in candles on the trading view chart and it’s actually very simple and the reason you’re gonna have to do that is because when you add the custom candles to your chart it’s gonna be overlapping or in this case it looks like it’s underneath of the built-in indicators so I’m gonna hide the custom ones and show you how to remove the built-in ones just go to the settings for your chart and then you need to uncheck the bodies and I change the color of the borders just so you can get an idea of what that element actually is on the chart because by default you probably don’t really tell that it’s actually there so uncheck the borders you can see those are now gone and it also uncheck the wicks so now none of the built-in candles are plotted on a chart you can actually show your custom candles using the script now the script itself is actually very simple there’s really only one line of code that handles plotting the actual candles and that’s because it’s just a single function but in order to plot that we have to calculate our own open high low and close otherwise what’s the point of using your own custom candles in that case so what I’ve done is I’ve created these custom candles based on the whole moving average that’s why I call them the whole candles there are two settings for these whole candles there is a length in a closed length the length is the length for the whole moving average used to calculate the values and then the closed length is just for a simple moving average used to plot the closing price on the chart and by default it’s set to one that way you’re always looking at the close price of the actual candle because we’re not plotting both sets of candles on the chart at once and these candles that we’re creating by custom are necessarily representative of the actual values of the candles they might be good for finding trends so what we’re gonna do is we are going to plot those candles but we also want to plot the actual price that way we know what’s actually going on even though we aren’t looking at the regular candles so our close price on our custom candles is different than the actual close price on the candles and we can use the difference in those to maybe find a trend so that’s just an example of how you can actually use it and you can see I’ve calculated the open high low and close down here these are just all whole moving averages respective of their properties using the 10 period length by default so we’ve calculate our o CH and L here in that order and I’ve also calculated a whole moving average for the ohlc for using the same HMA lengths and the reason I’ve done that is because I wanted to see the trend by calculating this because when you’re using whole moving averages your values can cross up and down those are just moving averages so in order to find an actual trend I needed to track one particular value instead of trying to keep up with all four of them well we kind of are keeping up with all four of them but what we’re doing is we’re just using that built-in ohlc for and getting its whole moving average to determine which way the trend is and you can see we set the body of our candles that color to green when that ohlc four-hole moving average is greater than its last value so when the ohlc four is moving up the candles are green when the ohlc four whole moving average is going down the candles are red so the trend here that I’m highlighting is up that means the ohlc four is rising and all these candles and you can see the actual price relative to the candles plotted using those whole moving averages and you just kind of think of these candles as kind of like a ribbon although you’re not actually looking at our ribbon you’re actually looking at those candles just in a different relationship than you normally would with the actual price so it’s kind of an odd concept the way I’ve done this but the whole point was just to show you how to plot your own custom candles and really all you need to do is calculate your ohlc ohlc and I almost said OCLC ohlc for again excuse me and you also need to determine the body color of your candles and then you can plot your candles using the plot candle function now I’ve also used the plot function again for that closing price but the plot candle function is very simple I’ll go ahead and pull that up in the reference manual and there’s a few other features to it that I didn’t show you or aren’t a part of that script I am gonna show you those now though so let’s see that is actually plot bar I need to go to plot candle will talk about plot bar in just a moment on plot candle you can see we’ve passed in our OLC we’ve given it a title and we’ve give them a color but you can also give it a wick color you can also give it a border color you can also tell it whether its style is editable you can show the last certain number of candles only or you can totally just remove the display of it entirely so the wick color and the border color are pretty self-explanatory we talked about those elements earlier the borders and the wicks so that’s kind of what those are if you’re curious about that you can play around with it on your own but the editable that references whether or not the style is editable so you go to the settings for your indicator and this would not be editable if you set the editable property equal to false and that’s a hard word to say over and over now the show last that’s exactly what it sounds like it’ll only show the last X number of candles that you define so if you want to show the last two candles only it would just show these two and finally the display if you set that to display dot none it wouldn’t show anything otherwise it defaults to displayed at all and it shows everything so it’s actually pretty simple stuff to consider but one thing you also need to note are these remarks down here they’re actually pretty important especially when I did my calculations because with like a ribbon type calculation the way I’m doing this the high the HMA of the high isn’t necessarily always going to be the highest value I know it sounds kind of silly but if I had use another something else on here and in this case probably the high the HMA of the high is probably going to be higher than all the other ones every single time but that might not be the case if you were doing something else so just keep in mind that even if one value of open high low or close is equal to not a number then the bar doesn’t draw so if you put in if you have a calculation or you forget to pass in and ohlc it’s not going to plot the candle itself now this is the one that I was really trying to get to the maximal value of open high low or close so even if you told your candle that your low was the highest value out of your OS C properties then the low would actually be set as your high so it would be very weird but at the same time the low is also set to the lowest value the minimal value of all of those as well so it kind of figures out the top and the bottom of the candle for you on its own just kind of figuring out where the actual body of the candle starts and ends is still kind of subject there but finding the top and the bottom which is very important when you’re passing in this information it does that very well so just something to keep in mind if your calculations are different now I also talked about plotting custom bars and that’s actually really simple in this case we can just change our function to plot bar I can save that and it’ll convert it to a bar plot and you can see that here it’s not necessarily my favorite so I’m gonna switch it back to candles but really it’s pretty much the same thing as plotting candles just go to the pine strip reference manual and I kind of hinted at this foreshadowed perhaps the function is just above plot candle and the reference Mayo you can see all this stuff here it’s pretty much the same thing except there aren’t borders and there aren’t wicks you just have a color otherwise for the most part it’s pretty much the same thing including the remarks of the tops and the bottoms of the bars some I think that will do it for this particular script and showing you how to do custom candles and custom bars but if you want to see this script you want to actually use this script you can actually go to my profile on trading view it should be in the description of the video click on scripts and you should be able to find that script here you should also probably be able to search for it in the public library when you go to add an indicator but it might not be indexed just quite yet so yeah it’s just in my scripts right now so it may or may not be available by the time the video is published on YouTube but it should be available in the public library if not you should always be able to find it on my trading view profile you can go there and you can find the source code there as well and while you’re there go ahead and like the script please that helps a whole lot other than that check out the pan script reference manual that does it for the video and while you’re thinking about liking the whole script like the video too please help a lot while you’re thinking about likes that seems to make sense but also if you’ve liked the video that’s another good reason to like it but if you’ve watched this video so far and assumed you would like it if you’ve watched it this far otherwise you probably just forgot about it playing in the background somewhere but if you haven’t and you’ve actually watched the video please subscribe because if you’ve watched it this far through you’ll probably like some of the other videos we do wherever you Pine script tutorials we keep up to date with new features on tradingview new features in the pine script code so when they update that will cover that so you’ll know what’s actually going on with training view them with pine script as well so I thank you for watching the video but yeah that’ll do it thanks and have a great day [Music]

YouTube Video Description

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

Tuples In Pine – TradingView Pine Script Tutorial/Update: In this TradingView Pine Script Tutorial we discuss how to plot our very own custom candles on a chart by plotting custom O, H, L, and C properties of candles. Once we learn how to plot our own candles, we can easily change this to also convert to bars. 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://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!