0:00
hello everyone today I'm going to show
0:02
you one of the most underrated technical
0:03
analysis techniques that has completely
0:05
transformed my trading which is
0:07
calculating the moving average slopes um
0:09
most Traders just look at whether the
0:11
price is above or below a moving average
0:13
but they're actually most missing a
0:14
crucial information the angle of the
0:16
moving average tells you everything
0:17
about the momentum and the trend
0:18
strength in today's video I'll show you
0:21
exactly how I calculate these slopes
0:22
using python you'll see how I use them
0:25
to identify Trend strength spot
0:26
potential reversals and make better
0:28
entry and exit decisions
0:30
I'll also walk you through some real
0:31
life examples so you can see this
0:32
technique in action if you want to stop
0:35
getting faked out by false breakouts and
0:37
start identifying real Trends with
0:38
confidence this is the video for you so
0:42
in if this is your first time here
0:44
welcome my name is VI and I'm a
0:46
financially independent Alo Trader this
0:48
channel is all about building a
0:49
community of algo Traders we discuss
0:51
everything about Alo trading using
0:52
python building and practicing trading
0:53
strategies Market updates much more
0:55
please do visit our community website
0:58
trader.net Channel Fab weth where I talk
1:01
about my own Financial Independence
1:02
journey and share tools methods and
1:03
strategies that help me achieve my
1:05
Financial Freedom thank
1:07
you the code that I'm about to walk
1:09
through is as usual available on our
1:10
community website fad. in you familiar
1:13
with this so you can go into stories and
1:15
you would find the the moving average
1:17
slope the article is pretty detail it
1:19
gives you entire account of how this
1:21
works including the the actual code is
1:23
embedded here and it also gives you a
1:25
couple of real world examples and then
1:27
most importantly it tells you how to
1:28
interpret the values that comes out of
1:30
the the the program itself right uh so
1:33
how to understand how to interpret it
1:34
how do you find out you know what trend
1:37
the the particular stock is following
1:38
can be made uh out from this one uh you
1:41
don't have to worry I'll also provide
1:42
the link uh to this blog article in the
1:45
description as well as in the I'll put
1:47
it on the comment section as well so you
1:52
that now let's jump into the actual code
1:54
itself um I don't want to keep a video
1:57
short I don't want to spend a lot of
1:59
time trying to explain what moving
2:00
average is all about and all that
2:02
because I'm pretty sure you're you're
2:03
already aware of that uh so I'll jump
2:05
right into the the code the code is
2:06
pretty simple it takes uh three inputs
2:09
one is your the stock code in this case
2:10
I'm using yaho fan so you the second
2:12
input it takes is what is the moving
2:14
average window that you want in this
2:16
case I've just kept 20 because since I'm
2:18
considering daily candles here uh 20
2:21
Maas is basically a good uh measure of
2:24
ma to look at the third input is
2:25
basically the Sleep uh the slope period
2:27
how long do you really want to consider
2:28
the data going back right in this case
2:30
it's going back up to 30 trading
2:31
sessions uh so it would basically
2:33
calculate the moving averages for this
2:34
30-day period and then based on that
2:37
information it calculates slope so to
2:39
make this code work you would have to
2:40
install two dependencies one is numpy
2:43
and the other is pyit learn pyit learn
2:45
is again open source um I mean typically
2:47
people use it for machine learning
2:48
especially when it comes to if you want
2:50
to work with classification regression
2:51
or clustering is one of the best and
2:53
Powerful tools available in the market
2:55
so the way code works is uh we use a
2:58
linear regression to figure out what the
3:00
the slope of the moving average for the
3:02
time period that we already mentioned
3:04
and then it returns a slope value and
3:06
then depending upon the slope value you
3:08
can now figure out whether the trend is
3:10
either very weak weak moderate or strong
3:12
or very strong depending upon the value
3:14
and also if it's positive it means it's
3:16
an uptrend if it's a negative it is a
3:17
downtrend so I'll give you a I'll show
3:19
you a couple of examples on how this
3:20
works for example in this one I've
3:22
considered infosis infosis as we know uh
3:24
has taken a nose dive here so if you
3:26
look at the output the the moving
3:28
average slope value is actually negative
3:30
and it's showing a very strong downward
3:32
Trend I'll also show you the the chart
3:35
and and we can check whether the code is
3:36
working fine so let's look at the
3:38
infosis chart it said this is a daily
3:40
candle here and then this line denotes
3:42
the 30 candles 30-day U you know period
3:44
that we're talking about and this is the
3:46
20 EMA uh we can consider moving average
3:49
EMA doesn't make a lot of difference
3:50
here and this lellow line is basically
3:52
the you know the the line that I drew
3:54
which basically gives you an idea as to
3:57
what the slope is which pretty indicate
3:59
that it is a pretty downtrend look at
4:01
the way it has taken a no dive here so
4:02
that way the code seems to be working
4:04
and then giving you the right results
4:07
now let's take a look at another example
4:08
this time what about the upend bonds for
4:10
example baj finan is in the news all all
4:13
the time is quite famous now uh this
4:15
this uh when the entire Market seems to
4:18
be going downhill B Finance seems to be
4:20
like a racing horse you know so it's an
4:23
interesting case so I've taken baj
4:24
Finance here and then rest of the inputs
4:26
remain the same and then when we run it
4:28
we get a positive that 38 which is
4:30
pretty steep and it's also showing a
4:32
very strong upward Trend um based on the
4:35
value right let's take a look at the
4:38
now there you go that's the baj finance
4:41
daily chart and and then this this line
4:44
that I connected from the these 30-day
4:46
start of the moving average to the end
4:49
denotes the overall angle in the trend
4:51
this stock is going which pretty much is
4:53
very clear it's a very strong upward
4:55
Trend so we've tested both scenarios
4:58
with the code and the code seems to be
5:01
well so that is how exactly the code
5:03
works you can refer to the blog article
5:05
where it explains how to basically uh
5:07
infer the data the slope value or the
5:10
angle uh and then accordingly how do you
5:11
find out the trend so you can read
5:13
through this blog article for more
5:15
details so how I personally use this is
5:18
basically I don't use this as a
5:19
standalone indicator U you should never
5:21
do as any good algor Trader would tell
5:23
you you would have to use a Confluence
5:25
of indicators do not take just one
5:27
indicator and trade with it you
5:28
typically look for information from
5:30
multiple sources of indicators to ensure
5:32
that you're you are in the right
5:33
direction you're making the right trade
5:34
right that increases your success of
5:37
your trade uh to to a higher degree uh
5:39
so I typically take this also into
5:41
account whenever I'm getting into a
5:42
trade for example if I'm getting into a
5:43
long trade I would really want to check
5:45
if the the slope of the moving averages
5:46
are all aligned um in fact there are
5:49
strategies that I use where I use
5:50
multiple moving averages and then I
5:52
check the slope of every moving averages
5:54
to ensure that all of them are indeed
5:55
pointing towards a particular direction
5:57
that I want to you know take the trade
5:59
into so that is one way I use it or
6:01
sometimes if the the slope is very steep
6:02
for in the case of the baj fin that we
6:04
talked about I typically tend to avoid
6:06
taking a rate because anything that has
6:07
a very steep slope like that um tend to
6:10
reverse you know with a with a Vengeance
6:12
so Ty you'll have to be very careful so
6:14
you can actually use this tool and
6:15
multiple ways to ensure that you know
6:17
your overall success of the trade
6:19
improves in the next video I'll take
6:22
this concept that I've just explained
6:23
and then show you a small utility that
6:25
can that can do a screening of any stock
6:28
universe that you want and give you a
6:29
list of top uptrending all the
6:31
downtrending stocks from that Universe
6:33
if you genuinely found this video useful
6:34
please consider subscribing and liking
6:36
the video and I will see you soon in
6:38
another video and until then take care