Technical Analysis Library in Python Tutorial
HTML-код
- Опубликовано: 22 сен 2024
- Like the video? Support my content by checking out Interactive Brokers using the link below:
www.interactiv...
Buy Me a Drink: www.buymeacoff...
Also, I will be starting a spinoff channel on AI in music, art, and gaming in 2023. Subscribe at: / @parttimeai
In this video, we demonstrate the Python TA package. Yet another technical analysis library for Python.
Like the video? Support my content by checking out Interactive Brokers using the link below:
www.interactivebrokers.com/mkt/?src=ptlPY1&url=%2Fen%2Findex.php%3Ff%3D1338
If you like this video and want to support the channel:
Buy Me a Drink: www.buymeacoffee.com/parttimelarry
Note: In this demo, it turns out I was running an early/old version of ta, which has the strange behavior of computing the moving average for the Bollinger Bands even for the first bar. So for the first bar, the average was equal to the closing price of the first bar. For the second bar, the average was the (first + second bar close) / 2, and so on. After upgrading to version 0.7 the numbers are now what you would expect - NaN values until there are 20 bars to average. Thanks to Todd below for pointing this out.
Larry is the best teacher ever. Such amazing videos and value as always.
This is amazing video. Thank you very much Larry!
You are amazing dude.
Larry you are a fantastic and very clear teacher. I appreciate what I am picking up from your channel
Thank you!
You make this look very easy, but I know you do know the stuff. Thanks a lot for taking the time to share it. That speeds up anyone learning experience by a lot.
thanks a lot for your contribution
Awesome tutorial! Easy to follow. Thank you.
Hey man trust me you are awesome 😎
Awesome topic and very well presented. I also prefer TA; good call
Exactly what I was looking for! Glad you decided to cover this library just now. Yesterday I was working on a bot hardcoding all the formula and math 😆 and than I found your video. It's gonna save me a lot of headaches 🤞🏽 cheers!
Just wanted to say Larry that I really appreciate your videos! I come from a stats and finance background so while I understand the finance concepts in theory and on paper with all of the nitty gritty maths , translating to code has never been easy for me. I have some experience but your videos are super and has made the transition so much smoother! Thanks mate and I'm looking forward for more stuff!
Nice, my man back again with Ta
back again! great as always thanks larry
Thank you for making these your videos are excellent and very informative.
Be GREAT to see a video on Python Trading Bot using TA lib that alerts on price crossing MA, and MA's crossing.
A sub to you my good sir!
Was there a part 2 for this? This is GREAT! Thanks!
Awesome as usual. twelvedata is awesome btw. You can get a Pandas dataframe simply by
from twelvedata import TDClient
td = TDClient(apikey=twelve_key)
ts = td.time_series('symbol'= 'AAPL')
ts.as_pandas()
YES LARRY! NICE TO SEEYOU AGAIN :D
Gr8 info vid.
Please make a vid on roadmap to learning python specifically for stock chart analysis , getting trade signals using chart and statistical analysis of stocks.
I mean make a vid on course tailored cut for only stocks analysis.
Regards
Farid
Great content! Can't wait for the next video! Would be very interesting if you back-test your upcoming supertrend strategy with backtrader
it was extremely useful.... tnx
Great video, very clear.
Please make a video on roadmap to learning python from scratch, specifically for stock analysis, chart analysis, getting trade signals using charts and statistical analysis of stocks. I mean create a roadmap on the course tailored cut for only stock analysis .
Regards
Farid
Looking forward on your next videos, are you going to use backtrader to test your strategies?
Hey Larry thanks a million for you videos man! Your lectures are so easy to follow and you explain even the most complex concepts to clearly yu make itso easy. Yu are a genius man. Im trying to transfer your supertrend code into freqtrade but its not working for me. I like freqtrade coz yu can give bot a select number of assets to trade on instead of running many bot instances. Or maybe is it possible to add more assets for bot to monitor in this supertrend strategy. Your ecample has eth/usdt just wondering if adding more would work. Thanks dude
Hi Larry - awesome video - thanks so much!
Curious behavior in the BollingerBands on my Windows PC (Python 3.8.4)...
When I run "bars = exchange.fetch_ohlcv('ETH/USDT', limit=20)", I get NaN values for upper_band, lower_band, moving_average (except for the last row). If I remove the limit and use print(df[-20:]), the values are fine.
Is anyone else seeing this output?
Yes...Larry is a Wizard and can pull data from the past to calculate MA on the first bar. We're mere muggles...
Yes I am having the same issue
@@FranklinMinty Yes seriously how he got the 20 bars average?
Hey let me check on what the deal is here, you are right the result was strange but I didn't catch it while I was recording.
Great catch. It looks like the version I had on this machine is very early/old. I had ta version 0.5.11. The values you got are the behavior I would expect. On the old version, instead of filling the first X values with NaN, it averaged what it had so far. So the first value of the moving average was equal to the first close. The second value of the moving average was the (first close + second close) / 2 and so forth. I upgraded the package -- ran a pip3 install --upgrade ta and now I have ta version 0.7. I re-ran with newer data and the behavior is now what you have and what I would expect. I will make a note of this in the next video and in a pinned comment. Thanks for pointing this out.
when is the next video coming? eager to learn
yeeee
You made 3 intresting stocks scanner videos in the past using TA-Lib, I could't install that library and I want to do a stocks scanner using the TA library in this video and I don't know how to start. Are you planning to remake the stocks scanner videos using TA?
This library is a joy to use compared to ta-lib, it has a vortex indicator for a start, you don't have to dick about with dependencies on 64bit Windows, it is certainly more Pythonic like you say and it isn't as buggy. Cheers Larry.
Thank you for the nice videos, I just wanted to say that, TA doesn't have MA types selection like TA-lib, different MA types are very important for trend trackers. Supertrend looks nice but not efficient and hard to optimize because it jumps on the bands :) For the first look, the super trend seems great but when you backtest it, the results are not good enough.
Supertrend is useful for visualizing trend reversals in terms of ATR magnitude, but it most definitely does not cut it as a standalone indicator. It’s not a bad filter though.
if you are having issues installation ccxt on windows. Open cmd has admin.
⭐❤
Hey Larry, first of all, great videos! You've helped me big time. How would you loop through a df where multiple coin pares are available, making it so that the ta trend functions are reapplied and recalculated on every pair in the df? Thanks!
Hi Larry I have watched all videos from API Binance Tutorial very nice! I have a question: which method returns me the market current/real time PERCENTAGE variation (from Ethereum for example) ? I got that just doing web scraping using selenium but I would like to get this info using the API.
I have local database table with Symbol, Date, Open, High, Low, Close, Volume columns. getOHLCfromDB(symbol, startdate, enddate) is the fuction which will extract OHLC data. I would like handler to work on extracted dataframe df. Is there possibilities to analysis for my local data.
Hello from Cuba. Try to use Order Flow
If only TradingView would come out with a Python version that replaces Pine Script.
question on the Close Price: when you look at a bar with the OHLCV, is the Close value for that minute, or the previous minute? The reason I ask: The ATR calculations use the Max [ (High-Low), (Abs(High - Previous Close)), and (Abs(Low - Previous Close)). So wondering if we should use the Close value on the same row, or use the Close value from the Previous Row?
Did you figure this out?
@@ThesniperScythe No, I have not.
awesome video as always. is there a way to trade based on Renko charts in this python?
I have a question :-
i have written a strategy in Pine_script ( tradingview) but i want to convert it to python. Please can you tell which libraries can help me to do that because my strategy is very complex ?
there are few limitation in pine script so i want to shift to python............Hope i get reply from you😎
Same problem with me. Since Pinescript is the language of TV, it might be a bit difficult to find a way around it
@@jadhavpratik37 if u can understand the math of indicator or your custom formula/ indicator it is very easy to convert it to python using pandas if u don't have any custom indicator or formula then you can use " ta lib" library to make your algorithms as almost every indicator is available in that library 😀
Pine script is the best language for creating strategies if you stay with the pine script you will easily understand that
can we use for stock ?which library can i use
Hi
Can get the code for WEEKLY supertrend? thanks
It's a pain to install TA-Lib but that's because it runs on faster native languages. Wouldn't want to be relying on Pandas to process thousands of stocks with any kind of frequency
Hello bor can u give example of SMA cross over using Pandas_ta plz
I have been using python38 and print (upper_band) it shows the powder as below.
What did I do, where did I go wrong? Help me.
import ccxt
import ta
import pandas as pd
import config
import schedule
from ta.volatility import BollingerBands, AverageTrueRange
exchange = ccxt.binance({
'apiKey':config.BINANCE_API_KEY,
'secret':config.BINANCE_SECRET_KEY
})
bars = exchange.fetch_ohlcv('ETH/USDT', limit=20)
df = pd.DataFrame(bars, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume'])
bb_indicator = BollingerBands(df['close'])
upper_band = bb_indicator.bollinger_hband()
print(upper_band)
.......................................................................
0 NaN
1 NaN
2 NaN
3 NaN
4 NaN
5 NaN
6 NaN
7 NaN
8 NaN
9 NaN
10 NaN
11 NaN
12 NaN
13 NaN
14 NaN
15 NaN
16 NaN
17 NaN
18 NaN
19 2433.810588
Name: hband, dtype: float64
>>>
What lib did You recommend to plot this?, like trading view?
I still got Nan error. How can I fix it?
increase the number of candles. BBand needs 20 candles to caculate but you give only 20 candles to it.
@@giratinum thank you :')
Is it possible to automate everything for online trading like a bot?
Can you do tutorial using redis thank you
I have one question that I hope someone can help me with. I think I have the identical code, but my upper_band= bb_indicator.bollinger_hband(); only return index 19 and the rest of the indexes are showing NaN. WHY?
increase the number of candles. BBand needs 20 candles to caculate but you give only 20 candles to it.
How diff is this compared to finta or talib?
Which Program is that on 3:20 you are using?
visual studio
Love your content. But I prefer C++
Awesome. I would like to do a few tutorials on other languages. I am not as proficient with C++ since I only used it at school and not professionally though. Python is a good language for teaching I find.
@@parttimelarry Here's the weird part, because I havee so much C++ on the brain, I seem to be less inclined to do python. I have 25+ years experience in C++ and can write any kind of code you can think of.
My goal is to do analysis for about 30 stocks and once and find the best entry point for each thread/ session.
What ide are you using in this video?
Visual Studio Code with Python extension. I really need to make a tutorial on just this topic since the question comes up a lot and I realized I naturally use certain shortcuts to browse the libraries I install, but not everyone has this configured.
@@parttimelarry That will be a great help!
@@parttimelarry this would be really helpful! Would be great to know some of the plug-ins you use
Can renko chart with wick help bro