Exploring The Best Indicators in TA-Lib - Technical Analysis of Stocks Using Python - Part 1 - by Himanshu Sharma - MLearning - Ai - Medium
Exploring The Best Indicators in TA-Lib - Technical Analysis of Stocks Using Python - Part 1 - by Himanshu Sharma - MLearning - Ai - Medium
Member-only story
https://medium.com/mlearning-ai/exploring-the-best-indicators-in-ta-lib-technical-analysis-of-stocks-using-python-part-1-b7ad731aeeb2 1/14
19/09/2023, 21:31 Exploring the Best Indicators in TA-Lib: Technical Analysis of Stocks using Python- Part 1 | by Himanshu Sharma | MLearning.ai | Medium
The basic idea behind technical analysis is that market trends, as depicted by charts,
can predict a stock’s future performance. Technical analysts use charts and other
tools to identify patterns and trends indicating buying and selling opportunities.
They also employ a number of indicators,
Open insuch
app as moving averages, the relative
strength index (RSI), and Bollinger bands, to help identify market trends and
potential turning points.
It’s important to remember that technical analysis isn’t a perfect science, and its
effectiveness varies depending on the stock and market conditions. Furthermore,
technical analysis should be combined with fundamental analysis and a well-
defined trading strategy.
In this article, we will take a look at some of the best indicators in the TA-Lib library,
along with code examples to help you get started, and we will use the yfinance
library for downloading the stock data.
https://medium.com/mlearning-ai/exploring-the-best-indicators-in-ta-lib-technical-analysis-of-stocks-using-python-part-1-b7ad731aeeb2 2/14
19/09/2023, 21:31 Exploring the Best Indicators in TA-Lib: Technical Analysis of Stocks using Python- Part 1 | by Himanshu Sharma | MLearning.ai | Medium
import yfinance as yf
import pandas as pd
import talib
Exploring Indicators
Let’s start exploring the Technical Indicators using the TA-Lib library, and also look
at how we can generate these indicators.
a. Moving Averages
Moving averages are one of the most popular technical indicators used to smooth
out price fluctuations and identify trends. They can be calculated using different
time periods, such as short-term (10-day), medium-term (50-day), and long-term
(200-day).
import yfinance as yf
import pandas as pd
import talib
https://medium.com/mlearning-ai/exploring-the-best-indicators-in-ta-lib-technical-analysis-of-stocks-using-python-part-1-b7ad731aeeb2 3/14
19/09/2023, 21:31 Exploring the Best Indicators in TA-Lib: Technical Analysis of Stocks using Python- Part 1 | by Himanshu Sharma | MLearning.ai | Medium
data = stock.history(period="max")
Using the above code you can generate the moving averages for 10, 50, and 200 days.
b. Bollinger Bands
Bollinger Bands are used to measure the volatility of an asset and identify
overbought and oversold conditions. The bands consist of a moving average
(typically the 20-day moving average) and two standard deviation lines above and
below the moving average.
https://medium.com/mlearning-ai/exploring-the-best-indicators-in-ta-lib-technical-analysis-of-stocks-using-python-part-1-b7ad731aeeb2 4/14
19/09/2023, 21:31 Exploring the Best Indicators in TA-Lib: Technical Analysis of Stocks using Python- Part 1 | by Himanshu Sharma | MLearning.ai | Medium
e. Stochastic Oscillator
The Stochastic Oscillator is a momentum indicator that compares the closing price
of an asset to its price range over a specified period. It is typically used with a 14-day
period.
f. Fibonacci Retracements
Fibonacci retracements are used to identify potential levels of support and
resistance by measuring the size of a price move and then dividing it by the key
Fibonacci ratios of 23.6%, 38.2%, 50%, 61.8%, and 100%.
It’s important to note that using these indicators alone may not guarantee a
profitable trade. Technical analysis should be used in conjunction with fundamental
analysis and a well-defined trading strategy. Additionally, the effectiveness of these
indicators may vary depending on the asset and market conditions.
These are some of the majorly used Indicators for understanding and analyzing
Stock Performance. Stay tuned for the next parts where we will explore some more
indicators. I will also be explaining How to create a trading strategy using these
indicators in the upcoming articles.
Go ahead and try this with different stock data and analyze these indicators. In case
you find any difficulty please let me know in the response section.
Before You Go
Thanks for reading! If you want to get in touch with me, feel free to reach me at
[email protected] or my LinkedIn Profile. You can view my Github profile for different
https://medium.com/mlearning-ai/exploring-the-best-indicators-in-ta-lib-technical-analysis-of-stocks-using-python-part-1-b7ad731aeeb2 5/14
19/09/2023, 21:31 Exploring the Best Indicators in TA-Lib: Technical Analysis of Stocks using Python- Part 1 | by Himanshu Sharma | MLearning.ai | Medium
data science projects and packages tutorials. Also, feel free to explore my profile and read
different articles I have written related to Data Science.
Follow
I write about my learnings in the field of Data Science, Visualization, Artificial Intelligence, etc.| Linkedin:
https://www.linkedin.com/in/himanshusharmads/
https://medium.com/mlearning-ai/exploring-the-best-indicators-in-ta-lib-technical-analysis-of-stocks-using-python-part-1-b7ad731aeeb2 6/14
19/09/2023, 21:31 Exploring the Best Indicators in TA-Lib: Technical Analysis of Stocks using Python- Part 1 | by Himanshu Sharma | MLearning.ai | Medium
https://medium.com/mlearning-ai/exploring-the-best-indicators-in-ta-lib-technical-analysis-of-stocks-using-python-part-1-b7ad731aeeb2 7/14
19/09/2023, 21:31 Exploring the Best Indicators in TA-Lib: Technical Analysis of Stocks using Python- Part 1 | by Himanshu Sharma | MLearning.ai | Medium
1K 16
FS Ndzomga in MLearning.ai
155 9
https://medium.com/mlearning-ai/exploring-the-best-indicators-in-ta-lib-technical-analysis-of-stocks-using-python-part-1-b7ad731aeeb2 8/14
19/09/2023, 21:31 Exploring the Best Indicators in TA-Lib: Technical Analysis of Stocks using Python- Part 1 | by Himanshu Sharma | MLearning.ai | Medium
94
https://medium.com/mlearning-ai/exploring-the-best-indicators-in-ta-lib-technical-analysis-of-stocks-using-python-part-1-b7ad731aeeb2 9/14
19/09/2023, 21:31 Exploring the Best Indicators in TA-Lib: Technical Analysis of Stocks using Python- Part 1 | by Himanshu Sharma | MLearning.ai | Medium
TradeDots
90% SUCCESS RATE?! Debunk “Too Good To Be True” Chart Patterns with
TradeDots
Trading is a complex subject that can be difficult to fully comprehend. It goes against our
natural inclination for simplicity, as we often…
63 1
Venujkvenk
https://medium.com/mlearning-ai/exploring-the-best-indicators-in-ta-lib-technical-analysis-of-stocks-using-python-part-1-b7ad731aeeb2 10/14
19/09/2023, 21:31 Exploring the Best Indicators in TA-Lib: Technical Analysis of Stocks using Python- Part 1 | by Himanshu Sharma | MLearning.ai | Medium
Lists
New_Reading_List
174 stories · 108 saves
Prajjwal Chauhan
In an ever-evolving world of finance, accurately predicting stock market movements has long
been an elusive goal for investors and traders…
200 8
How to Beat the Stock Market with Maths: A Dual Strategy Approach
Is it possible to discover a foolproof winning strategy? What if we could simultaneously bet on
red and black in a casino roulette while…
488 3
https://medium.com/mlearning-ai/exploring-the-best-indicators-in-ta-lib-technical-analysis-of-stocks-using-python-part-1-b7ad731aeeb2 12/14
19/09/2023, 21:31 Exploring the Best Indicators in TA-Lib: Technical Analysis of Stocks using Python- Part 1 | by Himanshu Sharma | MLearning.ai | Medium
Miryam Chen
90 4
https://medium.com/mlearning-ai/exploring-the-best-indicators-in-ta-lib-technical-analysis-of-stocks-using-python-part-1-b7ad731aeeb2 13/14
19/09/2023, 21:31 Exploring the Best Indicators in TA-Lib: Technical Analysis of Stocks using Python- Part 1 | by Himanshu Sharma | MLearning.ai | Medium
Future Stock Price Movements with Historical & Implied Volatility using
Python and Monte Carlo
1. Introduction
191
https://medium.com/mlearning-ai/exploring-the-best-indicators-in-ta-lib-technical-analysis-of-stocks-using-python-part-1-b7ad731aeeb2 14/14