Tap to unmute

Automated Price Break Out Detection: Algorithmic Trading In Python

  Рет қаралды 58,912

CodeTrading

CodeTrading

Күн бұрын

Пікірлер: 166
@frankgrannell
@frankgrannell Жыл бұрын
I'm a beginner. I learnt a lot from this video. Thanks.
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Glad it was helpful! Thank you for your comment.
@changliu7553
@changliu7553 24 күн бұрын
Thank you. This one is one of the most honest and capable work.
@CodeTradingCafe
@CodeTradingCafe 24 күн бұрын
I appreciate that! Thank you!
@nuweariho6884
@nuweariho6884 9 ай бұрын
You have no idea how I tried to code this trendline with Python today and my head almost caught fire and it wasnt working well😂. I just finished coding now I was comparing with yours and i must say your code is pretty beautiful 🎉. Thank you very much. Am looking forward to re coding it in a new way.😮
@CodeTradingCafe
@CodeTradingCafe 9 ай бұрын
Glad it helped! my code is not as elegant there are some improvements to make it more professional... but it works :)
@rahulrana892
@rahulrana892 9 ай бұрын
​@@CodeTradingCafe paste your code to chatgpt & ask it to optimize :)
@BahaaOsman
@BahaaOsman 5 ай бұрын
Excellent work! Thanks. A future modification can be to add code that validates a breakout. You want to avoid fake breakouts. This can only be validated when a breakout is detected followed by a retest of the identified level then a confirmation candle in the right direction is detected. I would also add volume to the algorithm. A good breakout always occurs with strong volume
@CodeTradingCafe
@CodeTradingCafe 5 ай бұрын
Thank you for the tip I will keep it for a future video.
@vassiliscapsis5828
@vassiliscapsis5828 4 ай бұрын
A code masterpiece !!! Chapeau !!!
@CodeTradingCafe
@CodeTradingCafe 4 ай бұрын
Thank you for your constant support!
@DoctaV
@DoctaV Жыл бұрын
I really enjoy your content. An idea for a video that would be interesting to me and probably others: managing different time periods / higher time frame confirmations. When I use pandas to resample, it will do stuff like adding in weekends automatically with NaN values which is annoying (I probably don't understand the most efficient ways to do this). Also, would be interested to seeing your approach to building a signal function or stop loss strategy that look at multiple time frames simultaneously -- for instance, look for price break out at 5M but only go long if 4H is in uptrend. Keep up the good work! 👍
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Thank you so much for your support. Multi-timeframe trading is definitely a good idea that was requested before, my bad I am trying to avoid synching frames together just afraid of the quality of the data. But... I must do it!
@DoctaV
@DoctaV Жыл бұрын
@@CodeTradingCafe my idea for how to do this (which I'm planning to work on soon) is to use dt.hour and dt.minute dataframe operations to find if my current 1M candle is within the range of larger 15M candle (for instance). no idea if this is the best approach but seems reasonable to me. If I put together something working before you post a video about this, I'll send the code your way.
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
I think once the multi timeframe approach is opened, there is plenty to investigate, the more I am thinking about it the more I feel it's a priority now.
@GascanNBK
@GascanNBK Жыл бұрын
you can use this line of code to get rid of the NaN's in pandas dataframe: item.table.dropna(inplace=True)
@tmbao
@tmbao Жыл бұрын
Actualy we dont need higher timeframe because in every timeframe it self have full info about MS. Break on 4h equal 5m. Many trader need high timeframe because they analyze with two eyes. We just get a lot ohlcv item.
@weiwei2587
@weiwei2587 7 ай бұрын
Great tutorial and clear explanation!
@CodeTradingCafe
@CodeTradingCafe 7 ай бұрын
Glad it was helpful! thank you!
@InAeyMinute
@InAeyMinute Жыл бұрын
first of all thank you u so much for such great effort i have 2 questions 1 - how we can start use this in a real time data instead of historical so we can detect what breakouts of current market 2 - and how we can get a notification for any break out signal for example on our email what am trynna say i want to Strat using this indicator for real time trading
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Hi, thank you for your comment, for real time data you need to connect through your brokers API, as an example check this video: kzbin.info/www/bejne/jZTJfJSQgZmppqM Regarding the notifications check this one: kzbin.info/www/bejne/j4qtZ5yIjbisbLs Good luck!
@veds-art-world
@veds-art-world 10 ай бұрын
Have you created any video on converting live market stream data to OHLC candles and then analyzing any of your strategy live and if it matches perform buy or sell order based on signals?
@CodeTradingCafe
@CodeTradingCafe 10 ай бұрын
Hi, check this video, it's a live trading bot testing: kzbin.info/www/bejne/mIvLpamse9JkbaM
@muhammadkhalil5290
@muhammadkhalil5290 11 ай бұрын
What code editor you are using?
@CodeTradingCafe
@CodeTradingCafe 11 ай бұрын
VScode Microsoft
@JF-Gagné
@JF-Gagné 11 ай бұрын
Damn Python seems soooo nice !! I begin an introductory course and will clearly go through your content as soon as I'll be more geared ! Sooo tired of backtesting manually... Would rather like to code for 10h instead instead of having to do 1000h of backtesting...
@CodeTradingCafe
@CodeTradingCafe 11 ай бұрын
Manual backtesting is tiring, you will enjoy python and the possibilities are endless.
@JF-Gagné
@JF-Gagné 11 ай бұрын
Do you have a video explaining how to code a strategy using 2 timeframe ? (Like HTF is having a signal, and then the confirmation is done on a LTF) cheers
@CodeTradingCafe
@CodeTradingCafe 11 ай бұрын
Not yet, I have something in mind and on my todo list, but it's only a matter of time and priority.
@djprisma847
@djprisma847 9 ай бұрын
Can u give me the URL from the page, where u downloaded it. thx 3:30
@CodeTradingCafe
@CodeTradingCafe 9 ай бұрын
it's Dukascopy bank they provide data as well.
@sushka4122
@sushka4122 Жыл бұрын
Thank you for the video! Do you think this signal can be used for machine learning?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Thank you for your support, we could try it but I am afraid it might add noise to the current state of the signal. But there is only one way to find out :)
@minymaker
@minymaker 9 ай бұрын
ya you can use it for blockchain too
@anso_10101
@anso_10101 10 ай бұрын
What development environment are you using?
@CodeTradingCafe
@CodeTradingCafe 10 ай бұрын
Python, the editor is VScode
@ronakttawde
@ronakttawde 9 ай бұрын
Hey very nice code video. one suggestion that for learning purpose you can take candle index and plot it on different chart. for example chart1 = 0 to 2000 and chart2 = 2001 to 4000 etc. and so on.
@CodeTradingCafe
@CodeTradingCafe 9 ай бұрын
Thank you for your support, and for the tip, actually yes we can split into different figures.
@startupworld497
@startupworld497 6 ай бұрын
what is the backtesting result for this strategy ?
@CodeTradingCafe
@CodeTradingCafe 6 ай бұрын
As is not well, but it has to be combined with other indicators (mainly trend indicators) to provide good potential.
@mohammadirmansyah9913
@mohammadirmansyah9913 2 ай бұрын
I subscribe and registered your udemy course. Very neat and clear explanation, i hope i'll that good soon. Thank you. 😊
@CodeTradingCafe
@CodeTradingCafe 2 ай бұрын
Best of luck, and mostly enjoy learning, thanks a lot for your support.
@keelynsbradley2873
@keelynsbradley2873 Жыл бұрын
Thank you for this content ! Now you detected the break of structure, how do you code the trade part ?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
probably next video :)
@ruilacerda7469
@ruilacerda7469 Жыл бұрын
congratz for your work.all best.
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Thank you for your support!
@Rocky-iy2zb
@Rocky-iy2zb Жыл бұрын
Really nice , can you make a video on opening range breakout strategy
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Thank you, yes I will add it to a long list, but meanwhile if you are in a hurry this can be done by adapting the current video with some modifications, just compute the support let's say on the first couple of hours of the day (opening hours).
@Softbit-Website-Builder
@Softbit-Website-Builder Жыл бұрын
can we used this stratgy in live trade
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
You can, but this is one indicator you might want to combine it with another one for confirmation and of course a better trade management is crucial.
@ישראלגלטשטיין
@ישראלגלטשטיין Жыл бұрын
hii Does it connect to the Interactive Brokers system?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Currently no, but we can add the IB API functions to make it work.
@SsTradingFx
@SsTradingFx Жыл бұрын
Do you make a tradingview indicator for forex ?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Hi, sorry no tradingview just python and backtesting.
@LolkeDijkstra
@LolkeDijkstra 5 ай бұрын
Hi, I didn't really get where you downloaded the data from. I downloaded daily data from Yahoo finance for the same period and noticed that the data is actually quite different. Could you share the source with us? Thanks in advance!
@CodeTradingCafe
@CodeTradingCafe 5 ай бұрын
Hi, you can try Dukascopy, or your broker.
@VanaH-k6l
@VanaH-k6l 10 ай бұрын
Great video! Can you code for Darvas Box?
@CodeTradingCafe
@CodeTradingCafe 10 ай бұрын
Sure we can, but in my opinion it's almost the same as break out pattern strategy.
@tigoes
@tigoes 9 ай бұрын
"zone might change". Thats the whole point. Tried using atr? Using the fraction of the range between 2 zones?
@CodeTradingCafe
@CodeTradingCafe 9 ай бұрын
No haven't tried with ATR but the idea is to define a max zone width, I think out of experience a trader can somehow set it for a given asset.
@stavroskefaleas6320
@stavroskefaleas6320 4 ай бұрын
Awesome!Is it easy to convert this code to javascript?
@CodeTradingCafe
@CodeTradingCafe 4 ай бұрын
Thank you, I guess so, I think try to use chatGPT slicing the code into small parts at a time, it might work for javascript.
@samilawsy7845
@samilawsy7845 Жыл бұрын
Thank you for this very beautiful video. And code ❤
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Glad you liked it! thank you for your support!
@aaronsarinana1654
@aaronsarinana1654 Жыл бұрын
Quick question about your Udemy course, do you cover how to put your code in a live environment? I mean, with a real broker. Thanks for the video!
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
I do but very briefly, it's actually also covered here on the channel for Oanda: kzbin.info/www/bejne/jZTJfJSQgZmppqM
@GascanNBK
@GascanNBK Жыл бұрын
Well done
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Thank you, glad you liked it!
@GascanNBK
@GascanNBK Жыл бұрын
I like to ask you these two questions: 1. How does this strategy avoid fake breakouts? 2. How do you scan to find symbols to trade this strategy on?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
So far we don't avoid fake breakouts we just deal with them in trade and risk management. Symbols I just try on different assets and see where it works.
@GascanNBK
@GascanNBK Жыл бұрын
I am just working on a scanner to scan my broker's 900 symbols for strength and weakness to get a short watchlist around 10 assets for different strategies i.e MACD, RSI, Advance/Decline or so but i'm not shure what's the best strategy to scan for.
@shahabuddindanish1860
@shahabuddindanish1860 3 ай бұрын
Great work, however, correct me if I'm wrong but in the isPivot function here: for i in range(candle-window, candle+window+1) Aren't we inserting lookahead bias for the pivot calculation by look ahead of the current candle? And shouldn't this be: for i in range(candle-window, candle) Just curious what the correct way is and why you calculated it that way. Thanks!
@CodeTradingCafe
@CodeTradingCafe 3 ай бұрын
Hi, thank you for your support. You are absolutely right the function itself will cause a look ahead bias, however we used it in function detect_structure and there is a warning comment at the beginning of the function that the window parameter should be greater than the pivot window, so in other words we apply the isPivot function to candles that are in the past and we stop at currentcandle-window which should avoid the look ahead trap. I hope this helps.
@shahabuddindanish1860
@shahabuddindanish1860 3 ай бұрын
@@CodeTradingCafe Thanks for your response. I understand what you mean, however I have a different concern with this approach. Imagine using this in live trading, at that time you don't have the future candles for the isPivot function. In that case, even if you try to remove the lookahead bias through the detect_structure function, there won't be a correct way to detect pivots anyway so it won't matter. I tried to change this to detect pivots only using past data but that creates a lot of noise. However, afterwards I created a noise clearing function of my own and now it works rather nicely and the results still aren't perfect but they are closer to the original. Anyway, amazing content, your videos are very thought provoking and informative, keep up the good work 👍
@CodeTradingCafe
@CodeTradingCafe 3 ай бұрын
Thank you for your feedback. I think in live trading we can only e test for pivots in the recent past the current candle is excluded of course, even the current 4 candles let's say are excluded. Glad you found a workaround, it's never easy... but we like it :)
@afiqyahya3398
@afiqyahya3398 Жыл бұрын
I am not sure but it will be great if you can upload the source code as well in github since i cannot access google drive,blocked by my IT
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
How are you surviving without the codes! I definitely should set a git repo for this channel!
@vanaromHUOT
@vanaromHUOT Ай бұрын
Hi How to code to catch the breakout at the bottom?
@AnilSharma-sf4tr
@AnilSharma-sf4tr 10 ай бұрын
Thank you very much Dr. really enjoy your work. Just wondering do you offer any private one-to-one consulting? If so, would you mind dropping me a message?
@CodeTradingCafe
@CodeTradingCafe 10 ай бұрын
Hi, thank you for your support. I can try to help you through email, my email is in the about section of this channel.
@AnilSharma-sf4tr
@AnilSharma-sf4tr 10 ай бұрын
@@CodeTradingCafe thank you so much for getting back to me. I did look at the about section but couldn’t find one. I just found links for the other courses.
@CodeTradingCafe
@CodeTradingCafe 10 ай бұрын
Sorry, it's codingntrading gmail com
@echentj
@echentj Жыл бұрын
Hi ,Thank your for such a good pointing. After I have integrated MT5 to get real data. What i get from the function of 'isPivot' is always zero, hence when the code run towards the end of the coding, the return of function 'pattern detected' also become zero. I have tried a few way but still i get zero result. So could you point out what could be the cause of this? Thank you.
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Hi, I suspect the number of windowed candles (window parameter) and the timeframe are not matching try changing the parameters decreasing the window to 1 for example, if the problem persists then there is a problem within the function, check for small bugs like the columns names, the casing (upper or lower first letters...). The funciton should return something even for real data.
@echentj
@echentj Жыл бұрын
i did what you have told, set data collection to H1, window = 1, 'is_Pivot' did return data. But not the 'pattern_detected' function. Could you please explain more why such parameter will return data. Thank you. On top of that, previously when i use df.tail() to check the 'is_Pivot' output. Although the ' is_Pivot' output show zero but the code manage to plot graph with pivot mark on candle. Why is that so? Thank you. @@CodeTradingCafe
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Hi, at this point it's hard to debug online, but mainly the constants or hard coded values in the code they work for specific assets and timeframes if you change one you need to adjust the other.
@khalidtaalibi274
@khalidtaalibi274 Жыл бұрын
Thanks you i m for Morocco i love your videos
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Thank you Khalid for your support! Beautiful country :)
@khalidtaalibi274
@khalidtaalibi274 Жыл бұрын
@@CodeTradingCafe welcome to Morocco in any time bro i have a simple question in code modul Lstm the day interval i have problems i have trede losses i have changed in 1 h interval for your opinion is God for to work of the module if yes a must change something als in the code for adapter with 1 h interval.thank you very much
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Hi, honestly I tried LSTM for trading and all I can say is that it doesn't work well, if you're doing it for education purposes then it's good but for trading it's not as good.
@khalidtaalibi274
@khalidtaalibi274 Жыл бұрын
@@CodeTradingCafe thanks you very much yes i want to try with demon account and si how it worksk. The last question what the perfect time the run the code in beginning of open the Marchés ?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
I think the algos work well during the US session
@muneebahmed292
@muneebahmed292 Жыл бұрын
Very nice and informative video...But I have one query regarding that how we can use this code on daily basis for the breakouts...I mean it worked absolutely fine for previously loaded data but if we want the stocks or scripts from the collection of scripts..how we can optimize this script ???
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Hi, thank you. We can use the function detect_pattern using different dataframes for different assets, the only modification is to move some parameters as input argument for the function because these will be asset dependent (like the zone width for example).
@Medvech
@Medvech Жыл бұрын
Could you rewrite this to detect channel break. I mean now we can detect only breaking of horizontal channel (or price level). It's can be ok for the Forex, but not for the stock definitely.
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Yes with a similar approach it can be rewritten for channels I can do it for the coming weeks/videos, might need some time though.
@davidsaurel4012
@davidsaurel4012 Жыл бұрын
Already did a video about channel break out detection using linear regression no ?
@ScrollWithSantoshh
@ScrollWithSantoshh 7 ай бұрын
What would be the value of zone_with and other parameters for 1 min data, im not getting any level breaks
@CodeTradingCafe
@CodeTradingCafe 7 ай бұрын
It's hard to give a value this depends on the asset, check the charts it's easier to set a number visually.
@bombasticiti
@bombasticiti Жыл бұрын
Thanks brother, Wonderful Code
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
You are welcome, I am glad it's helpful. Thank you for your support.
@enotbert
@enotbert Жыл бұрын
Hi there. Another awesome video. While playing with my data pivot points are very often placed on neighboring candles. I tried to get rid of this issue by increasing the pivot window, but it didn't work. The only solution I was able to implement was to disallow placing a pivot point if there is already one next to it. But I have a feeling that this is not the right solution. How else can I solve this situation?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Thank you for your support. The reason you may have 2 close pivots is because they might have the same extreme value (high or low) but the way you are proposing is also good just discard a pivot if one of the same level is very close, at the end you need one pivot placed in each "zone/area". Good luck!
@farzadkhajeh870
@farzadkhajeh870 8 ай бұрын
thanks dear , it's cool
@CodeTradingCafe
@CodeTradingCafe 8 ай бұрын
I'm glad you like it, thank you for your support.
@Analysis_111
@Analysis_111 11 ай бұрын
you are there great man for learn code, but i have request use yahoo for data
@CodeTradingCafe
@CodeTradingCafe 11 ай бұрын
Hi thank you, Yahoo finance package yfinance for python is not supported anymore and some of the data I got was not reliable.
@esquire9445
@esquire9445 Жыл бұрын
Good jon
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Thank you!
@vladislaviy
@vladislaviy 10 ай бұрын
nice! are you making money with it?
@CodeTradingCafe
@CodeTradingCafe 10 ай бұрын
Hi, thank you, no not this strategy, I don't run many strategies only few.
@seifyehia9113
@seifyehia9113 Жыл бұрын
Can you give a discount on Data Analysis With Pandas And NumPy In Python course?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Sure www.udemy.com/course/data-analysis-with-pandas-and-numpy-in-python/?couponCode=7B9ACF76734A59AA0CB4 Good luck!
@viaanfc
@viaanfc 11 ай бұрын
thanks
@CodeTradingCafe
@CodeTradingCafe 11 ай бұрын
You're welcome! thank you for your comment.
@CCNATamilTutorials
@CCNATamilTutorials Жыл бұрын
Hi sir, i need Automatic trading bot for binomo platform based, 1min buy sell scalping strategy
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
Hi, I am not familiar with binomo I am not sure they provide a python API.
@CCNATamilTutorials
@CCNATamilTutorials Жыл бұрын
@@CodeTradingCafe fine I understand, I have a scalping strategy for binary options trading ( 1min buy and sell concept) , need a bit for auto trading, what can I do, how to search.
@luttycorp
@luttycorp 9 ай бұрын
i recomend you get the code then watch the video while adding your own comments in the code
@CodeTradingCafe
@CodeTradingCafe 9 ай бұрын
Thank you, I agree, it's a good way to go through the session/video.
@luttycorp
@luttycorp 9 ай бұрын
@@CodeTradingCafe IS there a way i can send you code built around your work am now to programing so i keep running into errors concering the table information being used for other parts of the code
@imranaalam
@imranaalam 3 ай бұрын
SMART MONEY
@CodeTradingCafe
@CodeTradingCafe 3 ай бұрын
I agree, it's good, but also a bit overrated
@kudzovu
@kudzovu Жыл бұрын
wow, you are very handsome
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
lol, thank you!
@krunalpatelbiotech
@krunalpatelbiotech 8 ай бұрын
Not useful for real trade. Need Realtime signal generated from bunch of stocks list, not from just single stock. If you want to become profitable.
@CodeTradingCafe
@CodeTradingCafe 8 ай бұрын
The same method/function can be cloned and used for as many stocks and currencies as needed, at the end it's the same algorithm that we can repeat... But I agree with you, I would change the function to make it applicable for live data instead of ready/historical data.
@trocchiettoski
@trocchiettoski 7 ай бұрын
@@CodeTradingCafe one of the main challenges i have with your videos is 1) how with elegance to adapt a trading strategy for one stock to multiple stocks to make a scan. I usually cut the number of candles ex [-50:] but in this way could have more than one signal 2) adapt from forex to stock.As your channel is educational maybe could be appreciated a video where you explain how to address some daily jobs as the ones above. Personally instead of a fixed width i adapt with atr or bollinger to detect stocks breakout, because the difference between an high and the mean of the 3 points can be really variable depending by the level of price. Another solution would be to use a percentage. Thanks for the nice content
@kamleshkumar-yy2rw
@kamleshkumar-yy2rw 5 ай бұрын
At least you do this basic part on your own, he has explained well about the algorithm on historical data. Those who understood the algorithm can refactor the code a bit to run on live candle data. 😂
@vanaromHUOT
@vanaromHUOT Ай бұрын
Hi I would like to create a bot, will you be able to do it?
@krunalpatelbiotech
@krunalpatelbiotech Ай бұрын
@@vanaromHUOT still learning for proper strategy bot creation.
@AnmWorshipSong
@AnmWorshipSong Жыл бұрын
hi how to contact you any telegram id ?
@CodeTradingCafe
@CodeTradingCafe Жыл бұрын
My email is in the about section, no telegram sorry, good luck!
Auto-detect Support and Resistance in Python
17:06
Chad Thackray
Рет қаралды 23 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
How Financial Firms Actually Make Money
22:40
QuantPy
Рет қаралды 374 М.
GPT: KAMA Scalping Strategy in Python Makes 795%
21:00
Algo-trading with Saleh
Рет қаралды 24 М.
Trading with Python: Simple Scalping Strategy
13:47
CodeTrading
Рет қаралды 106 М.
How To Build A Trading Bot In Python
18:46
CodeTrading
Рет қаралды 859 М.
Rayner Teo Bollinger Bands Strategy Backtest In Python High Return
23:29