- 1 day ago
Category
📚
LearningTranscript
00:00Hello everyone, today we are starting a new series of videos that is all about backtesting
00:03strategies.
00:04Some of these strategies are mine and some are from other popular YouTubers.
00:07In this video, we are going to be backtesting a strategy.
00:09By one of my favorite YouTubers, Mahesh Chandra Kaushik, Mr. Mahesh is well known for his
00:14simple approach to trading and he usually advocates a very slow path to wealth building, but a
00:19steady one.
00:19I use a few of the strategies and those are still working fine even after a couple of
00:23years.
00:24We will take a look at a zero.
00:24We will never lost itraday strategy.
00:25I will explain the rules.
00:26We will also share the Python backtesting code with you and I will also show you how to
00:29the results of these strategies performance.
00:30So let's get started.
00:34it's your first time here. Welcome. My name is Vivek and I'm a financially independent
00:37talco trader. This channel is all about building a community.
00:39We discuss everything about algo trading using Python, building and backlisting trading
00:43strategies, market updates.
00:44Please do visit our community website fabtrader.in. Also do check out my other YouTube channel
00:49Fab Wealth.
00:49Where I talk about my own financial independence journey and share tools, methods, and strategies
00:53that help me achieve my financial independence.
00:55The name of the strategy is zero loss or the pivot price.
00:59As I had mentioned, this strategy was originally proposed by Maharshandar Kaushik.
01:04If you don't know who Maharshandar Kaushik is, I suggest you take a look at his YouTube channel.
01:09He's one of those.
01:09He's one of those down to earth, genuine financial educators on YouTube.
01:12His strategies are usually very simple.
01:14risk and also very well tested before it is revealed.
01:17Let's take a closer look at the strategy.
01:19It's an...
01:19The strategy strategy and it works on the five minute candles.
01:22You can take both long as well as short.
01:24...spons on this.
01:25In terms of the indicators used, there is a custom indicator, which is again, part of
01:29the...
01:29strategy itself, which Mr. Mahesh has proposed. It's called the pivot price point. I'll tell
01:33you how to build that indicator.
01:34And this strategy needs to be traded on the cash segment only, no options, in terms of
01:38what stock universe.
01:39He's proposing that we only consider the top 10 market cap stocks.
01:44And the reason why he's selling is, I mean, these top 10 are major ones and they're less
01:48prone.
01:49To be manipulated.
01:50This strategy requires that you pick up stocks that cannot be manipulated and that's why.
01:54Now let's look at the pivot price calculation, which is the indicator that I talked about.
01:59The approach is quite simple at 11 AM every day after the market is open and.
02:04It's a couple of hours gone.
02:05The market has settled at 11 AM every day.
02:07You would need to calculate the pivot price.
02:09This point and how this is calculated is it's an average of these three values, which is
02:13yesterday's close value.
02:14of the stock.
02:15Today's intraday high.
02:16So at 11 o'clock you have a cutoff, right?
02:18So intraday high that.
02:19It has reached before 11 o'clock from 9 15 is what's today's intraday high.
02:22And then you also need to consider today.
02:24Intraday low.
02:25So you add all these three values and you divide by three, which is basically an average of
02:28all these three that.
02:29That will give you the pivot price point.
02:31So if that the current price at 11 AM, if it is up.
02:34above this pivot price point, then it is indicate indicative of a bullish market.
02:39So.
02:39You typically take long trades only.
02:41And then if the current price is less than the pivot price point, then you go.
02:44short.
02:45That's how simple it is.
02:46If this is all a bit confusing, please don't worry.
02:48Just follow.
02:49I'll give you a real life example on a chart and explain how this is all done.
02:53So for now, just, just take it.
02:54the information that I'm giving right now.
02:56In terms of the long trade, the strategy rules are pretty simple.
02:59As mentioned, the, at 11 o'clock, you calculate the pivot price.
03:03If the current market.
03:04price of that stock is greater than the pivot price.
03:06Then you're ready to take a long position.
03:08In terms of.
03:09price management and the position sizing, 10,000 rupees per order is the limit.
03:12Do not cross that for every trade.
03:14And then what Mr.
03:15Mahesh suggests that.
03:16Is that we keep around 5 lakhs for each stock that you.
03:19are planning to trade out of the 10 as the overall capital.
03:21It seems a bit high, but what he really explains is that.
03:24you know, this, this strategy works the best, uh, by, by having a larger capital.
03:28And then it will be very clear.
03:29why he's doing that in the next slide.
03:30But for now, you know, you could, you could consider this in terms of the exit conditions.
03:34And then the intraday target percentage is about 0.7%.
03:37So if you exclude all brokerages and fees.
03:39You typically end up at around 0.5% target for the day.
03:43Uh, there are currently no.
03:44Stop loss for the long trades.
03:45Uh, if the target is not achieved by the end of date.
03:48Uh, if the target is not achieved by the end of date.
03:49You take delivery of that stock.
03:51And now the rules for the short trade.
03:53This is slightly.
03:54different.
03:55Uh, for a short trade, three different conditions have to be satisfied before.
03:59You can take a short trade.
04:00Number one is the current market price should be less than the pivot price point that we
04:04are.
04:04already calculated, which we already know.
04:06And there are already holdings for that stock.
04:09So it's very important that, you know, the, the stock that you're trying to go short, because
04:12at this point in time, you've decided that you're going to go short.
04:14But you cannot go short until there's already some holding, uh, that you've taken delivery
04:18off, you know.
04:19in the previous steps, right?
04:20If you haven't had any, you know, uh, taken any deliveries and you don't have holdings,
04:23you basically skip that.
04:24Right?
04:25So you need to have holdings for that stock.
04:27Number three is within the holdings for that.
04:29stock that you already have the overall position or the profit position for that holding should
04:33be at least 0.7%.
04:34So hope this is clear.
04:35If the current market price is less than pivot price.
04:39point, then you're going to go short.
04:40But before you considering taking a short position, you need to have enough.
04:44holdings for that particular stock.
04:45And the overall profit position of that holding should be more than 0.7%.
04:49The position sizing, the same rule applies, which is 10,000 per order, uh, is the limit
04:53that you need to consider.
04:54Exit conditions.
04:55Again, the intraday target of 0.7%.
04:57Uh, and these.
04:59Stop losses intraday high.
05:00If the target is not achieved before the end of the day.
05:05For that short, short position.
05:06All you need to do is just simply take delivery by selling from your holdings.
05:09Remember.
05:09You already confirmed that you have holdings, uh, for that particular stock.
05:12So just in case your target is not hit, you simply.
05:14Take delivery and sell off your holdings since you were already in profit.
05:17Uh, so the net lost you.
05:19To this rate should be compensated.
05:20That's the overall idea.
05:21So now you, you get the overall idea as to why he calls it zero loss.
05:24It's because you, you don't really on a long position.
05:27You don't really cut off the trade.
05:28You don't have a stop.
05:29Loss whenever you don't get a target.
05:31All you need to do is just take delivery of it because these are all top 10.
05:34market cap stops.
05:35These are quality stocks.
05:36So no, no, no problem in basically holding onto that units.
05:39But when you're going short, you always make sure that you have enough positive holdings.
05:42Even when you don't meet the target, all you can do is.
05:44You just simply sell off those stocks and you will still be, you know, not making a loss
05:47out of it.
05:48So that's the overall reason why it's called a zero.
05:49The overall strategy.
05:50Let's take a look at an example on the chart itself.
05:53This is HDFC bank.
05:54on the 20th of March, 2025.
05:56This is a five minute chart.
05:58This is the start.
05:59This is the end of the day.
06:00This is the end of the day.
06:01And this line here is the 11 AM cutoff time where we actually start.
06:04the strategy itself.
06:05So at 11 AM, we calculate the pivot price point, which is nothing.
06:09But the previous day close, which is this value.
06:11Plus the intraday high, which is this value because at 11 AM, this is intraday.
06:14And then the intraday low is this value, this white line below and you add all of that.
06:19You divide by three.
06:20The average is 1750.1.
06:22This becomes your pivot price point.
06:23And this yellow line.
06:24And indicates that pivot price point, right?
06:27So at 11 AM, since the price is above the pivot.
06:29It's eligible for a long entry.
06:30Had this price been below this, this paper price line, then.
06:34You would consider doing short entry.
06:36So the trade is taken at the close of this scandal here.
06:39And then as you can see, you know, the target of 0.7% was achieved on that particular day.
06:44If you haven't joined our telegram group, please do so.
06:46I share market insights, algo trading tips and new video notifications.
06:49And this way you can stay up to date with our community news and events.
06:52Here's the Python implementation of the back.
06:54This is an interesting software.
06:55I'll provide the entire code along with the blog article.
06:58I'll provide the link in the description.
06:59So you can feel free to download this and then run as many back lists as possible on your
07:04site and verify my results.
07:05The dependencies, you don't need much.
07:08All you need is just pandas.
07:09Here's where all the list of stocks that I talked about, the 10 top market cap.
07:14Once I've already coded this in here.
07:16The second input that you need is to start an end date.
07:18The period.
07:19In this case, I've chosen 2024 from the 1st of January until the end of March.
07:23Those three months.
07:24The starting portfolio has one back.
07:26To keep the overall video short.
07:28I'm not going to.
07:29I'm not going to walk you through the entire code because that will take quite some time
07:31now.
07:32The only place is.
07:33I'll.
07:34I'll just tell you the 1d things that you'd probably have to change is only these particular
07:38lines where I've already cleared.
07:39year market.
07:40You'd have to maybe replace this with your own functions here to get historic data.
07:44I'm currently using zero there.
07:45So I have my own functions written here.
07:46Whichever broker that you're currently using.
07:47Accordingly, you just insert your own.
07:49function here to get the candlestick data.
07:51That's the only change that you have to do.
07:53And once you run it.
07:54This is the summary.
07:55The back to summary that you get.
07:56In this case, for those three months that I mentioned, they were close to.
07:59610 trades taken out of it.
08:02607 are already complete.
08:03Three are basically open.
08:04Because at the end of the STP.
08:05There are three.
08:06They're still open.
08:07Or the 607.
08:08438.
08:09And you have to look at the ending trades.
08:10Which means that for some of the short trades, SL was it?
08:12Right?
08:13So your overall win rate is.
08:1472% not bad. And then if you look at the gross VNL, just 21,000, almost 20.
08:1922,000 on initial capital VNL, which is pretty good.
08:24Given that, you know, you're taking too many trades, almost close to about 10 trades a
08:27day. So you're paying close to what's.
08:2912,600 rupees on brokerage, I've considered zero the brokerage here.
08:33Even considering brokerage.
08:34And fees and everything.
08:35You're still making a decent 9,354 at the end of the end of the, you know.
08:39The standard Python output from that backtest.
08:44Everything is very difficult to read.
08:45It doesn't really convey a story.
08:47So what I use usually do is you say.
08:49Take the output from that and then feed it into one of my, the performance analyzer that
08:53I built.
08:54So this way I can visually see how the strategy is performing.
08:56You know, it gives me a lot more clarity than just.
08:59I'm looking at those raw numbers.
09:00So in this case, it's the same numbers, right?
09:02The 607 that we looked at for 438 out of it.
09:04It was a winning trade.
09:05So overall about 72%, you know, win rate.
09:08And then it.
09:09You know, the brokerage, the net DNL is all quite visibly, clearly available here.
09:13And then if you're somebody who.
09:14wants to go deep dive into the actual, you know, the key matrices, the backtest matrices.
09:19There's a wealth of information provided here.
09:21You can take a look at it later on in the video.
09:24But at a very high level, the equity curve looks promising.
09:26So the white portion is the Nifty 50, how Nifty 50 performed during the.
09:29same three month period.
09:30And this brown period is what the strategy performed during that three period.
09:33You will see quite.
09:34a steady growth of the equity curve, which is quite very healthy.
09:37And then if you look at the month.
09:39wise returns, these are the month wise returns close to about 9.7% in the end of the day.
09:43And.
09:44the drawdown also looks not, not very bad.
09:46look at the strategy versus benchmark.
09:49difference.
09:50During the same period, Nifty made about 3.1%, but the strategy made about 9.7, which is.
09:53is roughly.
09:54three times what the benchmark did.
09:55So the verdict is, is that this strategy beats the, you know, the.
09:59benchmark, which is Nifty.
10:00And then the entire trade book is also available.
10:02So the red ones here, you see.
10:04are all the ones that went into a loss.
10:06Mostly those are short ones because only short have.
10:09top loss.
10:10The long trades don't have.
10:11So if you ask me, the overall strategy looks actually good, not bad.
10:14at all because it's still giving you a canker of about 31% after considering brokerages.
10:18Your equity curve is.
10:19very smooth compared to the Nifty.
10:21It's, it's very smooth and it's very continuous.
10:23Drawdown.
10:24It's very, very minimal, you know, less than 2%.
10:26Very manageable.
10:27If you look at the D sharp or the sorting.
10:29You know, ratios.
10:30The numbers are very healthy.
10:32Overall, I think this strategy is good.
10:34But however, if you remember that we've only done, you know, only a couple of practice
10:37here for a very short period of time.
10:39This is in no way a recommendation for you to start using this.
10:43This is only for education.
10:44For educational purposes.
10:45So I would strongly suggest that, you know, you run your own tests.
10:47Please do not take this as recommendation.
10:49Again, and then once you run those tests for various time periods, please do comment and let
10:54me know how it went and what else you found so that we can share it to the rest of the community.
10:59Hope you like this strategy.
11:00If you'd like to see more content like this, please do like this video and that will motivate me to keep doing this.
11:04If you'd also like to share some of your strategies with the community or you'd like me to backtest any of your strategies.
11:09Please do email me with the details and I'll do my best.
11:12If you genuinely found this video useful, please consider.
11:14subscribing and liking the video and I will see you soon in another video.
11:17And until then, take care and happy trading.
Comments