Tradingview_ta libraries for Technical Analysis of Stocks
Screenshot of Tradingview app

Tradingview_ta libraries for Technical Analysis of Stocks

Abstract

This article tries to help you to make use of the python libraries created by TradingView platform with the help of which you can do a number of technical analysis, including momentums, oscillators, patterns and several other features with the help of which you can measure the performance of one or more stocks. A python app that has been created uses the TradingView_ta libraries along with graphical libraries such as plotly express to visualize performance of each stock based on a number of oscillators, patterns, momentum indicators etc. with the help of which you can have a better understanding of the stock before you make informed decisions using of purchasing/selling of a stock (or a set of them) as a part of your stock portfolio management schemes.

Introduction

This app is essentially a stock technical analytics app, and it uses the python libraries created by TradingView platform of TradingView inc and this is available since late 2011. This platform provides a visual set of charts along with many libraries which can help you in making deep analysis of the performance of a particular stock anywhere in the world. Stock market traders, short-term or long-term investors, individuals and companies, financial houses, mutual fund managers, PMS managers etc. will use these charts, along with their libraries to make important decisions with regards to maintaining the portfolio so that they remain, most of the time, profitable in their stock market businesses.

TradingView app is not a free and open source software. However, the Basic version of it is free. The basic version only provides minimalistic features. However, for a full and serious business use other stacks available - such as Essential, Plus or Premium and they come with different price tags.

However, for software professionals who use python stack for app development, the Tradingview's tradingview_ta libraries are open-source. With the help of these libraries, app developers can create apps that can preform a deeper technical analysis of stocks using about 26 indicators and oscillators. In this work, we use these libraries and and perform technical analysis of a few set of stocks, compare it with TradingView's charts and see how easily a better understanding on stocks can be arrived at, at no extra cost.

Application

The developed python application uses Streamlit framework for creating and deploying the app as a web-based app. According to Streamlit, Streamlit is an open-source Python library that makes it easy to create and share beautiful, custom web apps for machine learning and data science. In just a few minutes you can build and deploy powerful data apps. Streamlit libraries provide a a number of widgets and APIs, with the help of which you can create and deploy web apps simply and easily.

For analysis of stocks, the application uses National Stock Exchange (NSE) stocks for analysis, and the leading 50 stocks (called Nifty 50) are used for for analytics. The latest list of these 50 stocks has been downloaded and provided as a CSV file, and industry-wise classification has been made to analyse stocks based on industry and compare.

While this application doesn't create charts (although this can be done with some additional effort), it essentially summarises the inferences from different oscillators and indicators provided by the Tradingview platform, and bucket the stocks into one of the five - STRONG_BUY, BUY, NEUTRAL, SELL and STRONG_SELL. Any of such bucketing involve the accurate use of the 'INTERVAL' value, and you should careful about it. The intervals available are 1 minute (1m), 5 minutes (5m), 15 minutes (15m), 30 minutes (30m), 1 hour (1h), 2 hours (2h), 4 hours (4h), 1 day (1d), 1 week (1W) and 1 month (1M). Please mind that the analysis results generated for the interval of 1 minute (1m) could be completely different from the analysis results for the interval of 1 Day (1d), for example. Day traders could use the interval based on the minutes, while the short-term traders could use hours or even day, and long term investors typically use an interval of 1 month (1M). The present application is hard-burned for 1M interval, and it is tuned for long-term stock analysis only.

The initial screen is very simple, and looks like the one shown in the following figure.

Welcome Screen of the App

Analysis

This application is designed for a long-term investment analysis mode, and uses 1 Month for the interval. Stocks from Nifty 50 is available for analysis, based on their categories. The available industry categories include - Metals & Mining, Services, Healthcare, Consumer Durables, Financial Services, Automobiles and Auto Components, Oil Gas & Consumable Fuels, Telecommunication, Fast Moving Consumer Goods, Construction Materials, Information Technology, Construction, Power, and Chemicals. Based on which sector you choose, automatically all the stocks belonging to that category of the industry is chosen for analysis.

The application shows a drop-down list (also known as SelectBox in the Streamlit API parlance), which displays the available industry list in Nifty 50 group. Upon selection of the group, the application triggers the analysis. The following figure shows the application showing the available classification of industries in Nifty 50 group of stocks.

Application showing available categories under which analytics can be performed

Results and Discussion

The output of the application include the tabulated results of each of the bucket as well as a stacked horizontal bar chart, as shown below:

Sample figure showing tabulated and graphic visualization under STRONG_BUY category

The tabulated results contain, for each of the selected stock, the symbol, number of BUY recommendations, number of NEUTRAL recommendations, number of SELL recommendations, Overall Recommendation (could be STRONG_BUY, BUY, NEUTRAL, SELL or STRONG_SELL), List of BUY Indicators, List of NEUTRAL Indicators, and list of SELL Indicators. A typical tabulated results for BUY bucket is as shown in the following figure. The table is wide and you need to horizontal scroll to see all the tabulated results.

The graphical output is a stacked horizontal bar chart, for each of the stock in that bucket. The stacked bar chart is organised in such as way that the first stack represent the BUY recommendation numbers, second stack is the NEUTRAL recommendation numbers and the last one indicates the SELL recommendation numbers. It's also color coded - Green for BUY, Silver Grey for NEUTRAL, and Red for SELL. Since this is a plotly express bar chart, the hovering feature is enabled so that, when you hover on top of any of the bar, it reflects the following four values - Variable (BUY, SELL or NEUTRAL), Value (number of values of the variable cited earlier), STOCK and List of indicators.

For example, in the below figure, the cursor on the STOCK 'BRITANNIA' indicates a SELL value of 2 and the list of Indicators include Mom (Momentum indicator) and HullMA (Hull Moving Average) indicator.

Tabulated results and Horizontally Stacked Bar chart under BUY category of Stocks

In the figure below, compare the Britannia prices with the Mom and Hull MA, both of which indicating SELL, on the Tradingview Chart, with both the indicators superimposed.

Tradingview chart for BRITANNIA stock with

Summary

Charts are very important tools for performing technical analysis, and charting from TradingView are one of the best among the available charting tools for financial stock market analysts. The tradingview_ta python library provides a range of indicators and oscillators, with the help of which you can develop your own application using python frameworks and use the same for doing a number of technical analysis and generate your own results, summaries and graphs, using which informed decisions can be taken. This application has been hosted on the streamlit web site, and the url is available for testing and feedback.

Visit the App

This app is hosted on Github, via the Streamlit account. The URL of the app is https://tradingviewtechanalytics.streamlit.app/ . You can visit this app, experience and provide a valuable feedback at [email protected]

Disclaimers

The author is not an employee / partner of Tradingview, but uses the basic version for analysing stocks. The author has neither approached Tradingview Inc nor the vice versa, for any specific interest pursuing. The same is true with regards to Streamlit, and the author uses Streamlit for developing AI and Data Analytics apps for knowledge purposes only. There is no endorsement from either side on the framework or application presented. Finally, the author is not a SEBI registered person, and neither the app, nor the results discussed in the app, are meant to be taken as financial, PMS or broking advice, and has to be taken only at the educational purposes level only. People interested can contact the author for additional information on such tools, and analytics.

Sreenivas T

Sr. Business Intelligence | DWH | Data Analytics | Data Visualization |Data Science Enthusiast

11 个月

Great,

回复
Dr Manjunath Mandikal

Director at Stevia World

1 年

??

回复

要查看或添加评论,请登录

Kumar B V的更多文章

社区洞察

其他会员也浏览了