Magnificent presentation. I’ve been working on a rather complex algorythm for a while and this video tackles many elusive elements of the code I was after. All your vids I have seen so far are top notch. Thanks for sharing the knowledge.
You are simply great. I was thinking of something like this from very long time. But as i lost touch to trigonometry after high school it was very time consuming to go back and work on it. You saved my numerous amount of time. God bless you. Thanks is not enough for sharing this.
Well spotted, I think I was lucky it worked still in this case, I don't think it would make a difference here, you can try it if you have time. Thank you for the heads up!
@@CodeTradingCafe Can you please pin this comment and correct the code in the downloadable file? This issue has cost me a couple of days to find. I had earlier scripts using this snipplet. Later, when I rewrote some code, I must have accidentally fixed this. The output of earlier data did then not match the new code. Try to find that one missing i and why it even made a difference! (plus when using VIM it can happen to accidentally/randomly add "i" into any code :) ) Thank you for this example!
Very interesting. Thank you for sharing. I would suggest that the distance of the channel should be related with "sort of ATR" that is intrinsic to the price action (I like to use keltner channels with coeficient 1.2). Also makes more sense that the stop and or take profit are related with ATR instead extremes values, so the position is related to average prices and not a specific value. An approach might be to have 80 or 90 % of the points inside the channel, this is like taking a standard deviation criteria.
Hi thanks, yes I didn't think of it this way (considering almost 95 percent of data inside the channel) good approach. Extreme values are not the best way they lead to large channels.
Thanks for sharing your work. I would suggest you one video for the future, related to this one, how to calculate the distance between a point(Close price) and a trend line(for example the upper trend line in this double channel) using pandas, it seems easy to do in paper, but in code I could not, the main difficulty was how to extend trend line to the infinite. This would help using this tutorial to detect when price gets closer and send alerts.
Hi thank you for this, in fact once you establish your trend line equation it's not complicated, you can get the distance as the difference between the price and the trend line height which you can obtain from the line equation using the current candle index
Excellent Video & presentation, request you to make a combined strategy combining VWAP,Supertrend,RSI, Billinger bands- multiple indicators, along with this & previous codes, Thanks.
Hi thank you, you can force parallel upper and lower lines of the channel by lowering the difference between the slopes, there is a parameter in the code for this
Hi. Very useful video and explanation. Am trying to determine wherher a parallel price channel is possible for a candlestick chart, where both will touch atleast two points. can these be done with help of this?Thanks In Advance.
@@CodeTradingCafe Thank you so much . Could you please guide where shall I put the limit and check, I have tried but not being able to draw a trendline, which passes through atleast two high, or low points
would this be possible to be used on MFI indicator. The strategy that i use without any algorithm is that i look for a descending trendline using the higher lows in MFI indicator. When the current MFI value crosses above that trend line, i buy. Im stuck figuring out how to check that the current MFI value has crossed above the trend line.
Hi, thank you, there is no way to know if current price is the beginning of a channel, unfortunately we have to wait for a few movements to guess that the price is moving within a certain Channel, also it's impossible to know when the channel is over you might look for breakouts but it's not a confirmation
I'm having a bit of trouble backtesting this - I'm trying to loop through the dataframe to visualize all of the different trendlines as the data changes - but the issue is that it seems that the parameters of the function are predefined so that each time it iterates it gives me the same results. Any ideas on how to solve this? Thanks
Hi, any variable you want to modify you can put it as an argument for the function and modify it while you call the function accordingly. But if you don't have some python experience it might take some time before running things smoothly. Good luck!
@@CodeTradingCafe I do have some experience, but this is tricky ... how could I modify the variables if all of the parameters change each time I iterate i? I'm thinking I need to change only the candleid, with a parameter like candleid+1 for each iteration ... but it doesn't seem to have worked yet
Nice job, but what I'm looking for is the coordinates of channel, not plotting that, I mean I need the values of each support and resistance lines per candle, can you help me?
Hi, thank you for your comment, it's a bit challenging in the sense that there is no strategy presented it's just channel detection, we still need TP SL entry exit rules for a full strategy.
In fully automated mode yes it's hard to find the right combination. The best way is to make it as an automated indicator with email notifications so the trader can still take action not the bot.
Yes honestly I have been thinking about it, however detecting all the patterns in one go will make a very long video, I will see how to present this... Added to the list
@@CodeTradingCafe yes it would be great if you can make a video about chart pattern detection (e.g: head n shoulders, double bottom, triple top, triangle, etc). Awesome video thanks for the lesson!
Not in this video, but I have been using live data and trading live, there are couple of videos covering this topic in this playlist, but it's for oanda API.
Not the same way, binance have their own API but it must be very similar, at the end you have functions tools like a function to buy another to sell and so on...
@@CodeTradingCafe thanks. I've already got some coding done to buy and sell etc. I guess the main thing I'd like to know is how does it get the real time data to draw the trend lines as opposed to taking old data from an excel.
@@newbienoob1 if you need realtime data you can check if your broker provides a python API I know oanda does and I have used it for live automated trading
@@CodeTradingCafe I'm wondering if it's above or below the trendline for each close value. Thanks for telling me how to do it. But can you share a small example?
@@batuhanbayraktar337 the easiest to start is to take the slope of the so called channel lines and measure if it's positive or negative so you know it's an uptrend or a downtrend
Activate the Thanks! button in your videos. When I earn money with algorithms that I started to develop based in ideas that come to me analyzing your ideas, I want to push these buttons in your channel here. Thanks.
@@CodeTradingCafe I got error from local Pc and Google colab.. AttributeError Traceback (most recent call last) in () 6 xxmax =np.array([]) 7 for i in range(candleid-backcandles, candleid+1, wind): ----> 8 minim = np.append(minim, df.low.iloc[i:i+wind].min()) /usr/local/lib/python3.7/dist-packages/pandas/core/generic.py in __getattr__(self, name) 5485 ): 5486 return self[name] -> 5487 return object.__getattribute__(self, name) 5488 5489 def __setattr__(self, name: str, value) -> None: AttributeError: 'DataFrame' object has no attribute 'low'
hands down the best video at this topic, you are the only one who did a comprehensive work. keep it up :)
Thanks a lot for your comment!
Magnificent presentation. I’ve been working on a rather complex algorythm for a while and this video tackles many elusive elements of the code I was after. All your vids I have seen so far are top notch. Thanks for sharing the knowledge.
Glad it was helpful! and thank you for your comment!
You are simply great. I was thinking of something like this from very long time. But as i lost touch to trigonometry after high school it was very time consuming to go back and work on it. You saved my numerous amount of time. God bless you. Thanks is not enough for sharing this.
Thanks a lot for your support, it is nice to know that these videos are useful
Nice work, reminds me of Bollinger bands with fine tuning. I like the way you explain and translate ideas into code.
Thanks a lot for your support, I really enjoy making those videos 🙂
Great video. Thanks for the detailed analysis and clearing the assumptions taken.
Thank you for your support!
Thanks for the educational video! @ 11:56 in the second for loop at line "maxim = ..." should loc be iloc?
Well spotted, I think I was lucky it worked still in this case, I don't think it would make a difference here, you can try it if you have time. Thank you for the heads up!
@@CodeTradingCafe Can you please pin this comment and correct the code in the downloadable file?
This issue has cost me a couple of days to find. I had earlier scripts using this snipplet. Later, when I rewrote some code, I must have accidentally fixed this.
The output of earlier data did then not match the new code. Try to find that one missing i and why it even made a difference! (plus when using VIM it can happen to accidentally/randomly add "i" into any code :) )
Thank you for this example!
Excellent video mate, really well presented and explained
I am happy you liked it, thank you for your support 😊
Very interesting. Thank you for sharing. I would suggest that the distance of the channel should be related with "sort of ATR" that is intrinsic to the price action (I like to use keltner channels with coeficient 1.2). Also makes more sense that the stop and or take profit are related with ATR instead extremes values, so the position is related to average prices and not a specific value. An approach might be to have 80 or 90 % of the points inside the channel, this is like taking a standard deviation criteria.
Hi thanks, yes I didn't think of it this way (considering almost 95 percent of data inside the channel) good approach. Extreme values are not the best way they lead to large channels.
Wonderful teaching. Thank you!
Thank you for your support! It counts 🙂
Super usefull video... Many thanks.. I'll try to reproduce this now... Thanks again
Thank you for your comment, good luck!
Thanks for sharing your work. I would suggest you one video for the future, related to this one, how to calculate the distance between a point(Close price) and a trend line(for example the upper trend line in this double channel) using pandas, it seems easy to do in paper, but in code I could not, the main difficulty was how to extend trend line to the infinite. This would help using this tutorial to detect when price gets closer and send alerts.
Hi thank you for this, in fact once you establish your trend line equation it's not complicated, you can get the distance as the difference between the price and the trend line height which you can obtain from the line equation using the current candle index
Excellent Video & presentation, request you to make a combined strategy combining VWAP,Supertrend,RSI, Billinger bands- multiple indicators, along with this & previous codes, Thanks.
Thank you for your comment
excellent video sir. What is your idea if we want perfect channels (support and resistance are parallel) ?
Hi thank you, you can force parallel upper and lower lines of the channel by lowering the difference between the slopes, there is a parameter in the code for this
@@CodeTradingCafe Thank you sir for replying. Can you tell us where to download the data sets of different time frames?
@@ravichandra498 I usually use dukascopy website I recap I did it in one of my early videos only I don't remember which one
Great video and explanation. Thanks
Thank you for your support, I am glad you foind the content interesting
This content is amazing thank you so much brother
Thank you, good luck for your trading
Hi. Very useful video and explanation. Am trying to determine wherher a parallel price channel is possible for a candlestick chart, where both will touch atleast two points. can these be done with help of this?Thanks In Advance.
Hi thank you. Definitely yes, you can take this code and just limit and change the number of points touching the channel, should work. Good luck!
@@CodeTradingCafe Thank you so much . Could you please guide where shall I put the limit and check, I have tried but not being able to draw a trendline, which passes through atleast two high, or low points
would this be possible to be used on MFI indicator. The strategy that i use without any algorithm is that i look for a descending trendline using the higher lows in MFI indicator. When the current MFI value crosses above that trend line, i buy. Im stuck figuring out how to check that the current MFI value has crossed above the trend line.
Yes definitely it works as well, did you check the video on RSI divergence detection? It might be similar to what you are looking for.
This was pretty awesome. In live scenario, any idea how to figure out beginning of the channel?
Hi, thank you, there is no way to know if current price is the beginning of a channel, unfortunately we have to wait for a few movements to guess that the price is moving within a certain Channel, also it's impossible to know when the channel is over you might look for breakouts but it's not a confirmation
Evidence-based ! Thanks 👍
Always from the lab to TH-cam
Can you please make a video of ascending triangular pattern?
Kind of challenging I will look into it, but will need time the list is long. Good luck
I'm having a bit of trouble backtesting this - I'm trying to loop through the dataframe to visualize all of the different trendlines as the data changes - but the issue is that it seems that the parameters of the function are predefined so that each time it iterates it gives me the same results. Any ideas on how to solve this? Thanks
Hi, any variable you want to modify you can put it as an argument for the function and modify it while you call the function accordingly. But if you don't have some python experience it might take some time before running things smoothly. Good luck!
@@CodeTradingCafe I do have some experience, but this is tricky ... how could I modify the variables if all of the parameters change each time I iterate i? I'm thinking I need to change only the candleid, with a parameter like candleid+1 for each iteration ... but it doesn't seem to have worked yet
You can also use hull moving average turning points to obtain minima and maxima
Thanks I will have a look and see maybe incorporate it into future indicators. Thanks for sharing!
Nice job, but what I'm looking for is the coordinates of channel, not plotting that, I mean I need the values of each support and resistance lines per candle, can you help me?
Hi, yes it's easy to get these are already in the array before plotting
Great video, Could you make a video backtesting it?
Hi, thank you for your comment, it's a bit challenging in the sense that there is no strategy presented it's just channel detection, we still need TP SL entry exit rules for a full strategy.
Thank you sir for this video please make a video on renco chart and supertrend indicator stretegy
Thank you for your comment, unfortunately I am not familiar with the supertrend indicator, I have to check it out
Thanks for ur vedio , I am wondering this method can used for US stock ? Does it can help us to make money in stock market?
Hi, thank you, this is not a fully completed strategy it's an example of trading from python, it can be modified to make it in stock market.
have u ever backtested your strategies . honestly coding it is the easy part. finding a good profitable strategy is the hard part
In fully automated mode yes it's hard to find the right combination. The best way is to make it as an automated indicator with email notifications so the trader can still take action not the bot.
Great video Sir
I'm glad it's helping
Sir Highly request, write a code Stock pattern screener like head and shoulders etc.
Yes honestly I have been thinking about it, however detecting all the patterns in one go will make a very long video, I will see how to present this... Added to the list
@@CodeTradingCafe yes it would be great if you can make a video about chart pattern detection (e.g: head n shoulders, double bottom, triple top, triangle, etc). Awesome video thanks for the lesson!
@@pietraderdetective8953 hi thank you for your comment, this has been requested many times now I must try do do it, challenging to be honest
Thank you for great content
Thank you for your comment!
Sri,please please make a video on supply and demand,thanks for this video
Thank you I will look into it, can you provide materials since I am not sure what is your exact request
How would I go about doing this using real time data from Binance? You haven't used real time data have you?
Not in this video, but I have been using live data and trading live, there are couple of videos covering this topic in this playlist, but it's for oanda API.
@@CodeTradingCafe thanks for the quick reply. Would that work with the Binance API too do you think?
Not the same way, binance have their own API but it must be very similar, at the end you have functions tools like a function to buy another to sell and so on...
@@CodeTradingCafe thanks. I've already got some coding done to buy and sell etc. I guess the main thing I'd like to know is how does it get the real time data to draw the trend lines as opposed to taking old data from an excel.
@@dwaynetrinidad432 for the oanda account a function called candle collector brings latest data, I usually call it every 30 min using scheduled calls.
Sir where u get those data with real volume ?
Dukascopy, or yfinance if you are familiar
@@CodeTradingCafe thank u sir yfinance it's paid for realtime data dukascopy i don't have any idea
@@newbienoob1 if you need realtime data you can check if your broker provides a python API I know oanda does and I have used it for live automated trading
@@CodeTradingCafe oanda isn't available in morocco and the majority of brokers do not provide real volume data only tick volumes
@@newbienoob1 yes live volume data might be difficult and anyway we wouldn't know, dukascopy provides historical data though
Nice Sir 💯
Thank you for your support
nice video!! thx
Glad you liked it, good luck!
Cup and handle pattern detection please.
I will check it out but might need few weeks because I made a list of requests
@@CodeTradingCafe sure take your time. I am yet to check you other videos. I feel I discovered gold mine.
I want to adapt this trend algorithm to the whole dataset and get the trend information in the form of an array. Has anyone tried?
You would need to put it in a function and then apply the function on each row of the dataset so you get the trend at each position
@@CodeTradingCafe I'm wondering if it's above or below the trendline for each close value. Thanks for telling me how to do it. But can you share a small example?
@@batuhanbayraktar337 the easiest to start is to take the slope of the so called channel lines and measure if it's positive or negative so you know it's an uptrend or a downtrend
@@CodeTradingCafe still ı couldnt D:
It's easier to learn some python libraries before coding trading bot, it's worth it on the long term. And will make your experience easier with time.
Please upload code video on stochastic divergence.
Hi I will check it out but it's going to be a while... List is long. Thank you for your support
@@CodeTradingCafe Thanks for reply .
Activate the Thanks! button in your videos. When I earn money with algorithms that I started to develop based in ideas that come to me analyzing your ideas, I want to push these buttons in your channel here. Thanks.
Thanks a lot for your support 😊 I am glad these videos are useful for learning and maybe one day for trading. Good luck to you!
I think it will be better if you implement ai, ml, rl, dl
Well it's a wide range of possibilities, I would say extremely wide to explore... but definitely I will have to revisit AI soon.
df.low.iloc get error for that how do you get it?
Hi post the whole line please where you are getting the error, and the error message
@@CodeTradingCafe I got error from local Pc and Google colab..
AttributeError Traceback (most recent call last)
in ()
6 xxmax =np.array([])
7 for i in range(candleid-backcandles, candleid+1, wind):
----> 8 minim = np.append(minim, df.low.iloc[i:i+wind].min())
/usr/local/lib/python3.7/dist-packages/pandas/core/generic.py in __getattr__(self, name)
5485 ):
5486 return self[name]
-> 5487 return object.__getattribute__(self, name)
5488
5489 def __setattr__(self, name: str, value) -> None:
AttributeError: 'DataFrame' object has no attribute 'low'