TradingView Pine Script Tutorial 27 – Using Line Breaks in Labels and Alerts. Persistent Script Warn

TradingView Pine Script Tutorial 27 – Using Line Breaks in Labels and Alerts. Persistent Script Warn

YouTube Video

YouTube Video Transcript

[Music] hey this is David for big bits and in this video we’re gonna take a look at using line breaks and labels and also in alert conditions so that your text can be formatted a little bit better and look a little bit nicer when you’re looking at it on the screen or whatever device you’re gonna receive your alerts on as well so it’s actually very simple all you really need to do is within your message you need to use a special character or a special set of characters which is the backspace and n I’m going to remove my head so that you can kind of see this a little bit better so we have printed a label here and this is actually a persistent warning which is something this other video is also about and we’re gonna show you a warning on this particular indicator by default and if there’s some reason you need to share a warning with someone this will keep the warning always in this position on the indicator because what you really probably don’t want is if you’re giving a warning you don’t want this message to kind of slide back and disappear over time if you want someone to actually see it you want it to be persistent and then also I’ve given it the option to disable that warning so it’ll disappear too but that is not really what I’m focusing on first we’re gonna focus on these line breaks now the label itself we have this particular message and what I noticed when I first did this is that the message was so long it looked ridiculous it ran off the edge of the screen so to fix that we had to use a line break and wait to do that we had to use backspace backslash in excuse me and keep in mind if you use the spaces there they will be added to the end or the beginning of the particular lines so your alignment might change if you leave those spaces in there so I took the spaces out between the word and the line break that is something that’s up to you of course and also did a double line break here so I gave it some space in between the end of this message and this one so that it was pretty obvious this is a new paragraph now this isn’t always necessary this is something that just might come in handy for him but we’re also gonna take a look at alert alert conditions and line breaks in alert conditions as well so in order to do this you have to create an alert condition and if you’re not familiar with those I’ve made plenty of videos about those I’ve actually made at least two videos about alert conditions and we’re going to create an alert that’s going to fire and it’s going to show what the line break looks like in an alert now I’m going to go ahead and set this alert up for you I’ve actually already had it set up so I’ve already selected our indicator we’re using and then I’m also slight in this condition we’re not worried about any other ones and we’re going to show a pop up but I’m also gonna send myself an SMS and I’m not actually going to show you this on the screen so that you can kind of get an idea of what it’s actually going to look like now I’m going to hit save it’s gonna take a moment and then the alert will fire because it’s always set to be on so the alert is going to turn on it’s only gonna happen once so it’s not gonna keep doing this but it’s gonna fire immediately then you’re gonna see what it looks like in the alert message you’ll see the line breaks actually work in this text box here but pay attention there you go the alert fired and this is what a line-break backslash-n looks like in an alert now on the popup message here on this little modal pop up on your screen there isn’t really any line break actually occurring I’ll kind of mention this to trading to you to see if they can actually fix that I’m not sure why it wouldn’t work but we’ll see and this does actually work outside of that so I’m gonna bring my head back on here while that’s alert is up I’m going to show you once I change this let me hold my phone up to the screen and then we’ll zoom in uh there we go switch to this one okay try and hold my hands still here can see there is line breaks in this particular example on your text messages so if you wanted to use your line breaks you can do that and you’ll actually see those and your other messages with your alert condition so it’s actually pretty cool now back to the warning message the way to do this and you can always reference this script to get the code for this but I have an input to show the warning message and by default it’s gonna be true that way whenever they add the indicator to their chart they’re always gonna see the warning message and if you’ve seen my last video you’ll know that the reason this warning message is on here is because in certain situations when we’re comparing one security to another they might not produce a comparison because the bars in cryptocurrency might not match the same bar times with traditional markets because the traditional markets closed and crypto currency trades 24/7 so you might have a bar for Saturday in crypto currency where a traditional market doesn’t because it’s closed then you can’t really compare those so it’s not going to plot those so that’s the reason why this is showing on this one and I gave it an input to show or not I’ll show you how we do this we’re just going to use a simple if statement if our show warning is still set to true we’re gonna create this label we’re gonna put our message in here and we’re going to set our colors and stuff if you want to make this stand out more as a real warning you can do that as well but the important thing is we always have this set to occur on the current bar index but if you do not update this it’s either going to continue to print a new label every single candle and they’re gonna keep sliding back and keep printing more and more labels but the way to fix that is you use the label delete function and you always delete the one from the last candle that way when a new candle starts this one gets deleted and the one on the next bar index will pop up that way it’s going to be persistent and always show up at the current position on the indicator and to they go into the settings uncheck show warning and it’s gone and that’s also why I put the little message at the end disable this message in settings because if they don’t want to see it they can just uncheck that there and that’s all there is to it so in this video we talked about our line breaks in our labels and also in our alert conditions but we also talked about a way to add in this kind of persistent message in our chart as a warning or whatever you might want to do so that it doesn’t disappear and it’s always at the front and getting the attention of the user now the the indicator itself that I’m using I talked about in the last video I might have already mentioned that you can find it and be publicly available in the indicators so you can just search for any security and it should be out there is it case sensitive okay maybe I haven’t published this one I don’t know or maybe it’s just not cashed yet but you should be able to find this one in the Public Library it’s going to be published publicly and that should be all there is to this video if you have any questions please leave a comment so or if you have any ideas or suggestions for other videos please leave your comments in the just in the comments section there’s also plenty of links in the description for the video for other things you might want to do such as checking out my trading view profile where you can see the other scripts that I’ve created here and you can also follow my profile and kind of give you updates when things happen with the account that is about it for trading view but oh wait there is one more thing you can always check out the referral link that’ll give you $30 if you decide to use a paid plan on trading views so if you’ve been following this series and you want a paid plan you can use the referral link and you get $30 towards your next paid plan and so do I yeah that’s it for trading view I almost forgot about that that’s kind of important for me other than that if you liked the video please like if you liked the video then why not subscribe I do these videos pretty often and there’s all sorts of ideas and I like to listen to viewers I’ve created several indicators and videos based off of what viewers have said so subscribe and check out the latest videos I definitely appreciate it but other than that thank you 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!