Hi, very nice work. Just one thing, in the function mytarget, the last 4 rows of dataframe became nan, because range(0,lenght-3-1). If we put this on realtime the most recent values are nan. You use rsi, try use 3 EMA’s. 3, 6 and 9, if the 3 EMA its above 6 and 9 EMA we are in a uptrend for example. Continue with nice work
Hi, thank you for your feedback, I see what you mean. In fact I have tried the 3 moving averages before (not in video) it also gives good information. I will try to include it in future videos... (thank you for the idea :) )
I am following your videos regularly, and other youtube channels, more or less many are teaching the same, basing on pattrens and moving averages, could you able to do price action trading only, with out using any indicator, how will you spot up trend, down trend and sideways, impulse move and correction, how to take trade in a time frame, with respect to higher time frame. Please make a video on price action, no one is doing on this, are they feeling difficult or they don't know ?
Hi, price action is powerful I agree, but there are a lot of ideas to study, did you mean something like these videos: ruclips.net/video/oyuyeYi_7rw/видео.html ruclips.net/video/2Q_qXmNcsZw/видео.html ruclips.net/video/b5m7BZAHysk/видео.html or you have something more specific in mind?
@@CodeTradingCafe yes my friend, I don't trust and even you might also know about, all the indicators are lagging in nature, so only through price action, top down multi time frame analsys, will give better results, with optimum risk to reward , so that's why I am requesting you to make a video to see price action kind of live trade using algo python code. I searched many youtube channels, no one ever done it, this could be a great video if you can do it, many will instantly follow 10 folds. just think about it have a good day
it's alright the point of the shooting star is that you should take into account the candles before you kinda do it with the RSI, the problem is that RSI is less precise although 750 failed but 756 was correct. If you notice the shooting star in the false positive example correctly predict the "next" bar. Sure enough if you put lower TP and lower SL you may convert more candles in less false. instead of checking for a trend the algo should check for the next 1 2 bars and then close the position not at TP but TP based on timing. In a sense would be profitable if you calculate in real time around "power hour" or at almost closing but not at close directly because the order will be executed the morning after . The closing and TP should be at market - if reaches TP and at "almost closing" on day n+2
Hello, you are right in fact it's frustrating that so many good signals result in loosing trades just because of TP SL methods, I should revise these differently, a time based trade seem interesting to try.
@@CodeTradingCafe Yeah, you may create an histogram function using the dictionary to allocate frequecy based on the aplitude of the shooting star. an example if the shooting star's tail is over 2.00 to 2.25 the body check if the next candle is positive and trying to guess based on the Shooting star what would be the next candle. Generally if you have a short candle the next one will be a short candle. If it is so you can use various type of shooting star as Key and the frequency as values and plot then an histogram that checks the distribution. once is done you can use the most frequent shooting start parameters to check how many times the next candle is positive or negative and in what magnitude simply looping the selected key recording the different values (which will be the next candle) def x (s): for s in graph: if s == 2.25 to 2.5: return s[key] = [next_candle] else: xxxxxxxxxxxxx somethign like this with ofcourse the right sintax and the right variables... but in short should be able to return a key correspondent to the shooting star selected and a list with all the next candle. d = {shootingstar2.25to2.5 : [+3, +4, +3 etc.]} then plot an histogram to check the frequency In that case you have a "normal distribution" or a gaussian curve. it's a lot of data cleaning in reality, but in this case you are able to filter based on the most likely event after the shooting star. If the distribution is not "normal" means the pattern is random for that asset and therefore you cannot use it and Technical Analysis is wrong. It improves odds dramatically
I probably see what you mean, I would do it differently, I woul plot the distribution of the candle ratios when the next candle is in the same direction... No data cleaning just plotting what we need, meaning for every candle where the next candle is of the same direction just put the ratios of the candle wicks and body into histograms.
Thank you for your comment, not specifically however you can use the same algorithms explained here for Indian shares or any other market I believe these methods are standard everywhere. Good luck
i am doing scalping by using 1min candle at certain time, so at that particular time I want to place sell and buy order for the previous one min candle high and low, it is possible to write code for this
Actually rereading the comments I realized this is easier than I thought, it can be done using backtesting.py package just check my Rayner Teo video I used this feature already like putting delayed orders at some levels (min and max of previous candle in this case). I will be checking a strategy with this feature but it is going to be a while currently on a different track.
It's possible taking into account the algo might discover a different shape as well like hammer or doji in this case. Edit: actually it might be a good idea for a new video, like let the algo find the best winning candle shape... will think about it
@@CodeTradingCafe just my humble opinion. I tried talib but not able to detect shooting star's hourly candle and I searched google for an answer and found your video. Clear and precise explanations. Will try out your codes. By the way, do u have website or do u book on python TA for candlesticks.
Thank you for your comment, I honestly found pandas ta very easy to use I might do another video just showing the features (simply calling indicators functions) if you find it useful. If you get in trouble with pandas ta let me know I might be of help. Edit: no website unfortunately my time is squeezed, books yes (in radiation physics :) )
Hey thank you for sharing your results. Actually you might need to optimize parameters for each stock, and back and forward test to make sure results are robust. But yes it needs optimization first.
Best video on Candlestick strategy + RSI on RUclips & any opensource platform. Interested to contact you personally regarding some strategy improvisation.
@@SP-db6sh I m not familiar with backtesting libraries in Python (maybe I should start having a look at these) but here backtesting would be a trap! It will definitely provide good results because we are backtesting on the same data we used for tuning our parameters, so our model has already something of the data in memory. The correct way to test here is to run automated trades on a demo account, this way you would be testing on new data, the only problem is that it will take time, I would say at least 6-8 month to have a reliable result, since we are using daily candles. (Of course this time drops down if we try a model for the 4 hours candles instead)
@@CodeTradingCafe It works after copying the file as it is into my folder. I use VScode and was copying the content of the file from notepad++ into a new file in VScode. Somehow it does not identify the file that way. Thanks!!
why you do all your strateies in large time frame like the daily timeframe? if you use a smaller timeframe you will get more signals and that mean more profit? if the strategy is correct, of course it is harder but is it correct?
@@paulbrown5839 it's true depending on the strategy's you might try it with a small account trading on different currencies to increase trades number, you could get an idea in about 3 to 4 months.
@@CodeTradingCafe I am thinking on replace the RSI or add to it, to confirm the trigger when there are an volume aceleración. Sounds good? How could be done?
@@sergiomiguel1960 Yes if I understood correctly it's straight forward, we already have a column with the "volume" in the data, so if it's "high" enough we confirm a buy signal? what about the sell signal?
@@CodeTradingCafe the idea is to use an indicator that shows the volume is increasing, is not enough to see the volume. The volume is high in comparative with?
i love all your videos brother, nice content, thanks for the vide.. can you tell how can i code ORB with 2 candles inside the range & entry on any candle breaking out of the range ORB high ORB low condition1 candle2 high < orb high and candle low > orb low enntry: condition 1 is true & price> orb high "place order" can you help me to code the condition1, lets say market opens @ 5pm EST then ORB high & LOW of 1st 5 min candle & in the condition1 , i want to consider next candle after 5 mins, if it is in the ORB range & then any candle breakouts then entry... plz.. plz help me to code this
@@iamprashantjain it depends how many candles you need to consider to define your range, let's say 5 candles so you will find the max high and the min low among these candles these will be your range limit, then any candle exceeding these values up or down is the break out candle. I would think of it this way as a first attempt
@@CodeTradingCafe I do the same but only issue is.. I can code ORB but not nth candle so I can compare high1 low1 to orbhigh & orblow.. Can you enlighten taking code as example ??
i encounter this error for the code below nan /usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:7: RuntimeWarning: invalid value encountered in long_scalars import sys trendId=2 print(df[df['result']==trendId].result.count()/df[df['signal1']==trendId].signal1.count()) df[ (df['result']!=trendId) & (df['signal1']==trendId) ] # false positives
Thanks!
Thank you!
Thanks for sharing. I like the clarity with which you explain. Thanks a lot.
Thank you for your support, and for your comment it's nice to know that this content is of help.
Hi, very nice work. Just one thing, in the function mytarget, the last 4 rows of dataframe became nan, because range(0,lenght-3-1). If we put this on realtime the most recent values are nan.
You use rsi, try use 3 EMA’s. 3, 6 and 9, if the 3 EMA its above 6 and 9 EMA we are in a uptrend for example. Continue with nice work
Hi, thank you for your feedback, I see what you mean. In fact I have tried the 3 moving averages before (not in video) it also gives good information. I will try to include it in future videos... (thank you for the idea :) )
Thank you for sharing!! really helpful! Have Been struggling to code candlestick patterns for a while,!
Glad you liked it, more is coming...
I am following your videos regularly, and other youtube channels, more or less many are teaching the same, basing on pattrens and moving averages, could you able to do price action trading only, with out using any indicator, how will you spot up trend, down trend and sideways, impulse move and correction, how to take trade in a time frame, with respect to higher time frame.
Please make a video on price action, no one is doing on this, are they feeling difficult or they don't know ?
Hi, price action is powerful I agree, but there are a lot of ideas to study, did you mean something like these videos:
ruclips.net/video/oyuyeYi_7rw/видео.html
ruclips.net/video/2Q_qXmNcsZw/видео.html
ruclips.net/video/b5m7BZAHysk/видео.html
or you have something more specific in mind?
@@CodeTradingCafe
yes my friend, I don't trust and even you might also know about, all the indicators are lagging in nature, so only through price action, top down multi time frame analsys, will give better results, with optimum risk to reward , so that's why I am requesting you to make a video to see price action kind of live trade using algo python code.
I searched many youtube channels, no one ever done it, this could be a great video if you can do it, many will instantly follow 10 folds.
just think about it
have a good day
it's alright the point of the shooting star is that you should take into account the candles before you kinda do it with the RSI, the problem is that RSI is less precise although 750 failed but 756 was correct.
If you notice the shooting star in the false positive example correctly predict the "next" bar.
Sure enough if you put lower TP and lower SL you may convert more candles in less false.
instead of checking for a trend the algo should check for the next 1 2 bars and then close the position not at TP but TP based on timing.
In a sense would be profitable if you calculate in real time around "power hour" or at almost closing but not at close directly because the order will be executed the morning after .
The closing and TP should be at market - if reaches TP and at "almost closing" on day n+2
Hello, you are right in fact it's frustrating that so many good signals result in loosing trades just because of TP SL methods, I should revise these differently, a time based trade seem interesting to try.
@@CodeTradingCafe Yeah, you may create an histogram function using the dictionary to allocate frequecy based on the aplitude of the shooting star.
an example if the shooting star's tail is over 2.00 to 2.25 the body check if the next candle is positive and trying to guess based on the Shooting star what would be the next candle.
Generally if you have a short candle the next one will be a short candle.
If it is so you can use various type of shooting star as Key and the frequency as values and plot then an histogram that checks the distribution. once is done you can use the most frequent shooting start parameters to check how many times the next candle is positive or negative and in what magnitude simply looping the selected key recording the different values (which will be the next candle)
def x (s):
for s in graph:
if s == 2.25 to 2.5:
return s[key] = [next_candle]
else:
xxxxxxxxxxxxx
somethign like this with ofcourse the right sintax and the right variables...
but in short should be able to return a key correspondent to the shooting star selected and a list with all the next candle.
d = {shootingstar2.25to2.5 : [+3, +4, +3 etc.]} then plot an histogram to check the frequency
In that case you have a "normal distribution" or a gaussian curve.
it's a lot of data cleaning in reality, but in this case you are able to filter based on the most likely event after the shooting star.
If the distribution is not "normal" means the pattern is random for that asset and therefore you cannot use it and Technical Analysis is wrong. It improves odds dramatically
I probably see what you mean, I would do it differently, I woul plot the distribution of the candle ratios when the next candle is in the same direction... No data cleaning just plotting what we need, meaning for every candle where the next candle is of the same direction just put the ratios of the candle wicks and body into histograms.
Excellent explanation. Have made any bot for indian share market?
Thank you for your comment, not specifically however you can use the same algorithms explained here for Indian shares or any other market I believe these methods are standard everywhere.
Good luck
i am doing scalping by using 1min candle at certain time, so at that particular time I want to place sell and buy order for the previous one min candle high and low, it is possible to write code for this
Hi, yes of course but you will have to include the time column into your coding, pandas has this feature already.
@@CodeTradingCafe thanks for your reply, if possible make one video for this
@@samraj46 I will it goes along with multi timeframe trading need to use date time, but it will take some time.
Hello, did u manage to do this? I'm looking for the same exact thing.
Actually rereading the comments I realized this is easier than I thought, it can be done using backtesting.py package just check my Rayner Teo video I used this feature already like putting delayed orders at some levels (min and max of previous candle in this case). I will be checking a strategy with this feature but it is going to be a while currently on a different track.
very nice work! It would be nice to optimize the parameters through a routine to find the best winning settings.
It's possible taking into account the algo might discover a different shape as well like hammer or doji in this case.
Edit: actually it might be a good idea for a new video, like let the algo find the best winning candle shape... will think about it
Great video! Thank you!
Thank you for your comment!
Talib has functions for candlestick pattern recognition but you didn't used it ?
I am not aware of it, I will look into it and see what it does
But I usually prefer to know what's happening inside the function just in case it might give false signals
@@CodeTradingCafe just my humble opinion. I tried talib but not able to detect shooting star's hourly candle and I searched google for an answer and found your video. Clear and precise explanations. Will try out your codes. By the way, do u have website or do u book on python TA for candlesticks.
Thank you for your comment, I honestly found pandas ta very easy to use I might do another video just showing the features (simply calling indicators functions) if you find it useful. If you get in trouble with pandas ta let me know I might be of help.
Edit: no website unfortunately my time is squeezed, books yes (in radiation physics :) )
nice contribution and very well explained , thank you
can you share the code please as some of the code is not visable (line 7)
Hi, thanks, the Jupyter notebook file is shared you can download it from the link in the description, hope it helps.
Interesting work! I've reached 25.5% accuracy with this method, so it might be not a good idea for stock I did analyze.
Hey thank you for sharing your results. Actually you might need to optimize parameters for each stock, and back and forward test to make sure results are robust. But yes it needs optimization first.
I really like your channel and it is really useful. Thank you for sharing your experience 😁
Thanks you for your support, I am glad the videos are of help
Best video on Candlestick strategy + RSI on RUclips & any opensource platform.
Interested to contact you personally regarding some strategy improvisation.
Thanks, I am happy you liked it, if you want for further contact you can drop an email, I will be happy to help as much as I can
How to backtest this strategy using Backtesting lib in python ? vectorbt is also a good alternative.
@@SP-db6sh I m not familiar with backtesting libraries in Python (maybe I should start having a look at these) but here backtesting would be a trap! It will definitely provide good results because we are backtesting on the same data we used for tuning our parameters, so our model has already something of the data in memory. The correct way to test here is to run automated trades on a demo account, this way you would be testing on new data, the only problem is that it will take time, I would say at least 6-8 month to have a reliable result, since we are using daily candles. (Of course this time drops down if we try a model for the 4 hours candles instead)
@@CodeTradingCafe which is your email, please?
Hello it's in the "about" section of this channel
Valuable secrets.. thanks bro
Thank you for your appreciation, enjoy it
19:00
Thanks, it slipped and I didn't notice :)
Great video Sir
Thank you, good luck to you!
Hi trading code. There is a way to contact you in private to speak about trading collaboration?
Hi, saw your channel nice intro, my email is in the about page of this channel. Let me know if you have problems finding it.
Hi, There seems to be something wrong with the provided code file. It seems to be all mixed up. Would appreciate if this could be rectified.
Hi thank you for your comment, it's a Jupyter notebook file, did you try to open it using a different interface? (It has to be Jupyter)
@@CodeTradingCafe It works after copying the file as it is into my folder. I use VScode and was copying the content of the file from notepad++ into a new file in VScode. Somehow it does not identify the file that way. Thanks!!
@@BITRUN I see thank you for your feedback, and good luck!
Brilliant videos
Thank you I appreciate your message!
why you do all your strateies in large time frame like the daily timeframe? if you use a smaller timeframe you will get more signals and that mean more profit? if the strategy is correct, of course it is harder but is it correct?
Hi it's much easier on large timeframes, but I also have scalping videos recently it's more or less rewarding.
@@CodeTradingCafe But if you trade D1 timeframe you will have to wait months to know if your strategy is working live.
@@paulbrown5839 it's true depending on the strategy's you might try it with a small account trading on different currencies to increase trades number, you could get an idea in about 3 to 4 months.
Could you add a volumen indicator?
Yes it's possible, however I don't know exactly which strategy you have in mind...
@@CodeTradingCafe I am thinking on replace the RSI or add to it, to confirm the trigger when there are an volume aceleración. Sounds good? How could be done?
@@sergiomiguel1960 Yes if I understood correctly it's straight forward, we already have a column with the "volume" in the data, so if it's "high" enough we confirm a buy signal? what about the sell signal?
@@CodeTradingCafe the idea is to use an indicator that shows the volume is increasing, is not enough to see the volume. The volume is high in comparative with?
thank you for this video
Good luck Coding!
Thank you
Happy you liked it
👍
Thank you, good luck in your trading
i love all your videos brother, nice content, thanks for the vide.. can you tell how can i code ORB with 2 candles inside the range & entry on any candle breaking out of the range
ORB high
ORB low
condition1
candle2 high < orb high and candle low > orb low
enntry:
condition 1 is true & price> orb high
"place order"
can you help me to code the condition1, lets say market opens @ 5pm EST then ORB high & LOW of 1st 5 min candle & in the condition1 , i want to consider next candle after 5 mins, if it is in the ORB range & then any candle breakouts then entry...
plz.. plz help me to code this
Hi thank you for your support, what is ORB? Sorry I must have missed this
@@CodeTradingCafe Opening Range Breakout !!
@@iamprashantjain it depends how many candles you need to consider to define your range, let's say 5 candles so you will find the max high and the min low among these candles these will be your range limit, then any candle exceeding these values up or down is the break out candle. I would think of it this way as a first attempt
@@CodeTradingCafe I do the same but only issue is.. I can code ORB but not nth candle so I can compare high1 low1 to orbhigh & orblow..
Can you enlighten taking code as example ??
we can discuss this on remote too.. if that's feasible ?
Nice
Happy you liked it, good luck with your trading
i encounter this error for the code below
nan
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:7: RuntimeWarning: invalid value encountered in long_scalars
import sys
trendId=2
print(df[df['result']==trendId].result.count()/df[df['signal1']==trendId].signal1.count())
df[ (df['result']!=trendId) & (df['signal1']==trendId) ] # false positives
Hi check if you have any missing values in the data, sorry it's hard to debug remotely