0:00
hello everyone I'm sure you'll agree
0:02
with me uh the success of a Trader or an
0:04
investor is primarily determined uh by
0:06
his or her ability to find an edge or a
0:08
gap in the market over the years people
0:11
have built or are in the process of
0:12
building tools that can help them find
0:14
these hidden Shams in this video I'll be
0:16
talking about one such powerful tool and
0:18
the tool that every Trader or investor
0:19
should have in his toolkit and the tool
0:22
in question is the relative rotation or
0:24
sometimes as it's commonly called as
0:25
sector rotation graph we'll be taking a
0:27
closer look at number one what this tool
0:29
is all about and how it works number two
0:31
review the python code that I had built
0:33
that will construct this tool for you
0:34
and number three we will also discuss
0:36
how we can use this tool for better
0:38
decision- making so let's get
0:41
started if this is your first time here
0:43
welcome my name is Vive and I'm a
0:44
financial independent Al trador this
0:46
channel is all about building a
0:47
community of algo Traders we discuss
0:48
everything about algo trading using
0:49
python building and practice trading
0:51
strategies Market updates and much more
0:53
please do visit our community website
0:55
trader.net Channel Fab wealth where I
0:58
talk about my own Financial Independence
0:59
journey and sh tools methods and
1:00
strategies that help me achieve my
1:02
Financial Freedom thank
1:07
you this video is part of my algo tools
1:10
Series where we will be building a range
1:12
of python based trading tools now uh you
1:14
might be wondering what's the purpose of
1:15
these individual tools right so think of
1:18
a skilled mechanic his efficiency
1:19
depends on the tools at his disposal the
1:22
same goes for an algor trador as well
1:23
while these tools may seem small and
1:25
Standalone right now uh I ask you to
1:27
trust the process as we progress you
1:29
will see or you'll start seeing the
1:30
bigger picture soon it'll be Crystal
1:33
Clear how combining these tools can
1:34
completely transform your trading game
1:36
so stick around it's going to be worth
1:38
it if you're already familiar with
1:40
relative rotation graphs uh feel free to
1:42
skip this section for those who aren't
1:44
I'll do my best to break it down with a
1:45
simple or maybe slightly unconventional
1:47
example it might not be perfect uh but I
1:50
promise it's the easiest way I could
1:51
think of to explain this concept so
1:56
me you've probably heard of force
1:58
raising right now imagine you're invited
2:00
to one and someone presents you with a
2:02
challenge there are four horses running
2:04
in the race and if you can't pick the
2:06
winner you will walk away with a million
2:08
do take a few seconds and think what are
2:10
the two top key factors you would
2:12
consider before placing your
2:15
bed so you're ready with your options
2:18
let's see if we are on the same
2:19
page um as far as I'm concerned the
2:21
first factor is is the horse strong
2:24
enough does it have the stamina to last
2:26
the entire race strength is key and
2:28
number two the second Factor strength is
2:30
great but can the horse run fast at the
2:33
end of the day speed is what winds
2:34
raises correct now let's break this down
2:36
logically and plot it on a
2:39
chart the horizontal line represents the
2:42
strength of the horse so this the
2:44
positive side is the is where the this
2:45
horse is stronger and this is where it
2:47
is weak and similarly the vertical line
2:48
represents how fast is it this is the
2:51
fastness and this is the slowness so
2:53
automatically you get a picture where
2:55
I'm trying to go to for example these
2:57
four horses the horse a is is is both
3:00
strong as well as fast horse D is
3:03
stronger but it's slower horse C is both
3:05
weak as well as slow and horse B is
3:08
faster but it's not at just the great uh
3:12
now so suddenly when you look at things
3:15
this way it becomes very clearer isn't
3:17
it horse a no doubt is is the horse that
3:19
you want to bet on and the relative
3:21
rotation graph is very similar to the
3:23
same concept let's now look into the the
3:25
actual rrg itself if you haven't joined
3:27
our telegram group please do so or share
3:29
Market insights I'll go trading tips and
3:31
new video notifications and this week we
3:32
stay up to date with our community news
3:35
events the RGS is very simple at the
3:38
same time is very beautiful and Powerful
3:39
as well it basically has two indicators
3:42
right the one is called the jdk RS ratio
3:44
which is nothing but your relative
3:45
strength ratio and jdk is nothing but
3:47
the person who invented it I think it
3:48
was Julius D Keener uh so it's named
3:51
after him and then the second indicator
3:53
is the jdk RS momentum and when you
3:55
combine these two indicators whereas the
3:57
the relative strength it basically
3:58
measures the SEC security Str Against
4:00
The Benchmark performance whereas the
4:01
momentum indicates a rate of change in
4:03
its relative strength so when you
4:05
combine these two indicators together
4:07
and that's what actually makes the the
4:10
rrg now let's discuss these two
4:12
indicators in a in a bit more depth uh
4:14
the first one which is the relative
4:15
strength relative strength as you know
4:17
is nothing but the security that you're
4:19
trying to analyze uh you compare it with
4:20
the Benchmark all you're trying to do is
4:22
you have the the Securities returns
4:24
divided by The Benchmark return so
4:26
whenever you have a value more than one
4:28
it automatically means that your your
4:30
security is doing much better than the
4:31
Benchmark anything less than one is the
4:33
The Benchmark your particular security
4:35
is not able to beat The Benchmark right
4:37
typically they multiply the the final
4:39
value by 100 so always the RS ratio is
4:41
mentioned as you know in terms of 100 so
4:43
100 being that your security is exactly
4:45
the same as the Benchmark anything more
4:47
than 100 is basically your secuity is
4:48
beating Benchmark anything less means
4:50
that it's trailing your benchmark that's
4:51
what the relative strength basically
4:54
indicates so the relative strength alone
4:57
is is is only a part of the puzzle it
4:58
doesn't give you the complete picture
5:00
you need one more ingredient uh to make
5:01
it whole which is where the momentum
5:03
comes in you you from relative strength
5:05
you first established that your security
5:07
is doing much better than the Benchmark
5:08
which is number one is very important
5:10
and number two you're trying to
5:11
establish that it also has momentum uh
5:14
and that is indicated by the RS
5:16
momentum right now you don't have to
5:17
worry about the formula for calculating
5:19
these uh indicators is all provided in
5:21
the the the blog as well as the the
5:23
python code so right now you don't have
5:24
to worry about it now if we take these
5:26
two indicators and then do a similar
5:28
plot a scatter plot of the same values
5:30
for example in this case the xaxis is
5:31
going to be your relative strength and
5:33
the y- axis is going to be momentum uh
5:34
the this particular quadrant which is
5:36
the first quadrant the the strength is
5:37
still weaker but you're seeing a good
5:39
momentum and then the stock is is is
5:41
about to basically uh you know pick up
5:43
speed and this is where the it is called
5:45
the emerging leader and typically this
5:47
is where you look for buys as well
5:48
because you want to get uh into the
5:49
trend early on so that you can cat that
5:51
Alpha so this is where you look for
5:55
buys this second segment or quadrant is
5:57
where the momentum is is high and also
6:00
the strength has picked up so your stock
6:02
is automatically in the high performing
6:03
stock so at this point in time you don't
6:04
look to sell it you're basically holding
6:08
position and then in this quadrant uh
6:10
you you're clearly seeing weaknesses the
6:12
momentum has kind of dropped it still
6:14
holds some strength in it but the the
6:15
momentum is completely lost uh this is
6:17
this is where it's called the mature
6:18
Trend and you typically look for ways to
6:20
get out of your Holdings at this point
6:22
in time right and finally the the last
6:24
quadrant where it is clearly lost the
6:26
momentum also the strength and it is an
6:28
underperformer at this point in time in
6:29
the market and this is definitely you
6:31
know the stocks or the sectors that uh
6:34
you know you try and avoid you you you
6:37
stage so I guess the the concept is
6:39
overall clear now let's take an actual
6:43
looks this is how a typical rrg looks
6:45
the same four quadrants we have the
6:46
improving quadrant at which point in
6:48
time you you look for buys and then the
6:50
leading quadrant where you look to hold
6:51
and then the weakening quadrant as soon
6:53
as it enters here you you look to sell
6:54
and get out and then the lagging
6:56
quadrant you you try to avoid like hell
6:57
right so ideally what we looking at is
6:59
basically a stock which is is increasing
7:01
in momentum gaining strength and then
7:03
all the way going up to this range and
7:05
this is exactly the range that you're
7:07
trying to uh you know make use of and
7:10
then this is the range that you try and
7:12
avoid the items on an RG is typically
7:14
shown as with a with a head and a tail I
7:16
know it kind of looks like sperms under
7:17
a microscope uh but but the reason why
7:20
it's given is if you just give the head
7:22
portions alone you can clearly say which
7:24
quadrant they are in but when you
7:25
clearly see the tail you can see the
7:27
trend that that particular stock is
7:28
taking which which tells a lot more
7:30
story than just looking at which
7:32
quadrant it belongs to right so you can
7:34
actually increase the tail uh you know
7:36
the duration of the tail and then you
7:37
can also clearly see the the pattern and
7:39
I think one thing that we clearly image
7:40
from this picture is that you you see a
7:42
natural way the stocks are going
7:44
cyclical right typically what we what we
7:47
think is that when we look at the price
7:48
of a stock it's all just random there's
7:49
no real sense to it uh you know that's
7:52
how we feel it but if you really look at
7:53
at this charge the complete picture
7:55
basically jumps jumps at you which is
7:56
that most of the stock actually have a
7:58
cyclical nature of how it operates and
8:01
when you know the secret uh and when you
8:02
know where they are right now within the
8:04
you know the overall four quadrants you
8:06
can either pick or avoid and make better
8:11
decisions let me just quickly jump into
8:13
it python implementation uh this code is
8:15
available in the blog post I'll provide
8:16
the link in the description as well as
8:18
I'll pin this on the comment section so
8:19
you can download it and try it for
8:20
yourself um this this actually currently
8:23
uses both Python and streamlet um and
8:25
then I'll show you how to execute this
8:27
for people who are not familiar with
8:28
streamlet um you basically give
8:30
streamlet run and then you provide the
8:32
name of the the python file to
8:34
run so this is how the the web app would
8:37
open um you could provide the Benchmark
8:41
here in this case I've given nifty50 it
8:42
can be any any indes that you want and
8:44
then you give the list of tickers that
8:45
you want to compare it against uh the
8:47
period at this point in time I've given
8:49
180 days again you can increase or
8:50
decrease this however you want and the
8:52
the tail length I've given 5 days again
8:55
you can increase it you know the way you
8:56
want it so you can clearly see that I've
8:58
given most of the you know the most
9:00
popular sectors here and the and the
9:01
graph would clearly tell you where each
9:03
of those sectors are and depending upon
9:05
this you can make better decision as to
9:07
you know whether to exit those sectors
9:08
or hold on to them or you know look for
9:10
buying opportunities so that's how this
9:12
this map uh this graph is very very
9:15
useful and you can also go ahead and
9:17
change it to anything that you basically
9:18
want to check uh TCS and iny uh and then
9:21
it'll show up uh this is TCS and this is
9:23
infy TCS looks like it say in the
9:25
improving quadrant infy for obvious
9:27
reasons uh this quarter is currently in
9:28
the lagging state right so that's how
9:30
simple it is and then if you want to see
9:31
you know the the the path that it's
9:33
currently taking TCS clearly you can see
9:35
that it's improving whereas in Fe is
9:37
still stuck at the bottom so that's how
9:39
simple the implementation
9:40
is so like I had mentioned all the
9:42
information that I just told you or in
9:44
fact more information that what I just
9:45
spoke is already available in this blog
9:47
article I'll give link to it uh and it
9:49
also contains the entire implementation
9:50
the python implementation the code is
9:52
available all you can do is just simply
9:53
copy uh the only change that you might
9:55
have to do is supply your own function
9:56
that gives the the historic data right
9:58
now I'm using zeroa you may want to
10:00
change it uh to include your own
10:01
function to get historic data rest all
10:03
would work Asis uh and then in terms of
10:05
how to run this since it's a streamed
10:07
app like I said uh just just say just
10:09
type stream it space r space and then
10:11
provide the name of the Python file and
10:13
that should open up your app in a in a
10:16
this and the blog also gives you some
10:18
practical applications of how you could
10:19
effectively use rrg so please do uh read
10:22
this so that's pretty much it for this
10:25
video uh please try this out and uh let
10:27
me know how it went thank you
10:30
thank you if you genuinely found this
10:31
video useful please consider subscribing
10:33
and liking the video and I will see you
10:34
soon in another video and until then
10:36
take care and happy Trading