No video

Algorithmic trading in Python: Support and resistance

  Рет қаралды 18,088

NEDL

NEDL

Күн бұрын

Пікірлер: 25
@NEDLeducation
@NEDLeducation 3 жыл бұрын
You can find the .ipynb for this video and some additional materials here: drive.google.com/drive/folders/1sP40IW0p0w5IETCgo464uhDFfdyR6rh7 Please consider supporting NEDL on Patreon: www.patreon.com/NEDLeducation
@sukriadnansangadji8232
@sukriadnansangadji8232 Жыл бұрын
thanks NEDL, this is great explanation. respect from indonesia
@sChaikovsky
@sChaikovsky 2 жыл бұрын
Wow this just phenomenal. Your code is another level. It is really complex and advance. I learned so much from your video. Thank you very much
@jeffkeller2590
@jeffkeller2590 2 жыл бұрын
Nice job and thank you. A few quick notes worth mentioning. The demo implies any round number should act as a support level (90, 100, 110, 120, ...etc), but yet your implementation targets support prices 10x this size (100, 200, ...etc). Firstly, if investors do have psychological levels in mind, and in fact you did intend to only examine 10x levels (100, 200, ...etc), then we have another problem worth mentioning. In the 10x case, as the price oscillates between $100 and $130, your approach attempts to LONG the stock and treat the situation as if the price is bouncing off the $100 support level. If so, I question whether investors could possibly believe a stock is in a perpetual bounce off the $100 support level for roughly 14 straight months! Lol As a suggested revision to this logic, simply divide the JNJ price by 10 before the mod (%1), which would replace all that complicated logarithm code you have. data['S&R'] = data['Close'] / 10 % 1 Secondly, the buy (sell) signal gets triggered when a given threshold is breached (in this case, 0.3, and 0.7), and in theory, should correspond with an extreme momentum reversal. As it stands, your code establishes a long (short) position for the ENTIRE duration of the signal breach, and then immediately liquidates back into cash. Perhaps it is my lack of understanding here, but I would have thought the original S&R (or RSI index) would be used to trigger a BUY (long-position) which is then HELD until a corresponding SELL signal is encountered. However, your approach opts to hold the long or short position for a VERY short period of time over the length of the study. As mentioned above, currently you are holding the long position for 14 straight months, with the S&R index in the BUY signal territory (below 0.3), but I suspect that is an error. Lastly, no big deal, but the CHANGE in price (WRT time) should affect the buy/sell signal, and its' worth being explicit about your intentions here. Currently, you have these rules in place which are great: > if a descending price change is intersecting with a support level, then a BUY signal is triggered > if an ascending price change is intersecting with a resistance level, then a SELL signal is triggered These 2 implicit conditions are ALSO in place, and ends up acting as an implicit STOP-LOSS (good too?): > if a descending price change is intersecting with a support level AND CONTINUES DESCENDING, then a BUY signal is triggered followed by an immediate SELL signal > if an ascending price change is intersecting with a resistance level AND CONTINUES ASCENDING, then a SELL signal is triggered followed by an immediate BUY signal In conclusion, I don't think it's fair to conclude that your implementation of this strategy is valid evidence supporting any realized benefits over the standard Buy-And-Hold approach, but I understand this likely is beside the point. Ultimately, I REALLY appreciate your time on putting this together, and am grateful for your insight.
@NEDLeducation
@NEDLeducation 2 жыл бұрын
Hi Jeff, and thanks very much for such a comprehensive comment! Overall, I do agree that this algorithm is quite simplistic and a more rigorous implementation would benefit the quality of the strategy. I do discuss more fundamental theories for support and resistance formation in this video: kzbin.info/www/bejne/onWcZoJnZpKbZ9k.
@pasduroc5422
@pasduroc5422 2 жыл бұрын
Again, an excellent video ! Thanks !
@mytradingmoves7520
@mytradingmoves7520 Жыл бұрын
Thanks! I'll add this to my code and I'll let you know how it goes 😁
@teroliikala
@teroliikala 3 жыл бұрын
Great video! Love to see you still making these, just wanted to say thank you for all the advice and guidance through the long nights at Northumbria Bloomberg Terminal ;). Great to see Jupyter Notebooks and Python used here as well, great direction to take these lessons!
@NEDLeducation
@NEDLeducation 3 жыл бұрын
Hi Tero, and so nice to hear from you :) Glad you are enjoying the channel! Will definitely spice it up even more in future Python videos! :)
@jitkadyan
@jitkadyan 3 жыл бұрын
Great video again Sir
@martivalex9521
@martivalex9521 2 жыл бұрын
Hi Savva, i have no words, thanks a lot for share your work. Thanks to the coments below, now i am reading Kakushadze's papers. I wonder if already you have tested the 101 alphas, it would be very interesting.
@NEDLeducation
@NEDLeducation 2 жыл бұрын
Hi, and thanks so much for your kind words! The 101 alphas is a very good introduction to algorithmic trading, cannot say I am directly replicating it in my tutorials, but some of it is definitely inspired by it :)
@mehranzand2873
@mehranzand2873 2 жыл бұрын
Great Idea thanks
@Kuznetsovication
@Kuznetsovication 3 жыл бұрын
Hi! Thanks for the great video! On 12:26 while annualizing risk, is there a need to account for the time frame: np.std(SR_return)*(252/len(SR_return)) ** (1/2)
@NEDLeducation
@NEDLeducation 3 жыл бұрын
Hi, and glad you liked the video! As for your question, the returns are daily and thus the np.std function calculates daily standard deviations, so no need to divide by the length here.
@user-sf1hl2ti5e
@user-sf1hl2ti5e 3 жыл бұрын
Hi NEDL , Thank you very much for this video. 1. Have you written any book on algo trading . If yes could you please share the book name to read If no could you please recommend some book names . 2. If there is any way to print only the historical support and resistance levels by using the Python codes. for example for coca cola when we check manually 36.5 and 47 - 47.5 is the Major support and resistance . Is there is any way to print those values if we input the ticker. Thank you.
@NEDLeducation
@NEDLeducation 3 жыл бұрын
Hi, and glad you liked the video! I have not written any textbooks (at least yet), but can recommend "151 trading strategies" by Kakushadze and Serur as a very good foundation textbook in this area (bonus - it is available free of charge: papers.ssrn.com/sol3/papers.cfm?abstract_id=3247865). For support and resistance, you can look at page 51. In terms of extracting support and resistance, it all depends on your technique. If you have got a clear algorithm of determining support and resistance levels, it can be coded and automated. More heuristic approaches ("looking at the chart") are harder to formalise and automate, but you can look at Lo, Mamaysky, and Wang (2000) for example.
@user-sf1hl2ti5e
@user-sf1hl2ti5e 3 жыл бұрын
@@NEDLeducation Hi NEDL , Thank you for giving reference. Yes completely agree with you . Technical analysis is primarily eye based analysis . For quantitative coding of support and resistance the below might be possible. Take daily Low and High of given time range ( The longer the period the better outcome) and round it off . So that the data can be clustered and extract the number of repetion. The higher the repetition the stronger the support / resistance. I am completely new to coding. If possible could you please post one video based on the above. Thank you very much.
@sukriadnansangadji8232
@sukriadnansangadji8232 Жыл бұрын
how to add code for re-Entry 2, 3, 4, DLL when the price is bearish or bulihs
@kanaya1991
@kanaya1991 Жыл бұрын
hi bro, in october 2022 matplotlib.pyplot isnt avaible for pyton 3.10x. Continue using comun matplotlib?
@jitkadyan
@jitkadyan 3 жыл бұрын
Sir if we have to apply it in the live market how we can regularly update date from API and execute our trade, set buy/sell condition in live market data and take an entry, also set rules or condition that we will not buy or sell again if once buy or sell order executes and if place target and stop-loss order with buy or sell condition and if anyone order execute how to know through coding to cancel other order during the market hours, can you make a video of such type on a very popular strategy of Opening Range Breakout of 5 or 15 Minute candle High Low in a standard way that we can apply it in future in other types of strategy only changing buy or sell condition of entry in trade.
@NEDLeducation
@NEDLeducation 3 жыл бұрын
Hi, and glad you liked the video! As for your question, it largely depends on your broker or trading platform, have a look whether they have API to enable algorithmic trading, many provide Python code excerpts that you can integrate into your trading bot. Hope it helps!
@mahmood0070
@mahmood0070 Жыл бұрын
i found an error about NameError: name 'Print' is not defined
@wafike1
@wafike1 2 жыл бұрын
thanks, i have tested your code on crypto; not a very good strategy to say the least
@NEDLeducation
@NEDLeducation 2 жыл бұрын
Hi, and glad you have applied the test to your own data! I would have suspected that support and resistance would work poorly on cryptocurrencies as these are trending (positively autocorrelated) assets and (to lesser extent) are traded in different currencies so psychological barriers can be less pronounced.
Efficient portfolio frontier in Python
27:08
NEDL
Рет қаралды 7 М.
Price Trend Channels Automated In Python
27:56
CodeTrading
Рет қаралды 33 М.
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 17 МЛН
Please Help Barry Choose His Real Son
00:23
Garri Creative
Рет қаралды 23 МЛН
Finding Breakout Candidates with Python and Pandas
29:33
Part Time Larry
Рет қаралды 69 М.
Auto-detect Support and Resistance in Python
17:06
Chad Thackray
Рет қаралды 21 М.
Automated Support and Resistance Detection in PYTHON
19:25
CodeTrading
Рет қаралды 63 М.
Tutorial: Build a Technical Screener Webapp in 100 Lines of Code
52:52
Part Time Larry
Рет қаралды 95 М.
Automated Price Action Trading Strategy In Python
32:48
CodeTrading
Рет қаралды 47 М.