Calculate Resistance and Pivot Points | Python For Finance Episode 6

  Рет қаралды 31,333

Richard Moglen

Richard Moglen

Күн бұрын

Пікірлер: 130
@tech2044
@tech2044 3 жыл бұрын
Unlike so many videos involving python yours actually works! Great job!
@RichardMoglen
@RichardMoglen 3 жыл бұрын
Thanks Glen!
@martorella123
@martorella123 Жыл бұрын
Richard, Thank you for this ! I recently started at a new firm where all the automated trading is done in Python. Thus far the extent of my programming experience has been with Easy Language in TradeStation and MultiCharts. These videos are extremely helpful! John
@pavansshanbhag
@pavansshanbhag 2 жыл бұрын
I came to this video through a medium post and i must say, you have done something powerful with very few lines of code. God bless you for sharing this peice of knowledge!
@RichardMoglen
@RichardMoglen 2 жыл бұрын
Thanks Pavan! Could you link the medium post?
@alexblagojevic3425
@alexblagojevic3425 3 жыл бұрын
Hey man. I watched one of your videos like 8 months ago and now im making a GUI for my trading system. Just wanted to say thanks and youre the man.
@RichardMoglen
@RichardMoglen 3 жыл бұрын
Awesome Alex! Shoot me some screenshots over on twitter I'd love to see what you've come up with
@toddroloff93
@toddroloff93 2 жыл бұрын
Nicely done!!! I like your logic and the way you break down the coding so rookies like myself can grasp it is great..Your passion for both programming and finance shines through..Keep up the great work..Thank you
@RichardMoglen
@RichardMoglen 2 жыл бұрын
I appreciate that!
@chaitanyapai1551
@chaitanyapai1551 4 жыл бұрын
Building an algo trading system and this is exactly what I needed! Amazing logic man, this video deserves a lot more views. Thanks a lot and God bless you!
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Sounds cool! best of luck
@10fersen
@10fersen 2 жыл бұрын
How is it going?
@ml0k1
@ml0k1 4 жыл бұрын
Thanks Richard. I always look forward to your videos.
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Thanks man!
@hishamashour5771
@hishamashour5771 4 жыл бұрын
This is by far the best explanation, I'd really like to thank you a lot for this, you've earned a subscriber. Keep up the great work man!
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Awesome, thank you!
@efueyo
@efueyo 3 жыл бұрын
Once again, thank you for your excellent work. For those of us who do not understand spoken English well, but if we defend ourselves quite well with written English, it would be very useful to be able to access the transcripts.
@draugh1r219
@draugh1r219 2 жыл бұрын
enable the subtitles
@15nkrish
@15nkrish 4 жыл бұрын
The videos are awesome. Haven't programmed in a while - you Richard are inspiring me to go back to what I started doing out of college!!
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Great to hear! Best of luck with it!
@benjamintreitz1647
@benjamintreitz1647 3 жыл бұрын
Moglen, you are the coolest dude ever. Great series
@RichardMoglen
@RichardMoglen 3 жыл бұрын
Haha thanks Benkamin!
@matthewrenegar6559
@matthewrenegar6559 2 жыл бұрын
If you try the reverse (currentMin, min instead of currentMax, max), it will fail due to a dates == 0 will occur and fail when timeD is added to it in the final for loop. The below code will fix that. if counter==5: if currentMin == 0: pass else: lastPivot=currentMin dateloc=Range.index(lastPivot) lastDate=dateRange[dateloc] pivots.append(lastPivot) dates.append(lastDate)
@SamiSabirIdrissi
@SamiSabirIdrissi 3 жыл бұрын
Dude! Super dope video ! Good job. Keep killin it!
@RichardMoglen
@RichardMoglen 3 жыл бұрын
Appreciate it!
@PavelSumik
@PavelSumik 4 жыл бұрын
Absolutely amazing, you are a complete magician
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Haha Thanks Pavel
@blakedavis9174
@blakedavis9174 4 жыл бұрын
Great video Richard, this series has been super helpful!
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Thanks Blake!
@michelemeloni3079
@michelemeloni3079 3 жыл бұрын
Thanks man, you're a genius 🤜 Please go on with other videos !!
@RichardMoglen
@RichardMoglen 3 жыл бұрын
Thanks, will do!
@enzanto
@enzanto 2 жыл бұрын
Great tutorial. I created a script like this. And one for checking if they break pivot point. And reporting straight to my discord. Will run it in a container in my kubernetes cluster :D
@alokeranjan6320
@alokeranjan6320 4 жыл бұрын
Very nicely explain the code, I was searching the exact code. You are awesome. keep it up.
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Glad I could help!
@alexwutzke7459
@alexwutzke7459 3 жыл бұрын
This is really great! Thanks for doing this!
@RichardMoglen
@RichardMoglen 3 жыл бұрын
Glad you enjoyed it!
@stephenrwafa2519
@stephenrwafa2519 4 жыл бұрын
Thanks bud this is exactly what I needed added min logic to calculate support as well. Great stuff keep it...
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Glad it helped!
@DuesenbergMusicGroup
@DuesenbergMusicGroup 4 жыл бұрын
why leave a like ... I leave a love down below
@RichardMoglen
@RichardMoglen 4 жыл бұрын
❤️
@lucabreder2757
@lucabreder2757 3 жыл бұрын
Thank you very much for your work! Love the content!
@RichardMoglen
@RichardMoglen 3 жыл бұрын
My pleasure!
@larz4437
@larz4437 4 жыл бұрын
I'm Bizcycles on Twitter. Another great tutorial my man!
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Thanks Lee, Take care!
@brettoski
@brettoski 4 жыл бұрын
Great video Richard, very cool
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Thanks Brett!
@LatinoWebStudio
@LatinoWebStudio 2 жыл бұрын
Thanks so much for the video! Is there an episode to calculate a pivot point for support? Once it starts running back up? I'm thinking of using it with the email alert, one for resistance and one for support, if possible.
@skybat723
@skybat723 4 жыл бұрын
great stuff Richard--love it---helps so much for support and resistance and we can write extra MA strategies on top---helps a lot for newcomers especially squinting their eyes to draw support/resistance.... could you please explain how to apply to 50week calculations? i see your example goes back to 1 year back...but where are you defining this... trying to map 10 days out to 50 weeks..
@PeterJavorkai_is_on_fire
@PeterJavorkai_is_on_fire 4 жыл бұрын
Woop woop, I really like these python sessions! 🤘
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Thanks Peter! Glad you like them
@flydr2
@flydr2 2 жыл бұрын
Nice work... Thanks
@RichardMoglen
@RichardMoglen 2 жыл бұрын
No problem 👍
@GTAVaultSeries
@GTAVaultSeries 2 жыл бұрын
How can I fix the chart not popping up? I have everything you have coded in the video but the chart and the pivot points don't show. Any suggestions?
@johnbroe6116
@johnbroe6116 4 жыл бұрын
Keep up the great work!!! Also if you don't mind could you add the code to this tutorial
@rafaelosorio2251
@rafaelosorio2251 2 жыл бұрын
Hi Richard, thanks for you tutorials, are excellent. One thing please, I get error on this code, I compare mine and the screen and apparently are the same, could you share the code please?..Thanks.
@drizzle4728
@drizzle4728 Жыл бұрын
Thank you.
@SIMONONLY
@SIMONONLY 4 жыл бұрын
Really appreciated for the tutorials , i did learn great deal from it . Over the last 2 days , i tried to rewrite your code in diff style. Can you provide me with some comments. Especially on drawbacks. start = dt.datetime( 2019,6,1) end = dt.datetime(2020, 9,18) today = dt.datetime.today() tickers =['TSLA'] for ticker in tickers: df = web.DataReader(ticker,'yahoo', start, today) df['10dHigh']= df['High'].rolling(10).max() dfk= df[df['10dHigh'].shift(-5)==df['High']]['High'] df['High'].plot(figsize=(12,8)) dfk.plot(style= "r.", marker =1, markersize = 36)
@k2icc
@k2icc 3 жыл бұрын
Have you ever tried Harmonic Patterns such as per youtuber "PythonParseltongue"? It was a nice series, but the guy never finished up. That could be a nice one to recreate and finish to the next step. Great videos you are making too.
@sonsam1391
@sonsam1391 3 жыл бұрын
Hello, can you tell me how I can trade 1-minute charts for index futures? How to judge from today's closing price whether the market's opening price will rise or fall tomorrow? thank you
@OzgurUrhan
@OzgurUrhan 3 жыл бұрын
Thanks for video. How can we select more than one stock?
@RichardMoglen
@RichardMoglen 3 жыл бұрын
Thanks Ozgur, make a list of tickers and then iterate through that list
@jburns3210
@jburns3210 3 жыл бұрын
Richard, thanks for the great videos. Could you recommend a python book that deals with financials for me.
@jenaman0001
@jenaman0001 2 жыл бұрын
Hi Richard, nice video. Thanks for it. I was trying to see if is there any way we can plot (interactive) candlestick charts instead of the line chart. Also, annotate the last price on the chart. Please guide.
@jenaman0001
@jenaman0001 3 жыл бұрын
Hi Richard, this a very good video and lots of things are clarified. Can we do the same thing to find the bottom of the stock price... Support levels ...then it can be a good entry point to catch the big moves.. please suggest..
@jenaman0001
@jenaman0001 3 жыл бұрын
Nevermind, I figured it out. One question though, I guess we will the marks for support after 5 Days correct ??
@priyanandanavarmamudunuri3787
@priyanandanavarmamudunuri3787 4 жыл бұрын
Awesome video!!.......Could share how to add a stop loss may be at a support level and trail the SL at subsequent supports?
@sagarkapile8704
@sagarkapile8704 4 жыл бұрын
Thanks Richard for the short and simple code for Resistance. What are the modification we need to do to make it for intra-day on 5 mins candle .
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Hi sagar, any time frame should work the same, but you would need the data for intraday
@anthonymacle1880
@anthonymacle1880 3 жыл бұрын
Hi Richard, in case we get an alert once a pivot has been busted, what happen if the prices retarces below and then bust it again. Could we find a way to get the alert again ?
@prathammehta3275
@prathammehta3275 4 жыл бұрын
This is really helpful! Will a similar logic work for calculating the support?
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Yes absolutely
@prathammehta3275
@prathammehta3275 4 жыл бұрын
@@RichardMoglen Perfect! However, what would you suggest for a more ML-based approach to this?
@efueyo
@efueyo 3 жыл бұрын
Thanks Richard. Really great. It would be nice to be able to access the full code. It is difficult to transcribe it from the video. I have done it and when executing it returns the error -------------------------------------------------- ------------------------- TypeError Traceback (most recent call last) in 29 Range = Range [1: 9] 30 Range.append (value) ---> 31 dateRange = dateRange [1: 9] 32 dateRange = dateRange.append (i) 33 TypeError: 'NoneType' object is not subscriptable What can be the cause?. Perhaps some copied sentence I have not done correctly. I am blocked.
@dancat333
@dancat333 2 жыл бұрын
ah, I have a working set of code. I think your mistake is it should be "dateRange.append(i)" not "dateRange = dateRange.append (i)"
@yosualumbangaol7867
@yosualumbangaol7867 4 жыл бұрын
Hi Richard, very nice explanation. Btw, I got some error that said: "ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()." I think this error relate to your line 29, which you use 'default = 0'. My default letter's color is also didnt change. Dou you have any ideas to solve this problem?
@oliverludwig6148
@oliverludwig6148 4 жыл бұрын
Could we adapt this code, so it works for currency pairs as well?
@RichardMoglen
@RichardMoglen 4 жыл бұрын
If you can find a source for the data absolutely!
@oliverludwig6148
@oliverludwig6148 4 жыл бұрын
@@RichardMoglen I could find historical currency data on yahoo finance and on dukascopy.com, which I can download as csv, which is good enough for now. My current goal would be to be able to backtest trading strategies, in particular one, which is based on resistance levels, so I'm glad, that you posted these playlist just recently. However my Python knowledge is still rather basic, and if I try myself at this advanced stuff, I sooner or later find myself in a jungle of cryptic error messages. F.e: the currency data from yahoo finance is different than stock data. df.info() gives floats for stocks, but objects for currency. Weirdly I also have code, which works in Spyder, but not Jupyter notebook.
@stephenrwafa2519
@stephenrwafa2519 4 жыл бұрын
I did adapt it for forex it works great.
@martinprzybylski
@martinprzybylski 3 жыл бұрын
Richard, thanks for the videos, they are really great. I have a question.. how can I remove the hours, minutes and seconds when you print the pivots and dates? Thanks again!
@theshortcut101
@theshortcut101 4 жыл бұрын
Would it be possible to substitute the highs for lows and find the areas of support? Thank you great video!
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Yes absolutely! That sounds like a very interesting idea
@jenaman0001
@jenaman0001 3 жыл бұрын
@Richard Moglen , can you please guide or create a strategy with python for premarket breakout for high and low...I am bit struggling there with my logic.. please guide or help.. Thanks, Manoj
@slavikboi9928
@slavikboi9928 3 жыл бұрын
Beauty vid
@lucksimi3320
@lucksimi3320 3 жыл бұрын
Hi Can you make python programm that detects all chart patterns (with buy and sell) "head and shoulder, flag, handle and cup, etc...) thanks
@codee7575
@codee7575 3 жыл бұрын
Dont understand plt.plot_date([dates[index],dates[index]+timeD], why x ,y in a list that have two values
@beni5433
@beni5433 4 жыл бұрын
Hey Rich great work I have one question tsla msft got called green and they got crushed your thoughts thx
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Got called green? Neither has presented a strong setup yet.
@phitaumatthew
@phitaumatthew 4 жыл бұрын
Hi Richard. How would one do a S/R program that would look back over say 2 years of historical data and be able to pull out S/R with Price by Volume?
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Hi Matthew, these pivot points only take into account price. You could definitely find support levels the same way. Including volume is a bit tougher because yahoo does not have intraday volume/price data
@phitaumatthew
@phitaumatthew 4 жыл бұрын
@@RichardMoglen Thanks so much for the quick reply. But if you had an API that had the volume, could you pull that way? If so, how would one do that?
@thabangtsajoa716
@thabangtsajoa716 3 жыл бұрын
Very great content, question: why is your range [1:9] not [1:10]? I didn't understand that part.
@trocchiettoski
@trocchiettoski 3 жыл бұрын
you change the first 9, the 10 is then append, in this way you iterate instead that 1 number per time, 10 numbers at time so that you can calculate if there is a max pivot, namely a value that is bigger than the last 5 and previous 5
@thabangtsajoa716
@thabangtsajoa716 3 жыл бұрын
@@trocchiettoski thank you for your response Giovanni, I appreciate it
@trocchiettoski
@trocchiettoski 3 жыл бұрын
@@thabangtsajoa716 happy trading mate
@henriksvankjrsommerin8287
@henriksvankjrsommerin8287 3 жыл бұрын
Hei Richard! First and foremost - thanks for your awesome content. I've looked through this video about 5-6 times to check if my code is identical to yours, but I still get stuck in an endless for loop - whereas the plot is never printed. Any idea why? I am rather new to programming and can't seem to find a solution to my problem by googleing it, so I'll give it a shot and reach out to you.
@myra2896
@myra2896 2 жыл бұрын
Just comment out the while loop. The chart should show up.
@DuesenbergMusicGroup
@DuesenbergMusicGroup 4 жыл бұрын
Richard i'm stuck concerning comparing bull and bear gaps stats in yfinance, with the last "Adj Close" to the "Open" the following day, due to the fact that it is a time stamp that can't seem to be reset as a value column, however
@RichardMoglen
@RichardMoglen 4 жыл бұрын
hmm can you show me your code and explain what you are trying to do? Make sure you are accessing the stock price not the date index
@DuesenbergMusicGroup
@DuesenbergMusicGroup 4 жыл бұрын
@@RichardMoglen I'm trying to reference u reference to the previous row of the value or Adj Close but it can't refer to it since Yfinance row reference is a time stamp for i in range(0,x): u += 1 df["line"][i] = u ival = df["Adj Close"][i] uval = df["Open"][i] if(ival
@DuesenbergMusicGroup
@DuesenbergMusicGroup 4 жыл бұрын
as of the get I used the one from the MA50 video df=pdr.get_data_yahoo(stock,period="1d", interval="1m", prepost=True)
@mukeshmalviya4797
@mukeshmalviya4797 2 жыл бұрын
How to calculate number of ट्रेड And plot on chart help 🙏🙏🙏🙏in python Please syear
@dimitrihobbs1313
@dimitrihobbs1313 4 жыл бұрын
Do you have any suggestions for brokers I should move to? I am planning on leaving Robinhood
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Hey Dimitri, I've only used Robinhood, Vanguard and TD Ameritrade. I've had no problems with both vanguard and TDA. Hope you''re doing well!
@sandeepsharma148
@sandeepsharma148 4 жыл бұрын
Hi Richard, Could you please share the code i write the same code but getting error. TypeError: 'list' object is not callable
@michaelscarn7375
@michaelscarn7375 4 жыл бұрын
same shit, drives me crazy
@michaelscarn7375
@michaelscarn7375 4 жыл бұрын
got it. Rename "range" array to something different like valueRange. Turns out range is a reserved word
@sandeepsharma148
@sandeepsharma148 4 жыл бұрын
@@michaelscarn7375 yes you were right. I resolved this issue by change to some other variable.
@blood4bones366
@blood4bones366 3 жыл бұрын
Can i get the Github repo?
@marius2293
@marius2293 4 жыл бұрын
plt.plot_date([dates[index],dates[index]+timeD],[pivots[index],pivots[index]], linestyle="-", linewidth=2, marker=',') Traceback (most recent call last): File "/Users/marius/Desktop/py_ex/tsla.py", line 287, in plt.plot_date([dates[index],dates[index]+timeD],[pivots[index],pivots[index]], linestyle="-", linewidth=2, marker=',') TypeError: unsupported operand type(s) for +: 'float' and 'datetime.timedelta' What am I missing?
@gregwilli1980
@gregwilli1980 4 жыл бұрын
Marius confirm if your pivots.append and dates.append are correct. They should be pivots.append(lastPivot) and dates.append(lastDate) I had one wrong. Once I corrected it the code worked.
@jonathanbognaski2690
@jonathanbognaski2690 3 жыл бұрын
Still can't get the pivots to print and spent hours trying to figure something out. Did your issues get solved?
@anthonymacle1880
@anthonymacle1880 3 жыл бұрын
@@jonathanbognaski2690 im stuck with this too. spent hours nothing any luck on your side ?
@david7559
@david7559 4 жыл бұрын
Hey man love the video, great content! But I cant get the lines plotted, however I do get one resistance value as output, could you help me out?
@RichardMoglen
@RichardMoglen 4 жыл бұрын
Hi David are you getting an error?
@david7559
@david7559 4 жыл бұрын
@@RichardMoglen No I'm not getting an error, I just can't get the resistance lines plotted when I'm on a lower timeframe than daily, for example when I try to change the timedelta according to my timeframe(1h) timeDelta(hours=4). What should I set timeDelta as at timeframes like 1h or 5m? Thanks!
@timanderson1560
@timanderson1560 3 жыл бұрын
I'm getting the exact same problem except I am just trying the code as is. Did you ever find a solution to this?
@timanderson1560
@timanderson1560 3 жыл бұрын
whoops had an indent in the wrong place. My bad. Awesome code!
@myl0rd3
@myl0rd3 4 жыл бұрын
Can I use this code in tradingview api?
@RichardMoglen
@RichardMoglen 4 жыл бұрын
You could code this into trading view I think.
@tradingenthusiast2178
@tradingenthusiast2178 4 жыл бұрын
Can you send a copy of the code like other videos please
@ofekdayan9670
@ofekdayan9670 Жыл бұрын
Can you share the code? :)
@garyketchen1
@garyketchen1 3 жыл бұрын
ffff
@mynas-ng5tt
@mynas-ng5tt 3 жыл бұрын
May Iknow that how to get the code for python?
@wavanstore925
@wavanstore925 3 жыл бұрын
Can i use same timeframe for 15min charts as well?
Introduction to Python for Finance
25:27
Richard Moglen
Рет қаралды 200 М.
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 41 МЛН
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 6 МЛН
小蚂蚁会选到什么呢!#火影忍者 #佐助 #家庭
00:47
火影忍者一家
Рет қаралды 126 МЛН
Cracking Enigma in 2021 - Computerphile
21:20
Computerphile
Рет қаралды 2,5 МЛН
The Tight Area Swing Trade Setup | How to Find and Trade VCPs
44:57
Richard Moglen
Рет қаралды 25 М.
Quantitative Finance & Python Programming | Yves Hilpisch
1:02:12
Chat With Traders
Рет қаралды 54 М.
Algorithmic trading in Python: Support and resistance
17:07
Automated Support and Resistance Detection in PYTHON
19:25
CodeTrading
Рет қаралды 64 М.
Finding Breakout Candidates with Python and Pandas
29:33
Part Time Larry
Рет қаралды 70 М.
Python For Finance Portfolio Optimization
39:17
Computer Science (compsci112358)
Рет қаралды 143 М.
Audio Data Processing in Python
19:52
Rob Mulla
Рет қаралды 165 М.
How To Back-Test Strategies |  Python For Finance Ep.2
23:06
Richard Moglen
Рет қаралды 89 М.