TradingView Pine Script Tutorial 29 – Using Fill Function to Highlight a Chart. Part 2: Conditional

TradingView Pine Script Tutorial 29 – Using Fill Function to Highlight a Chart. Part 2: Conditional

YouTube Video

YouTube Video Transcript

[Music] hey this is David for big bits in this video we’re gonna go over the fill function again for trading view with its pine script and what we are actually going to be doing this time is a conditional fill which isn’t a actual option that’s built in to the fill function itself but what we’re actually going to be doing is making this happen using the code and a couple of tricks to use conditional filling to only show it when we want it to be shown now one of the things you’ll notice from the last video is we compared plots to plots and horizontal lines so horizontal lines but in the last video we were using a plot for the RSI value and we were using a horizontal line to show the over Bhatt and the oversold lines on the RSI indicator here now what we’re gonna be doing in this video is we’re actually gonna have to use a plot so that we can compare the RSI to the oversight or over oversold or overbought lines and what we’re gonna be doing is we’re gonna do a conditional fill where if the RSI is above the overbought line it’ll fill that in between the overbought line and the RSI only when it’s overbought green or red excuse me and then when it’s below the oversold value it’ll fill between the oversold line and the RSI value as green now you’ll notice I took away a lot of the code if you watch the last video so really all we have now is our plot the RSI value for that plot and then of course the values we have set for the overbought and the oversold levels now we’re gonna have to plot our overbought value and we’re going to set that equal to a plot and what you’ll probably be tempted to do is to do exactly this you honey go through here show you this okay you can see this essentially gives us what we had in the last video although it doesn’t have that little gaps between the lines what is actually happening here is you’re plotting a single value consistently over and over and you’ll actually see it here whereas with the horizontal line you didn’t see that value here and we don’t really need to see this line what we really want is we only want to see the fill between the two so we’re gonna have to do a little bit of work here to get this to actually work and the first thing we’re gonna do so we’re actually going to set our display for the value equal to display:none so now it should no longer show that particular value so now we can’t really see what’s going on you can see it still actually prints the value up here but if you want to get this effect you’re probably gonna have to do it this way so what we’re gonna actually have to do is we’re gonna use a conditional plot now we’ve seen this before in the past and it’s very simple so we’re just going to compare our RSI to our overbought and if our RSI is greater than the overbought then we’re gonna plot that horizontal line at the overbought value otherwise we’re not gonna plot anything so I’m gonna save this you still won’t be able to see anything but we should be able to compare it so you’ll see the blue value here where it says n/a that’s where the RSI is not above the overbought value and I’ll actually go ahead and cut the display:none out so you can kind of see what’s actually going on you so it kind of shows you there what’s going on but it doesn’t really give you the best picture therefore what we’re actually looking for now what we’re going to be doing next once we set that display to none we’re gonna be filling between the two and we’re gonna start with our overbought and only when that exists can it show up on the screen so then we’re gonna fill between it and the RSI plot and we’re going to set that color equal to color dot red so this should only show is a fill between 70 and RSI when the RSI is above 70 and I’m gonna set the transparency equal to zero that way it’s standing out very well and you can actually see what’s going on there you go so you can see it did it a couple of times here where it went above the overbought value and it stands out a little bit better in areas where it goes very far overbought instead so really just to do the same thing we can just copy and paste what we have here and replace our values in regards to oversold so we’ll replace our Obi’s with os’s and we’re gonna be looking for an RSI under the oversold value and if it is will return the oversold value and we’ll change this to say oversold and then we will fill between our oversold and our RSI and this one will actually be lob to match our other nice green colors and our transparency is already set so there you can see now we have a conditional field to where when our RSI is above the overbought value it’ll fill between the RSI and the overbought value and then also on the RSI and the oversold value and like I mentioned the last video if you set the RSI overbought and oversold values to an input to where people can go to the settings and change those here then those values can change and you can actually change where the fill actually occurs without editing the code and if you want to know how to do that you go back in some other videos where we talk about inputs and you can get that figured out now if you want to check the reference for pine script you can always go to the pine script language reference manual highly suggest you check this out so you can get an idea of what’s actually going on but other than that I think this is a pretty quick video overall I haven’t really checked the time on it but I think everything went really well there may be another video related to fill I will have to check out a couple of things and see if I actually want to go that direction in the next video but we’ve had two now and that’s pretty advanced for the filling if you’re not familiar with coding this might be a little harder for you to understand or grasp but I think if you’ve been following along with the series you should have gotten what we’ve done today pretty well but other than that that’s it for this video please as always liked this video if you did like the content and subscribe if you want to see more videos like this you’ll get a notification when other videos come out always check out the tradingview profile you can follow me there where you can get updates on my ideas and scripts and of course if you are considering a paid plan on trading view please consider the referral link in the description of the video where you can get $30 and I will also get $30 towards another renewal of the paid plan so that is it for this video I thank you very much I’ll see you in the next one and have a nice day [Music]

YouTube Video Description

< br/> #bitcoin #crypto #cryptocurrencies #tradingview
?⛓?⛓?⛓ ? IMPORTANT LINKS BELOW ?⛓?⛓?⛓?

Social and other public profiles
? Website:
? Discord:
? Twitter:
? Facebook:

Referral links
? Buy, Sell and Trade Crypto on Binance.US with LOW fees:
?‍♂️ Want to buy crypto? Get $10 of bitcoin w/ your first purchase over $100:
? Sign up for a paid plan at TradingView and receive a $30 credit:
? Browse privately and get rewarded with Brave Browser:
? Receive bonus perks when purchasing Lightnite Game:

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.

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!