00:00Let me give you a scenario and see if this is familiar to you.
00:02Your Algo strategy has identified a trade opportunity.
00:04All the rules of the strategy were fully satisfied and the Algo now
00:07confidently goes ahead and places the buy order.
00:09Within a few seconds, the price reverses and your SLS hit.
00:12Sounds familiar, right?
00:13Well, this is the story of most new Algo traders.
00:16In this video, I'll explain one of the most common reason why this is happening.
00:19We'll also talk about the TradingView's best support and resistance indicator
00:22and how it can help the situation.
00:24We'll walk you through its Python version that I built.
00:27I will also explain how you could use this Python utility for free.
00:30in your own Algo and say goodbye to bad trade entries.
00:32So let's get started.
00:35This is your first time here.
00:36Welcome.
00:36My name is Vivek and I'm a financially independent Algo trader.
00:39This channel is all about building a community of Algo traders.
00:41We discuss everything about Algo trading using Python, building and practicing
00:44trading strategies, market updates, and much more.
00:47Please do visit our community website fabtrader.in.
00:49Also do check out my other YouTube channel, Fab Wealth, where I talk about
00:52my own financial independence journey and share tools, methods, and strategies
00:56that help me achieve my financial freedom.
01:00During my initial days of Algo trading, I used to run into that scenario very often.
01:04I used to think I have the perfect strategy.
01:06I've backtested it multiple times.
01:07My confidence was high.
01:09And yet when the first order went out, within a few seconds, the price reversed and
01:12my asset was hit, right?
01:13It was a bit frustrating because the win ratio was nowhere closer to what it looked
01:18like when I was backtesting it.
01:20I know there's nothing wrong with the strategy.
01:22There's nothing wrong with the timing of the trade as well.
01:24But what I did find out is that the problem was with the price point at which the order
01:28went out.
01:29Most often what happens is the buy order is placed very close to an existing resistance
01:34line.
01:34So when the price starts moving, it hits that resistance.
01:38And then even if it is temporarily pulling back, your SL would hit and then the price would
01:43start continuing in that direction that you wanted it to.
01:45Similarly, in case of a sell order, if you place it very close to a support, you would
01:49end up with the same situation where the SL being hit.
01:53When I was looking for a solution to this, I came across this particular wonderful trading
01:58view indicator called the support resistance dynamic by the Lonesome Blue.
02:00I'm sure you are aware of this indicator.
02:02It's one of the most popular indicators on trading view and one of the most simplest
02:06and the accurate indicators that you can come across.
02:08The way this indicator works is very simple.
02:11All it does is basically looks at all the turning points of the prices.
02:15And then generates these various pivots.
02:17And then it also generates channels, equal sized channels.
02:19And then more pivots within that channel indicates that, you know, there's a lot
02:23of, there's high chances of price basically turning back because in the history that
02:27that particular zone acted as either a support or a resistance.
02:30And based on that, this indicator draws these SR lines.
02:34And when I paper tested it, it worked wonderfully well.
02:36But now the only problem is this is in PineScript and this is on trading view, but my
02:40algo platform is based on Python.
02:42So there was no way I could use this indicator directly there.
02:45And that's when I had to basically sit down and rewrite the spine script into Python.
02:49And this is the Python code for that indicator.
02:53It simply requires NumPy and pandas as dependencies to be installed.
02:57And the way it works is pretty simple.
02:58You give it a symbol and then you, you say what timeframe you need this on.
03:03Right now I've given a daily candle and then you can even go as low as five minutes.
03:07And then it'll still work.
03:08And then once you run it, it'll provide you the support and resistance levels as seen on
03:14the trading view indicator.
03:16This code is available for you to freely download this from our community website.
03:19I'll provide the link as usual in the description.
03:21The only change you might have to do is currently I'm using Xeroda to get historic data.
03:26So depending upon which broker you're currently using, you know, you may want to change the
03:30code a little bit to get the historical data.
03:32So this, this particular line is what you might have to change this.
03:34This function is, you'll have to replace it with your own function to get the data.
03:38Apart from that, the code works just fine.
03:40Now that the code is run, let's try and compare what we got here and see if this is
03:44accurate with what we see on trading view.
03:48Well, on trading view, we have these five levels and this is exactly what the, the
03:51Python also provided us.
03:53So we know that the, the exact numbers match.
03:55So we know that the code really works.
03:57So now that you have the code, you can run it on your own for various instruments.
04:01And then please do give me some feedback on how this is working.
04:06Well, now that we know that the indicator is there, the Python version works and all
04:09that, the question now is like, okay, how do we really use this in your, and I'll go.
04:13Right.
04:14So the way I'm currently using it is there is a small function, which takes in the
04:18symbol that I want, and then the price point at which I'm trying to, you know, enter the
04:22trade into, and then the, the, the function basically checks if it's very close.
04:26If it's a long trade, it will basically, obviously look for all the resistance levels.
04:29If it is a short trade, it'll look for all the support levels.
04:31And then if my price, the entry price or requested price is very close to any of the
04:36levels, and then it basically returns back either a true or a false, confirming whether
04:40I should go ahead with the trade or not.
04:41Based on that, the Python is already coded in such a way that it tries to avoid such
04:45trades, and thereby, you know, you, you avoid some, some bad entries.
04:49In case you want me to, you know, provide that code as well, the code that I just talked
04:53about, please do mention that in the comment.
04:55If there's enough interest for it, I'll create another video where I'll also provide you the
04:59entire code, which can do all of that, the spot checking.
05:03And then you can, you can just take that and plug it into your respective values.
05:07If you genuinely found this video useful, please consider subscribing and liking the
05:10video and I will see you soon in another video.
05:12And until then, take care and happy trading.
Comments