YouTube Video Transcript
[Music] hey this is David for big bits in this video we’re gonna take a look at strategy alerts this is a new feature added to trading view which allows you to add alerts on to your strategies as opposed to just your indicators or your studies if you’re more familiar upon script as they’re referred to so we’re gonna take a look at that and we’re also gonna look at a small change to pond script for the if statement which basically just enabled the else if whereas before you had to kind of nest things it’s a little bit better now that’s where you don’t have to actually nest everything you can kind of be in line so that’s good and let’s see I have created some custom code here that we’re gonna go over but first it’s probably a good idea to talk about the actual strategy alerts themselves as you can see from the update in their blog it gives you a nice brief overview of what you can expect you can see that there is the typical alert window but what you’re gonna have to do is you’re actually gonna have to create your alert from the strategy tester section and I’ll actually show you this in just a moment and so one thing that’s really important and we’ll go over strategy letters and a lot more detail just the moments is that this alert isn’t like your typical indicator alert it will trigger the alert when the trade occurs or when the order is executed not necessarily when the conditions are first met and that’s probably a little bit confusing but if you’re familiar with the strategies on trading view you’ll notice that the conditions that you’re looking for can basically only be triggered sometimes at the end of candles and the trade doesn’t happen until the next candle so if your conditioners get met on the previous candle the trade doesn’t typically happen until the current kingdom and that might be confusing I know but just keep that in mind that it’s only when your order is executed and that is something that’s very important to know so I’ll actually go ahead and let me add in a strategy here I’m not gonna use the one that we have the code for here just yet because I want to show you just kind of how this works go to one of my strategies and we will go down to one of the tutorials all right you can see here in the strategy tester you can just click add an alert it’s really simple all you do is tell it you know this is your condition which is basically just your indicator or your strategy now looking at this it actually looks like you could probably also do from up here just by selecting the strategy as a condition but you’ll notice you don’t get to choose any other conditions for the actual strategy itself you are limited to when the orders or the trades get executed so you’ll also need to pay attention to the variables in the message if you want custom messages in your alerts now we’ll go into a little bit more detail now I’m going to go ahead and get this off our chart go back to our code and then let’s pull up this now this is their Help section for the strategy alerts and I’ve highlighted some really important stuff that you don’t want to know if you’re going to be looking at strategy alerts now the first one is that if you are using this to automate your trading it can lead to unexpected results because you have to take and count to the limits of how the actual strategies behave on trading view I’ve already kind of touched on that just a little bit but they highlight very importantly some of the main reasons why you should be worried or at least account for the limitations in the strategies themselves so the first one is strategies are more susceptible to repainting than indicators so if you don’t know what repainting is essentially when you’re doing your indicator you’re coding an indicator or a strategy on trading view when you create the indicator it is actually calculated in real time so whenever you plot something on the chart you can also remove it from the chart as well so you can think of that as repainting and you can also think that when you plot something on the chart in real time that say you’re just plotting the price the current price on a line that line on the current bar goes up and down constantly with the price as it moves within the current candle so that’s something to keep in mind that those points can move up and down within the current candle but if you’re only worried about the close of the candle then you can have certain instances where your code could overwrite previous data I know this is typically for indicators but please just pay attention if they’re telling you to worry about repainting you probably need to make sure you test these out thoroughly before you go into any sort of automated trading now none of this of course is financial advice or anything so I’m not telling you that you need to do that but it’s something I think you personally should probably do now they also have talked about their engine managing strategy alerts so this is their back-end service that handles the alerts and it’s not actually connected to your broker or your exchange so they can’t synchronize your orders and positions and that’s something I don’t think a lot of people actually realize so I’ve highlighted in yellow two important parts from this I’m just kind of read these because I memorized everything on here but an order executed on the chart may not be executed by your broker this could lead to a situation where your strategy appears to have closed a losing position when in reality the losing position is still open and the market is moving against you so essentially what it’s saying is you were perhaps in a position and you got a signal to close that particular position but on trading view that shows that it is closed because that’s what that’s how the strategy operates but on your broker or the exchange you’re working with your position isn’t actually closed because the order failed or some other reason prevented it from actually happening so essentially the main thing here is that the positions that you see in the strategy tester and plotted on your chart with the strategy tool those are not necessarily in sync with the day for your positions on your actual broker your exchange so it’s very important to monitor those if you are doing this and the other example they have is if you are holding a short position while your strategy is holding a long position the strategy bin may send a sell order to close a long position when in reality your short position on the broker side will increase so that’s something to keep in mind as well the last major point they have is that an alert will be stopped if it triggers too often as I believe for all types of alerts but the rule is more than 15 times in 3 minutes it will stop it so if you’re trying to do like high-frequency trading like I what’s that like every 10 to 15 seconds or so to get an alert here then you will be kind of out of luck because you can only have so many alerts from this particular hour learned that you’ve set up it can only trigger so often so keep that in mind as well now when do the strategy alerts actually trigger and we’ve talked about this a little bit before the strategy alerts trigger when the strategy executes in order and that doesn’t necessarily correspond to the time when that order is placed so there is a big difference if you’re noticing any difference in your actual strategy and the alerts coming out you can probably pinpoint that to the execution versus when the order is actually play so that’s something to keep an eye on I have not used the strategy lurtz this is a brand new feature so this is something I’m gonna be keeping in mind for myself as well and let’s say we’ve already talked about how to add the alerts and how do the strategy alert to work let me see so we’ve already talked about their back-end service for the alerts the alerts the way that service works if you haven’t noticed this before you’ll this will probably open your eyes to that but when you make an alert it copies essentially your chart with your indicator on it with your alert settings and it basically creates a new instance of your indicator and it will monitor that instance of the indicator it doesn’t monitor the instance of the indicator you have on the chart it it monitors the one that is associated with your alert that you’ve set up so for example the volume indicator down here this indicator this instance of volume indicator is on this chart if I were to create an alert based on the volume there would be another instance of volume created on another chart essentially on the backend in their alert system that keeps the alert settings for that particular instance of the volume and if you change something and that’s what this is all about for any change to your chart strategy settings to be reflected in your alerts behavior you need to delete the previous alert and create a new one that is because the instance of the indicator or strategy that you have saved in your setting settings for your alert doesn’t get updated when you update the instance of the strategy on your chart because they’re two different instances so you’ll have to update it here and then you’ll also have to delete and recreate the alert on the alerts tab itself so that’s pretty important to remember and that actually goes for the regular alerts as well which is something I noticed a while back and I just really haven’t really brought up on the channel before but we’ve already talked about that it triggers the alert when the strategy is executed on the broker emulator and it says notifications are not sent for orders on historical bars so when you first load the strategy on there you’re not gonna get alerts for all the previous bars that it’s back testing for so that’s good to know otherwise you’d get a ton of alerts now the alerts are only triggered for orders executed in real time that basically just reinforces the idea that it’s not for historical bars it’s real time and more than one notification can be issued in the same bar but as mentioned above the alert will be stopped if it triggers more than that many times so yes you can have multiple alerts within the same bar and you can use placeholders just like you can with the alert other alerts with the indicators to customize your alert notification message and one thing you’ll want to pay close attention to is this particular placeholder strategy order alert message excuse me strategy order dot alert underscore message which allows you to create a custom message for the type of order that you’re using so if you’re placing a buy order you can have a custom message for the buy order as opposed to the sell order which can have its own custom message and you can also pass in some of this other information as well and I’ll show you how to actually do this right now and we’re gonna go into the actual script that I’ve written to display how these actual alerts work and I have a little bit of information here basically all we’re doing is we’re going to be entering a position and then after I think it’s 20 seconds it’ll close the position and then it will immediately reopen a position and close it that’s just so that we can get these alerts kind of one after the other periodically just to kind of show you how it’s actually going to work so let’s go ahead and actually add this to the chart and it’s gonna take a second to bring the first one up because I believe it’s gonna wait the 20 seconds initially before it’ll actually throw a sell the way this script was written the first entry was at the very beginning of the maximum candles back in the back-testing or the chart so you can see we had our first one it sold the position from where it opened originally and now 20 seconds from this entry it will close and you’ll notice we’re on a 1 second chart so I do this so you can kind of see things more like they would be if you were looking at a chart in real time over the course of extended periods of time so this way we kind of get to execute in real time but it yeah that way we can get our alerts every second pretty much so you can see 20 seconds after to buy it’s sold and they’re bought immediately again I’m not worried about profits or anything like this we’re just worried about the alerts right now so what we’re gonna do is we’re gonna create an alert and make sure we see select our strategy we’re gonna show a pop-up and instead of showing all of this information actually we will show the position size but we are also going to be showing that order dot alert message or order underscore alert underscore message excuse me it’s going to take me a while use of this okay so every time we get an alert so on every buy and every cell we are going to see the position size and the alert message for the order let’s go ahead and create this it’s gonna come up over here in our alerts section it’ll come up with an alert in our alert log we’ll get the pop-up on the screen but you’ll notice we have two different messages for the buy order there’s a buying message and for the sale order there’s a selling message we should get one pretty soon now after the 20 seconds are over okay and just remember their alert system is running on the back end so even though you’ll see this on these one-second charts it might take couple seconds and that’s exactly what happened so let me actually just click on one of the alerts this was the first one that we got oh it’s not let me open it okay so the message that comes through you can see we got buying because we aren’t in a position and you can see that was the message that we set in the alert message down here and one is the quantity so our position size was one and that is our message and you can see here our message I was hoping I could click on this and see the full thing but you can actually see when I hover over it as long as my head’s not in the way you can see on all of these the position size and then the alert message heard of the order so you can see with that placeholder it actually changes the message based on the type of order that we’ve done so that’s pretty cool and you’ll notice if you’ve been following the tutorial series here on the channel that and let me turn this alert off because I am not wanting to get these anymore okay so you will notice if you’ve done the tutorial series we talked about if statements and we had to kind of nest our if statements within each other now we actually have an else if that we can use that instead of placing our if statement on the next line like this and kind of nesting things further and further if we had more and more logic we can now actually do it in line here and your spacing requirements still remain the same on your new lines but you can just say else if your new condition and continue on and if we wanted to we could just do another else if another else if and you can finally do else and that is the last scenario that you would do with this particular statement but I know there was a lot to cover in this one the strategy alerts are a new feature it can be kind of complicated if you have any questions please comment or reach out on Twitter or disk or Facebook one or the other you can see all the links for those in the description of the video below while you’re down there please like the video that helps a whole lot if you can watch this whole video I would imagine you like it so please also subscribe because I do a lot of other videos like this and you’ll get to see a lot of the updates that come out from training view probably before you’ll see them just about anywhere else for the most part but other than that that is it for this video thank you and have a great day [Music]
YouTube Video Description
< br/> ???? IMPORTANT LINKS BELOW ????
Strategy Alerts in TradingView – Else If Statement Now in Pine: In this TradingView Update we discuss a new feature enabling alerts on strategies as well as a small update in Pine to allow for else if statement to work without nesting if statements. We discuss how to use strategy alerts with custom messages and also some of the downsides to using strategy alerts as well. 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/
? 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!