YouTube Video
YouTube Video Transcript
hey this is David for big bits in this video we’re gonna take a look at some new code that I published review which is called the custom alert scanning intervals into lace framework now this is rather advanced topic for those of you who are actually following pine but it is something that I’ve had requested in other platforms that I’ve just kind of rewritten to be made somewhat capable in pine so you do kind of have to be very mindful of what you’re doing to get it to work the way you would expect but it does work and in the long run that’s exactly what you’re after is you trying to create code that works as opposed to always creating code that’s the most flexible sometimes you just have to create the code that gets the job done so and by that I mean with this particular code it’s really gonna only work when you’re looking at these super small resolutions like one second so if you don’t have a premium plan maybe use a referral and look at getting the premium plan if you want to use this one but you can use it at higher resolutions it just doesn’t really work as well and really before you even think about using it well you really need to understand it so I’m gonna go ahead and explain to you exactly what’s going on here we have set up a custom interval of one between scanning and a delay of 10 seconds between alerts now the interval in scanning just means that we are only going to have the alerts eligible to be fired or scanned every second now here that is the shortest possible time but by default I have it set to 5 and in that case it would only scan every fifth second so let me change that back up here and once it comes back you will get to see that it will count up now if it misses the fifth second it continues to count up because it only can scan on that fifth second so 5 10 15 20 so there is a downside to doing this but if you don’t want to scan continuously for an alert you don’t want to get an alert up to every second then that’s one way to do it now the other option and let me set this back to one is to set the minimum Malay minimum delay between alerts and seconds up to what you want it to be so say you don’t want to receive an alert every minute but you would like to see that every two and a half minutes that would be 150 seconds so on our scanner here our custom delay should start with zero and stay at zero on Thompson / scan because we’re scanning every single second there has been no time since our last scan we’re scanning every second now the second value is time since our last alert and this is what the delay is checking so it’s been 20 seconds as of when that happened since the last alert and what’s gonna happen is it’s gonna wait until that number gets to be greater than your delay of 150 and then it can fire another alert and then the third line here of time this just kind of shows you how many seconds you are into the current minute and it is important to note that if tradingview the feed misses a bar it will not calculate or send an alert on that one but when you’re scanning every single second as long as your delay is met on the next bar it will start scanning no matter what it is as opposed to the intervals it will only scan for an alert on those particular seconds or those particular in seconds that like every fifth every 10 so whatever you set it to so let’s go ahead and take a look at this and actually implement it let’s set this to a 10 second delay make sure everything’s actually working make sure it resets excellent it reset zero and 4 we’re gonna add an alert and to add the alert and make sure you choose alert scanning and we’re gonna want to choose once per bar now it is very important to be mindful as I said earlier about the options you use on setting your alerts and when you’re using a one-second chart and you’re using alerts once per bar it will allow you to receive an alert do every single second now training of you will likely step in at some point and say you know you’re getting too many of these alerts you probably need to change your code and it does do that so you could also choose once per minute but then your delay would need to be greater than one minute because it would only allow you up to one alert per minute anyway so you need to be mindful of that there once per bar closed on this one it’s even more trickier because it’ll only scan on the close and you also have to have the closing time also be the fifth tenth whatever second your interval is as well so if you’re using something like 3:00 or well three is probably a bad example like seven I think if you’re using seven as your interval it’s not gonna line up and match correctly so just keep that in mind as well now we are gonna set this to once per bar and it’s gonna show us the time and UNIX the friendly time but really we’re really looking at is the time on the alerts log so we’ll just kind of ignore the popups we should get one every tenth second once this starts time since the last alerts so we haven’t gotten one yet because the delay and even though we haven’t had an actual alert it knew when the last ler would have been and it kept track of that data so now on our next one should be here in just a second and as I mentioned if it misses the bar and it won’t actually fire the alert so it missed the bar on the 25th second and it didn’t receive another one until the 28th so the alert didn’t fire until then hopefully we’ll get this actually fired correctly now so yes this one did it was exactly ten seconds after you can see our delay is working just fine so I’m going to stop this so that I don’t upset trading view servers and I’m actually going to change the delay to every 15 seconds just to kind of show you how this actually works and we’re going to set the interval to two seconds so it’s got to be at least 15 seconds and the interval is every second second is when it’s going to actually scan so let’s add a new one for this one do the same thing it’s gonna check every bar but not every bar is gonna be eligible and let’s create so using those particular settings it’s gonna start scanning it’s got to wait until at least time since the last alert reaches above 15 seconds and it has to be on the second second so it might not be exactly 15 seconds apart his fan fact it shouldn’t be it should kind of alternate so that one fired it 42 seconds let’s see if we can’t get this one at 57 which that wouldn’t happen so the quickest it can happen is at 58 seconds or on the new minute if that one doesn’t get hit there you go so I said it would happen on the 58 or the new minute it happened to be on the new minute because the bar on the 58 was missed so there you go that’s how you can do it you can get custom delays between it between your alerts that is hopefully some of you can find this code useful and for others maybe it’s useful for kind of understanding things you can always check this out you can go to my profile and go to this group section or you can just search on tradingview for the alert intervals and delays framework that I created that will allow you to create custom delays between them now I did lay out some of the reasons why you would want to do certain things such as use the one-second resolution or set your delay to something greater than your actual bar resolution so just keep things like that in mind and what you could do and an example that I can think of is you do this and you add this indicator to your one-second chart but when you are scanning and you are capable of setting your alert to true what you will do is instead look at your indicators on a higher resolution such as the five minutes or ten minutes and you would see if they qualify for firing the alert that you want and in that case then you would tell it that the alert is true and you would tell it the alert lasts alert time is now and then it would operate as expected and then it would not fire again until your delay and your indicator conditions are met so that’s kind of how you can use this on a one-second chart to really be able to keep up with your alerts now it does work on higher resolution charts but like I said if your delay is too high or your intervals aren’t really there you could have some issues so I really recommend the smaller resolution the better and if you’re on a 1-minute resolution just keep in mind to have your delay greater than 60 seconds otherwise there’s probably gonna be issues and it’s gonna act funky because it doesn’t have access to the last alert scan time within the same bar on a 1-minute resolution and that would be the same even on a one-second resolution if you were able to update your indicator multiple times within that one it’s just the data is refreshed and since it wasn’t saved in the last bar and you’re still on the current bar it kind of restarts the calculations from the indicator currently and your data isn’t saved on a previous bar or isn’t saved on the current bar because it reset so it’s really gonna mess things up if you do that but hopefully you all have gotten something from this and as always check out the pine script reference manual if you have any questions on any code that I actually did if you do have any questions you can leave a comment here or always on the script on tradingview and let’s see that’s about it you can check out my profile on tradingview there’s link for it in the description and if you liked the video please leave a like appreciate that and if you liked the video you’re obviously into some pretty advanced pine script stuff and you’ve watched it this far so please check out the pine script tutorials and subscribe to the channel because I also do other tradingview and pine script related videos on how to do certain things and starts off for beginners but it gets more advanced into some topics kind of like this as well so other than that thank you and have a great day [Music]
YouTube Video Description
< br/> ???? IMPORTANT LINKS BELOW ????
Custom Alert Delays on TradingView! Also Custom Alert Scan Intervals!: In this TradingView update we discuss new features introduced into TradingView. By default, you are only given four options on when alerts can fire in TradingView, and always scan for alerts on every update. The code I share with you in this video explains how it is possible to create a custom delay or period of time between alerts in TradingView that is not available by default in alerts. You are also shown how to set custom scan intervals so that alerts can only trigger every X seconds. 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!