Skip to playerSkip to main content
  • 1 day ago
Transcript
00:00Hello, everyone. Recently, one of our community members had sent me an email
00:04containing an intraday strategy and it asked me for my opinion on it and also
00:08requested me if I can build a Python based automated scanner for it. I had
00:13taken a quick look and based on a few paper traits, I found it interesting and
00:17the results surprising. In this video, I'd like to share with you the strategy,
00:22its rules, and also show you a neat little Python based screener that I
00:26build that you could also use. I'm sure you're just as excited as I am, so let's
00:31get started. If this is your first time here, welcome. My name is Vivek and I'm a
00:36financially independent algo trader. This channel is all about building a
00:39community of algo traders. We discuss everything about algo trading using
00:42Python, building and backtesting trading strategies, market updates, much more.
00:45Please do visit our community website fabtrader.in. Also do check out my other
00:50YouTube channel fabwealth, where I talk about my own financial independence
00:53journey and share tools, methods, and strategies that helped me achieve my
00:57financial freedom. Thank you.
01:00Let's take a quick look at the strategy. I named it reverse gear. Shortly you would
01:05understand why I gave that name to it. As I had mentioned, this is an intraday
01:09strategy and it is a mean reversion strategy. I usually prefer trend
01:13following. I usually don't do a lot of mean reversion strategy because of the risk
01:16involved. But however, this one looked very interesting based on some of the
01:20preliminary tests that I did. So that's the reason why I'm sharing it with you.
01:23It is going to be on a five minute interval timeframe. And then the trade
01:29direction, you can actually take both long as well as short. The key indicators
01:33that we are going to be using is the 20 EMA. And then we are also going to be
01:37using the slope of the EMA to figure out, you know, to filter out trending stocks. In
01:43terms of how you want to trade, you can actually do it on cash segment as well as
01:46options. Although if you're looking for stock options, as you know, liquidity
01:52issues still exist. If it's an index, it'd still be okay. But stock options, you
01:56will have to really be careful doing it. And then the screener needs to be run
02:02post 1.45 between 1.45 and 2ish in the afternoon. In terms of the logic itself,
02:08it's pretty simple. On a day when a stock or an index is trending, I mean, you would have
02:14the screener run and then it'll pick that stocks for you and indices for you. So
02:17you don't have to worry right now. On the day where the stock or the index is
02:21really trending, which is identified by the slope of the 20 EMA, most of the
02:26candles are either above or below the 20 EMA. So for a stock that is trending
02:31that way, post 1.45 or 2 p.m., you would see a quick reversal coming in. The price
02:37would cross over the 20 EMA. And the moment it happens, the price would swiftly move
02:41either downward or upward. And then that is the opportunity for you to actually trade.
02:47The SL will typically be the low or the high of the candle that breaks out or breaks down
02:51on the 20 EMA line. And then I know this can be a bit confusing. Let me just explain
02:55that on a chart. Take a look at this chart from Bajaj Finance. This is a five minute
03:01interval candles. And then on this particular day, you can clearly see the trending, the
03:0720 EMA trending upward. And the price, all of them, almost 85, 90% of it stays on one
03:13side, which is on the higher side. And then you start monitoring the price after two o'clock.
03:19And whenever the price starts to cross over on the other side, that triggers your entry.
03:24For example, this particular candle, the entry is below this candle. And then the stop loss
03:30is typically kept at the high of the candle. And then you have an opportunity to trade this
03:34particular reversal, usually about 0.5%. Sometimes the reversal is so steep that it continues until
03:41the end of the market day, in which case you try and trade your profit and make the most of it.
03:48So that's how simple this strategy is. Now, let's take a look at the actual rules for both long
03:53and the short trades. For long trades, you typically want the stock or the index trending downward.
03:59The slope of the 20 EMA is below 0.5, which is basically minus 0.5. And then more than 85,
04:0790% of the time, the candle stays below the 20 EMA. And then at between 1.45 PM and 2 o'clock,
04:17not later than 2.30, you want to see the price closing above 20 EMA. And that becomes your trigger
04:23candle. Your stop loss would be the low of that entry candle. And then in terms of exit conditions,
04:29it's quite flexible, however you want to play it. You can keep a standard 0.5% intraday target.
04:36Or if you want, you can go for a 1-2 and you can also trade the profit if you want. Or the SLS hit.
04:43So either of these two conditions will define how you would exit the trade. Take a look at this example
04:50for the long trade. Obviously, you have a trend that is going downward. Majority of the time,
04:55the price has stayed below the 20 EMA. And then sometime around 1.45 to 2, the price breaks out.
05:02And then this is your entry candle. And your stop loss is below this. And then this has given you
05:061.2. Now let's take a quick look at the rules for the short trade. It's just the opposite.
05:11You need a stock current index that is trending upward. Majority of the time, the price in the
05:17candle stays above the 20 EMA. And the slope of the 20 EMA is above, which is greater than 0.5.
05:25And then post 1.45 to 2, when you see the price close below 20 EMA, that triggers it. The high of
05:31the entry candle is a stop loss. And the target basically stays the same, which is 0.5% or 1.2.
05:36And then you can also have an option of trailing the profit.
05:41And here's an example of the short trade. The trend is upward, clearly. All the price remains on
05:48one side of the 20 EMA, which is on the positive side. And then post 2 o'clock, you have this
05:53price breaking down. This high of the scandal is your stop loss. And then this is achieved 1.2 as
06:00well. So our community member Praveen had also asked me if I can build a small scanner, a Python
06:04scanner for him. This is what it is. This code is available for free on our community website.
06:10I'll provide the link in the description. You can download and use it as you please. The scanner is
06:15pretty simple. We have a bunch of stocks that we give. You could actually choose an universe of
06:21maybe Nifty 100 or Nifty 200 as input. And then the first idea is to you find out the
06:29EMA, 20 EMA, calculate the 20 EMA. And then you calculate the slope for that 20 EMA
06:36just for that particular day. And then if it is greater than 0.5, it tells you that it's an uptrend.
06:42If it's less than minus 0.5, it's a downtrend. So that's the first criteria where you filter.
06:47Number two is you find out the price of the FEDs closed 85% of the time above the line.
06:54If these two conditions are meant, then this particular stock is eligible for a short entry.
06:59Similarly, for the long entry, you have a downtrend and also 85% of the time, the price is closed below
07:05the line. Then this gets eligible for a long entry. And then finally, when you run the screener at around
07:121.45, 2 PM during the day, it'll print you clearly these two separate lists, one for long entry and
07:19one for short entry. Once you get it, there are two ways of doing it. One is you can put this on your
07:26trading view and then you can manually monitor it from that point onwards to see if it breaks down
07:30or from the 20 EMA. And then when it does, you can actually take a manual entry. Or if you want to
07:36completely automate it on Python, you can do that as well, which is that you run a loop every five
07:42minutes to find out which of these stocks either breaks down from 20 EMA or breaks above 20 EMA.
07:48And then accordingly, you take a long or a short trade. And then you can set the 0.5% target
07:54condition or the one is to two within the code. And that should take care of your entire trade.
07:59I would like to thank Praveen for suggesting this. It's quite heartening, actually. We started this
08:06only a couple of days ago, and then it's quite heartening to see people are joining the community
08:11and already willing to support and contribute to the community, which is really a very happy
08:16thing for me. So Praveen, again, thanks for suggesting this. The rest of the folks, I hope
08:21you like this particular strategy. And if there are any other strategies that you'd like to share with
08:26the community or you'd like me to build any Python based screeners, please do let me know in the
08:31comment or send me an email. I'll be more than happy to take up for it. Thank you. If you genuinely
08:37found this video useful, please consider subscribing and liking the video. And I will see you soon in
08:41another video. And until then, take care and happy trading.
Comments

Recommended