@@CodeTradingCafe Hey, I hope you're are still able to answer questions, because I am facing an issue with accessing the jupyter notebook. As it requires a token ID and password
As an analyst, we're always buy stock after looking at macro economy, financial release on fundamental side, then we see technical analysis like MACD RSI Bollinger Bands Fibonacci etc (plenty more) which are commonly used to detect buy or sell momentum. When I see your headline video I thought you're build those. Still your idea by JUST to create automatic cut loss transaction algorithm is USEFUL, not bad. Many trader out there using that strategi when realizing they made wrong transaction in stocks.
Hi thank you for your comment, I understand trading from 2 points of view Fundamental and Technical, these are completely different. Fundamental trading relies on analysis but my take is that you never know WHEN the move will happen when using fundamentals, for example you know Gold will rise during major events (war Russia-Ukraine or US conflicts in the gulf) but you never know when and by how much. Technical school is different and as a Data Scientist I really enjoy the numerical analysis approach, sometimes statistics can reveal good hints.
Man, on fundamental side what need to figure out leading ang lagging economy indicator and those my friend @CodeTrading are measureable with math and economy. My lack expertise are in coding, I'm aware javascript and macro but no experience on Phyton. If you're able to script algoritma for buy at bottom 20% of RSI and sell at top 80% signal, or by make automation buy or sell when MACD cross over signal happen, even combine those as like multiple priority Equity finding (kinda Machine learning), you are DEFINITELY THE MAN. Cheers bro.
thanks man ... very much appreciated ... may god bless you .... first time i skipped the video a minute .. after searching for pure python solution for placing trades which does not depend on MT5 in any way .. soon after tiresome searches again landed on the video and pretty much found every thing had been looking for... thanks
I discovered your channel yesterday and can’t stop exploring it so far! You did a fantastic F.. good job for free! I like your spirit and you should be declared Master of the Universe ! 😄🙏🏻🙏🏻🙏🏻
I am in love with this channel. Currently, just at the start of my algo trading journey. Couldnt have asked for a better channel to come across. Will be back once i learn more and execute successful trades and give this guy my gratitude. ❤
Very happy I stumbled upon this video often times videos on this subject lacks so much information but you laid it all out, very detailed and showed examples. Thank you!
I only took a c++ programming class in highschool, but im super into stocks and i cannot wait to learn how implement coding to create a bot. This is two worlds coming together for me
I just came across your channel a few days ago and all of your content is gold! I've been hanging off of your every word. Thank you for explaining everything in such a clear way.
@@CodeTradingCafe More than a hobby. I'm a 55yo unemployed guy in Brazil, and with Lula in charge, things are getting worse very fast. My hope is to get some remote job and invest overseas, just to have some life. The number of co. closing doors is rising, and fast. As soon Trump, Bolsonaro and other conservatives return to office, and the Market become trustable again, this knowledge will speed my financial recover.
@@maurolimaok if I may provide a modest advice, don't do trading while chasing money it is a 100% failure recipe, emotions are tricky! Have a steady job with income, once this is settled expand slowly into trading and investment. (and out of experience passive income doesn't exist any investment requires constant monitoring).
@@CodeTradingCafe Unfortunately that's not an option for me for a while. I lost the money I nad due to home distraction while I was trading. Arrgghhh! Lesson learned. KKKK But I'm trying to get a micro business running, so I could have SOME income, at least. Thanks for the advice. I'm aware of it.
Thank you for the code, I was looking for a way to code a strategy tester in Python but I abandoned the idea at the time as I didn't know how to get the data. Now I can return to it. Thanks a lot!
Thank you for this video, I used to practice on the OANDA platform and years ago wanted to make a trading bot, got sidetacked. Thanks to this well done TuT you've inspired me to get back into trading and also motivated me to tinking witha trading bot that I can fine tune and experiment with. I sincerly thank you for this video. Good work bud keep it up. I have too many unfinished projects. This is one I am going to start immediately, straight to the top of the list of fun programming projects to do that have some real world benefits. Thanks again bud
this is the most useful video you have made thank you, I already learned some mql4 to do some bots and it has some advantages but in the future I will move to python maybe
Great video, I was able to implement it using a copy of your Notebook and a demo account. It is cool to see our trades in the Web Browser of the demo account. If not too complicated, it would be a nice addition to check (using the API) if we are in a position and not buy multiple positions at the same time. Great stuff!
When opening a long position, Oanda will allow a tp / sl if it's above / below the ask price. When opening a short position, the tp / sl has to be below / above the bid price. In the code however, we used the bid price to calculate everything? With Bitcoin (there is quite a gap between ask / bid for BTC on Oanda) and using the scalping strategy from last video, it calculates invalid tp / sl, which Oanda won't allow.
My guy! What a channel! Question, can you make a bot that makes financial decision based on news???? And how would you do it? Because I assume there are words in the news that are good/bad. So can you make a video of news trading? And how would you make it? If no, thanks anyway, great video.
Hi thank you! Actually it's not very complicated python can scrap webpages and social media for news and discussions and evaluate the market sentiment, the challenge is to have access to good news sources, and ... we don't know when the effect of the news will take place is it long term or short term, but all in all it's not complicated to have a first version of such a code.
Hey I love your videos they've boosted my trading 300% Next can you show how to integrate Reinforcement learning.. I have been working on a model maybe you can HELP!
Hey thank you for your support, reinforcement learning is a great idea to investigate, it doesn't mean it's guaranteed but curious enough to try it. I have it on my list since a while but time is tight at the moment. Good luck!
right when i thought the world of trading and machine learning is hard, i find you channel wow dude, keep it, i want to see how would you deal with linear regression type of algorithms, can you do a guide please.
Thank you for your supportive comment. I use regression in some approaches in previous videos (channel detection mainly) but I never try to fit the price in a regression it doesn't work this way unfortunately. But more is coming and welcome to the club, happy you joined learning with us.
Hi thank you for your support, yes I have a french accent I wasn't aware of it 🙂 because I am not native french. I made money from bots but I only program the bot to send me an alert on my phone and I take the trade manually, I can't work and live while an algorithm is playing around with my money 😂
Hey umm I am kind of new to this so I don’t really know much so can you tell from where i should start you know what to learn and stuff so that I can Create things like this ..
Hi, I understand, it's NOT hard but it does require some time ... 2 months practice you would be able to code your own strategies. The easiest is to start with my python learning playlist (check the playlists on this channel) it starts with basic python and evolves into pandas and financial data analysis within 3 videos in total. I hope this will help. Good luck! Don't get discouraged it is worth it.
If I'm right, your SLTP ratio is wrong. You doubled the SL and get a simple TP, but the code looks right, so I really don't understand this. Second, it looks like when your position opened, there is two bull cande before, so the buy signal conditions doesn't met. If this bot monitoring the last three candles and it includes the last bear candle, which get engulfed, how does it opened an order at that high? In that case the first candle which not closed never reached that price where the order opened.
Hi, this is just an example so you can change the SL and TP to your liking. Regarding the position opening, when an engulfing candle generates a signal it has to close completely so the position is fulfilled on the next candle coming after.
The way the code is we have a risk return of 0.5. The candle grapho oanda shows the order and the take profit is half the length of stop loss. Not a good trade because you will have to succeed in 2 trades to zero the bad result of a stop loss. Also the idea of calculating the lot size is not present. If I decide that I wanna risk 3% of my actual account balance in a trade? This must be done dynamically before each trade.
Your TP is half your SL. Take a look at the candlechart. It means that I will risk X to gain X/2. Not a good strategy. I am not sure if the candle chart is showing a different version of the code. On your code you use the SLTPRatio increasing the TP as it is expected but when comes the part to show the orders graphically it shows the opposite.
Hi thank you, this is not a complete strategy it's simply showing how to connect to the market using python, for strategies please check my backtesting videos
@@CodeTradingCafe thanks but the doubt remains. I get that it has no backrest and all that this brings with but: - since you define rules to enter and exit a trade it is a strategy. Have confidence that it is applicable to a live trade is a different topic that requires backtest and I agree with u about it; - the SL and TPs are presented in reverse when we compare with the code you show on your video.
@@dfcastro Ah! I see what you mean, I guess I have been trying around with the code and I might have messed up something when making the video. Something most viewers might not be aware, it takes me some time to debug and make a program work before making a video, sometimes part of the mess is still there somewhere, and you have just spotted one 🙂 sorry about that
hii in the signal generator part im getting an error saying The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Hi this is a code issue you probably modified some code lines, it's pandas telling you that you can't compare a column (series) as a boolean (because it's not a single value).
@@CodeTradingCafe I ALREADY MADE TWO COLUMN USING TWO CANDLE CONDITION BUT I HAVE TO DEVELOP LAST THREE CANDLE CONDITION AND LAST 4 CANDLE CONDITION AND ALSO LAST 3 CANDLE +NEXT CANDLE CONDITION I WROTE CODE AS PER UR GUIDELINE. I SHARE IT BELOW def signal_generator(df): Openx = df.o.iloc[-1] close = df.c.iloc[-1] previous_open1 = df.o.iloc[-2] previous_close1 = df.c.iloc[-2] next_open1 = df.o.iloc[1] next_close1 = df.c.iloc[1]
#candle type : if Openxclose: return 0 elif Openx==close: if next_open1next_close1 return 1 else: return 2 ct = [] # ct is column name ct="candletype" ct.append(0) for i in range(1,len(candledata)): df = candledata[i-1:i+1] #print(df) ct.append(signal_generator(df)) candledata["ct"] = ct #candledata.iloc[:,:] #print(candledata) def signal_generator(df):
#candle type : if Openxprevious_open1: # return 1 elif ct_previous == 0 and closeOpenx and closeprevious_open2 and previous_close1Openx and previous_close1>previous_open2 and close>previous_open1: return 1 elif previous_close2previous_open1 and close
Good question! I never thought of it because I usually trade above 1 hour timeframes, my favorite is 4hours. But I guess you are right for lower timeframes you need the faster approach.
Fantastic video, I'm unfortunately stuck at the API step. I have created a demo oanda account where the login and platform take place under MT5. Under the MT5 platform there's no option related to generating an access token... Any recommendation from your side would be greatly appreciated! thank you!
Hi, when you open hub.oanda com ... I suppose you are logged in you can check for "Trading Tools" menu tab in the upper right of the page, it will open a list of options choose Oanda API fron there it's easy...
@@CodeTradingCafe Thank you for the feedback. This is actually the issue, the demo account login now takes place under a different MT5 platform not the main Hub one (probably a change made by Oanda). I guess I'd need to open an actual account to get API access...
I think it's region dependent I checked mine and it's still working the same, only the MT accounts are not accessible through android app, but still working through python.
What's the point of the scheduler? Why not just check last three bars? When the markets are closed it will do nothing? Doesn't python lib have an OnBar event? IDK I'm a c# coder just asking. That's how my bots run in an OnTick and OnBar method in CTrader. So I have no idea.
The way the code is built, it doesn't run on bar really, it will keep querying the data and testing for the same result all day long, the scheduler will limit this to once a day as needed.
I'm looking for a bot which can take pictures from a telegram group, the pictures are just metatrader trades, they have all the info like ID, SP, TP, sell or buy, and the symbol. I want to be directed to how would I make a bot which would take the pictures, convert the picture to text, and place orders accordingly.
great video! i was wondering about the jupyer file being different from the one you are using in the video and what it is intended for, and where the one you used might be downloadable.
Glad it was helpful! This is the same Jupyter file I used in the video I only had to remove my credentials of my personal trading account, check the pinned comments for update.
Where do you find your account ID information on the OANDA API docs? I have my API key but don't see the variable for the Account ID anywhere... anyways thanks in advance
Hi, when you log in to your OANDA account you can find a list of your demo accounts or you can create/open a new demo/practice 'sub' account there, once this is done you will be able to see the account number on the list of accounts.
My best answer is : "trader's job starts after the trade is opened", the reason I am saying this is to highlight the importance of managing you trade actively, SL and TP alone will not provide the best results, I am not saying will not provide winning trades but they will maximize your gains. That being said, I would use the local swing for the SL, and the TP depends on the SL with the TP/SL ratio. And don't forget that if the price moves in your favor you can close half the position and move the SL to break even for the other half that is still opened. I will be making a video about this very soon... it's time to tackle trade management. Good luck!
I guess yes, used to use C++ 10 years ago, but everyone migrated to Python APIs. The easiest for you is to use mql5 language you can run it in MT4/5 and it's very close to C++ (I recap it's C++ actually).
@@CodeTradingCafe if i trade 15m, so the scheduler is basically 15m? It's better to set lower schedule fe 5m or 1m even seconds bro ? Thx for your reply
You can use the resample () function in pandas with ohlc parameter it does the work for you, it can also sample any timeframe according to your choice.
Thank you, I switched to dark mode because someone advised so 🙂 I guess we have different preferences. I will try to find colors in between dark and light.
@@CodeTradingCafe for writing the code dark mode might be great option but for video tutorials its better to use light mode because its visible for both dark and light environment of the audience . Thank you.
Hi, you can check documentation of any broker they usually provide a code example. It's just a small part that is needed for trading mainly querying candles and passing trades.
@@CodeTradingCafe thanks for replying, can you please help me to setup this algo trading system once for Pivot Points strategies or VWAP strategy using Indian Markets?
I don't at this point but the scheduler runs once every 15 min so it might happen, piling up open trades (not too many I guess). We can add a condition to avoid this. ... thank you for your support
Hello everybody, please help me. My terminal answering me :from config import access_token, accountID ImportError: cannot import name 'access_token' from 'config'. I checked config , but nothing is wroted about access_token. PLease helpadvice me some solutions.
The easiest way is to trade high timeframes like the 4H or the daily, usually the movements are wide so the spread and commissions are a small portion... but it's slow you get 1 signal every couple of weeks.
You can initialize and leave it should be got automated, you can modify it to apply any strategy you want. But it is highly advisable to backtest any strategy before using it. Good luck!
Hola Crack.. desde CHile un gran abrazo, soy nuevo en trading y agradezco tus videos y tu conocimiento me ayudan muchisimo.. Si puedes permitir el BOT en Discord te lo agradeceré mucho.. Saludos
@@CodeTradingCafe Not Because of Strategy just want to copy my trades from my one account to another two accounts so the time will save and I get accurate price Want to trade and I am doing scalping so small changes also matters. When ever I place any trade from one account same trade will gets punched to other two account also with same quantity , price , SL , Target price , etc And if I modified the same change should be happen
I see your point, this can be written in python where the account is scanned every minute and the same trades are copied into another account, the functions and how this is written depends also on your broker's API.
Hey this is NOT a complete strategy please check the video well it's an example strategy for a trading bot, the results were NOT backtested here, but my other videos present backtests as well, good luck!
Can you make an indicator or alert bot that if a token hits a specific percentage price increase in a matter of minutes the bot will detect and notify.. For example usdt base pair so all usdt pair will be monitored by this bot in a specific exchanges..
Hi thank you for sharing, this is interesting. Technically yes this is relatively simple to achieve using minutes timeframe and measuring movements on a slice of 2 minutes for example so 2 candles. Will put it on my list (it's a long list though, sorry!).
I love this, bought your python udemy course to help me learn coding. Would love if you had a focused one about learning to create and implement a python bot. Do you know how to implement learning ai for trading? Feels like it would be great for this
Hi thank you for your support. Learning AI you mean reinforcement learning, yes I have an idea on this I should start coding it soon, I will put it in a video here if it goes well (will require some time though).
Hey buddy, FYI your jupyer notebook is coming with all data readabled, which means we can see your accountID and userID
Thanks for this ! I didn't pay attention to it will try and fix it tomorrow 🙂 (anyway it's a demo account)
drive.google.com/file/d/1akgyiR2lFOPT3OLjLTc142vtHkts2x-q/view?usp=share_link
It should be fine with this link, thanks again!
Haha. LEGEND!
@@pun3203 I didn't even recheck my details might be still there lol
@@CodeTradingCafe Hey, I hope you're are still able to answer questions, because I am facing an issue with accessing the jupyter notebook. As it requires a token ID and password
These videos are so helpful. I was able to build my own using my Robinhood account. I shared it on my channel along with the scripts.
Hi, thank you for your support
How do you use it on robinhood?
As an analyst, we're always buy stock after looking at macro economy, financial release on fundamental side, then we see technical analysis like MACD RSI Bollinger Bands Fibonacci etc (plenty more) which are commonly used to detect buy or sell momentum. When I see your headline video I thought you're build those.
Still your idea by JUST to create automatic cut loss transaction algorithm is USEFUL, not bad. Many trader out there using that strategi when realizing they made wrong transaction in stocks.
Hi thank you for your comment, I understand trading from 2 points of view Fundamental and Technical, these are completely different. Fundamental trading relies on analysis but my take is that you never know WHEN the move will happen when using fundamentals, for example you know Gold will rise during major events (war Russia-Ukraine or US conflicts in the gulf) but you never know when and by how much. Technical school is different and as a Data Scientist I really enjoy the numerical analysis approach, sometimes statistics can reveal good hints.
Man, on fundamental side what need to figure out leading ang lagging economy indicator and those my friend @CodeTrading are measureable with math and economy. My lack expertise are in coding, I'm aware javascript and macro but no experience on Phyton.
If you're able to script algoritma for buy at bottom 20% of RSI and sell at top 80% signal, or by make automation buy or sell when MACD cross over signal happen, even combine those as like multiple priority Equity finding (kinda Machine learning), you are DEFINITELY THE MAN. Cheers bro.
thanks man ... very much appreciated ... may god bless you .... first time i skipped the video a minute .. after searching for pure python solution for placing trades which does not depend on MT5 in any way .. soon after tiresome searches again landed on the video and pretty much found every thing had been looking for... thanks
Thank you for your support 😊 I am happy you're enjoying these topics, good luck
I discovered your channel yesterday and can’t stop exploring it so far!
You did a fantastic F.. good job for free!
I like your spirit and you should be declared Master of the Universe ! 😄🙏🏻🙏🏻🙏🏻
Lol Welcome aboard! and thank you for your support.
I am in love with this channel. Currently, just at the start of my algo trading journey. Couldnt have asked for a better channel to come across. Will be back once i learn more and execute successful trades and give this guy my gratitude. ❤
Glad you enjoy it! and welcome aboard :)
Haven't even viewed the video yet, but leaving the comment for algorithm. Wishing you a million subscribers asap!
This is one of the most generous comments ... Thank you so much, wishing you a million dollars in return 🙂
Edit: asap as well
But why
just saw you video and can say one of the finest video , i have ever seen. Keep it up sir.
Thank you so much for your support 😊
Very happy I stumbled upon this video often times videos on this subject lacks so much information but you laid it all out, very detailed and showed examples. Thank you!
Thanks a lot for your support, I am glad you liked it
I only took a c++ programming class in highschool, but im super into stocks and i cannot wait to learn how implement coding to create a bot. This is two worlds coming together for me
You will enjoy it, but first you will suffer :)
Did you get to it?
i have been trying with java but chai i am really suffering so i have chose to stick with python
@@MichaelSelby-xb4jo Hey Michael, did you get to something with Python?
@@MichaelSelby-xb4jo Only problem with java is the lack of good easy to use visualization library, otherwise java is good.
I just came across your channel a few days ago and all of your content is gold! I've been hanging off of your every word. Thank you for explaining everything in such a clear way.
Thanks a lot for your support, appreciation really counts!
Thank you, it is very helpful for me who is studying in the Nusantara FX Community class
Glad it was helpful!
You deserves for 1 million subscribers ! amazing classes
Thank you for your support 😊
Thanks for the channel.
I'm studying coding 101 now, and hope to begin investing sometime ahead.
This knowledge will be valuable for me.
It's a nice hobby, I hope you will enjoy it as much as I do. Good luck!
@@CodeTradingCafe More than a hobby. I'm a 55yo unemployed guy in Brazil, and with Lula in charge, things are getting worse very fast.
My hope is to get some remote job and invest overseas, just to have some life. The number of co. closing doors is rising, and fast.
As soon Trump, Bolsonaro and other conservatives return to office, and the Market become trustable again, this knowledge will speed my financial recover.
@@maurolimaok if I may provide a modest advice, don't do trading while chasing money it is a 100% failure recipe, emotions are tricky! Have a steady job with income, once this is settled expand slowly into trading and investment. (and out of experience passive income doesn't exist any investment requires constant monitoring).
@@CodeTradingCafe Unfortunately that's not an option for me for a while. I lost the money I nad due to home distraction while I was trading. Arrgghhh! Lesson learned. KKKK
But I'm trying to get a micro business running, so I could have SOME income, at least.
Thanks for the advice. I'm aware of it.
Thank you for the code, I was looking for a way to code a strategy tester in Python but I abandoned the idea at the time as I didn't know how to get the data. Now I can return to it. Thanks a lot!
Glad it helped!
wow cool thank you for the update, especially for me who is a beginner who is learning and joining the Nusantara Fx Community
Thank you for your support!
Thank you for this video, I used to practice on the OANDA platform and years ago wanted to make a trading bot, got sidetacked. Thanks to this well done TuT you've inspired me to get back into trading and also motivated me to tinking witha trading bot that I can fine tune and experiment with. I sincerly thank you for this video. Good work bud keep it up. I have too many unfinished projects. This is one I am going to start immediately, straight to the top of the list of fun programming projects to do that have some real world benefits. Thanks again bud
Thank you for your support, I am researching some ideas hopefully will get interesting ideas soon into more vids. Good luck to you!
this is the most useful video you have made thank you, I already learned some mql4 to do some bots and it has some advantages but in the future I will move to python maybe
Thank you for your support, good luck with your research!
The automation itself is good. The signal generation I would use as a template. Great video nonetheless!
Hi, thank you, you are right this is just a template model, we need to replace the signal with a more complete one.
Great video, I was able to implement it using a copy of your Notebook and a demo account. It is cool to see our trades in the Web Browser of the demo account.
If not too complicated, it would be a nice addition to check (using the API) if we are in a position and not buy multiple positions at the same time.
Great stuff!
Hi, happy it worked, I will check for single trade at a time. Good luck to you!
How is your demo performing? Are you making profit?
@@Useryoal Hi, this is just a demo not a full strategy it was just to show how to connect from python.
how is it going so far?
When opening a long position, Oanda will allow a tp / sl if it's above / below the ask price. When opening a short position, the tp / sl has to be below / above the bid price. In the code however, we used the bid price to calculate everything? With Bitcoin (there is quite a gap between ask / bid for BTC on Oanda) and using the scalping strategy from last video, it calculates invalid tp / sl, which Oanda won't allow.
Yes you are right we need to get the spread first and include its value in SL and TP calculations.
Great video. I’ve done some programing in C++ & Java but I am new to TradingBot. Very insightful. Great presentation.
Glad it was helpful!
My guy! What a channel!
Question, can you make a bot that makes financial decision based on news???? And how would you do it? Because I assume there are words in the news that are good/bad. So can you make a video of news trading? And how would you make it?
If no, thanks anyway, great video.
Hi thank you! Actually it's not very complicated python can scrap webpages and social media for news and discussions and evaluate the market sentiment, the challenge is to have access to good news sources, and ... we don't know when the effect of the news will take place is it long term or short term, but all in all it's not complicated to have a first version of such a code.
Thankypu. This was exactly what I was looking for as a starting point.
Thank you for your support!
Thank you so much! You explained this so well
Thank you for your support! it's motivating to know that these videos are useful.
I cant wait to code this. I found the video but im away from my pc but this, this deserves a watch
Good luck, maybe next I will put a full strategy live in a video... 🙂
Hey I love your videos they've boosted my trading 300%
Next can you show how to integrate Reinforcement learning.. I have been working on a model maybe you can HELP!
Hey thank you for your support, reinforcement learning is a great idea to investigate, it doesn't mean it's guaranteed but curious enough to try it. I have it on my list since a while but time is tight at the moment. Good luck!
Thanks will be waiting
Thank you sir ! love your work and your channel so far
Thank you for your support
Top quality video, thank you for creating!
Thank you for your support, glad you liked the video!
i really enjoyed your videos brotha !
I appreciate your support, thank you!
I am happy to find this channel.
Thank you! I am glad these videos are useful.
Programmer + trader 😮 deadly.
Overall markets are highly manipulated.
Hi, thank you for your support. Yes the market is not as friendly but we can always sneak around in someway :)
right when i thought the world of trading and machine learning is hard, i find you channel wow dude, keep it,
i want to see how would you deal with linear regression type of algorithms, can you do a guide please.
Thank you for your supportive comment. I use regression in some approaches in previous videos (channel detection mainly) but I never try to fit the price in a regression it doesn't work this way unfortunately. But more is coming and welcome to the club, happy you joined learning with us.
@@CodeTradingCafe absolutely 💗👌
Thank for the video i will try it ! By the way have you french accent ? And have you made money from your bots ?
Hi thank you for your support, yes I have a french accent I wasn't aware of it 🙂 because I am not native french. I made money from bots but I only program the bot to send me an alert on my phone and I take the trade manually, I can't work and live while an algorithm is playing around with my money 😂
Eres un excelente maestro, muchas gracias por tus explicaciones tan claras.
Muchas gracias for your support 😊
Thank you so very much! Great video!
Thank you for your support!
Thank you so much, lots of love !!
Thank you!
great video! can i use other API's instead of Oanda?
Thank you! yes you can a lot of brokers are now offering Python APIs, need to go through their docs though.
good info ..it was easy to understand
thank you, I am happy you liked it!
Hey umm I am kind of new to this so I don’t really know much so can you tell from where i should start you know what to learn and stuff so that I can Create things like this ..
Hi, I understand, it's NOT hard but it does require some time ... 2 months practice you would be able to code your own strategies. The easiest is to start with my python learning playlist (check the playlists on this channel) it starts with basic python and evolves into pandas and financial data analysis within 3 videos in total. I hope this will help. Good luck! Don't get discouraged it is worth it.
@@CodeTradingCafe sure and thanks 😃
If I'm right, your SLTP ratio is wrong. You doubled the SL and get a simple TP, but the code looks right, so I really don't understand this. Second, it looks like when your position opened, there is two bull cande before, so the buy signal conditions doesn't met. If this bot monitoring the last three candles and it includes the last bear candle, which get engulfed, how does it opened an order at that high? In that case the first candle which not closed never reached that price where the order opened.
Hi, this is just an example so you can change the SL and TP to your liking. Regarding the position opening, when an engulfing candle generates a signal it has to close completely so the position is fulfilled on the next candle coming after.
I'm confuse, do you use past historical data to generate signal? I thinkpast historical data is for backtest
Hi, no in this video it's live data.
Can you make video using another broker as oanda is restricted in my country
The way the code is we have a risk return of 0.5. The candle grapho oanda shows the order and the take profit is half the length of stop loss. Not a good trade because you will have to succeed in 2 trades to zero the bad result of a stop loss.
Also the idea of calculating the lot size is not present. If I decide that I wanna risk 3% of my actual account balance in a trade? This must be done dynamically before each trade.
Hi thank you for your input. You are right improvements can be applied, this was just an example to see how to connect with oanda from python.
Your TP is half your SL. Take a look at the candlechart. It means that I will risk X to gain X/2. Not a good strategy.
I am not sure if the candle chart is showing a different version of the code. On your code you use the SLTPRatio increasing the TP as it is expected but when comes the part to show the orders graphically it shows the opposite.
Hi thank you, this is not a complete strategy it's simply showing how to connect to the market using python, for strategies please check my backtesting videos
@@CodeTradingCafe thanks but the doubt remains. I get that it has no backrest and all that this brings with but:
- since you define rules to enter and exit a trade it is a strategy. Have confidence that it is applicable to a live trade is a different topic that requires backtest and I agree with u about it;
- the SL and TPs are presented in reverse when we compare with the code you show on your video.
@@dfcastro Ah! I see what you mean, I guess I have been trying around with the code and I might have messed up something when making the video. Something most viewers might not be aware, it takes me some time to debug and make a program work before making a video, sometimes part of the mess is still there somewhere, and you have just spotted one 🙂 sorry about that
Love your work!
Can you make a video on how to connect your bot on to MT5 please?
Thank you!
Thank you! at this point MT5 is not needed for me if we can trade straight from python, do you have any particular reason for linking MT5 to python?
@@CodeTradingCafe Thank you for the reply!
I was hoping to be able to connect python straight to MT5 and trade.
hii in the signal generator part im getting an error saying The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Hi this is a code issue you probably modified some code lines, it's pandas telling you that you can't compare a column (series) as a boolean (because it's not a single value).
i have problem with three last candle signal generator can u help for that
You need to have an account set with a key to access live data otherwise the code should work.
@@CodeTradingCafe I ALREADY MADE TWO COLUMN USING TWO CANDLE CONDITION BUT I HAVE TO DEVELOP LAST THREE CANDLE CONDITION AND LAST 4 CANDLE CONDITION AND ALSO LAST 3 CANDLE +NEXT CANDLE CONDITION
I WROTE CODE AS PER UR GUIDELINE. I SHARE IT BELOW
def signal_generator(df):
Openx = df.o.iloc[-1]
close = df.c.iloc[-1]
previous_open1 = df.o.iloc[-2]
previous_close1 = df.c.iloc[-2]
next_open1 = df.o.iloc[1]
next_close1 = df.c.iloc[1]
#candle type :
if Openxclose:
return 0
elif Openx==close:
if next_open1next_close1
return 1
else:
return 2
ct = [] # ct is column name ct="candletype"
ct.append(0)
for i in range(1,len(candledata)):
df = candledata[i-1:i+1]
#print(df)
ct.append(signal_generator(df))
candledata["ct"] = ct
#candledata.iloc[:,:]
#print(candledata)
def signal_generator(df):
Openx = df.o.iloc[-1]
close = df.c.iloc[-1]
previous_open1 = df.o.iloc[-2]
previous_close1 = df.c.iloc[-2]
#previous_open2 = df.o.iloc[-3]
#previous_close2 = df.c.iloc[-3]
ct_previous = df.ct.iloc[-2]
#candle type :
if Openxprevious_open1:
# return 1
elif ct_previous == 0 and closeOpenx and closeprevious_open2 and previous_close1Openx and previous_close1>previous_open2 and close>previous_open1:
return 1
elif previous_close2previous_open1 and close
I love your videos
Thank you, happy they are helpful
Thank you this information is amazing, you deserve a million subscribers.
I would like to know..
What is the code for a pullback?
There are different methods for pullback detection, check my videos on Fibonacci they might be more helpful for this.
so for reading live data from oanda wouldn't u use threading with a streaming api?
For those small timeframes so u don't miss any "slow" api candles
Good question! I never thought of it because I usually trade above 1 hour timeframes, my favorite is 4hours. But I guess you are right for lower timeframes you need the faster approach.
Nice and clean thanks man
Any time! thank you for your support.
Fantastic video, I'm unfortunately stuck at the API step. I have created a demo oanda account where the login and platform take place under MT5. Under the MT5 platform there's no option related to generating an access token... Any recommendation from your side would be greatly appreciated! thank you!
Hi, when you open hub.oanda com ... I suppose you are logged in you can check for "Trading Tools" menu tab in the upper right of the page, it will open a list of options choose Oanda API fron there it's easy...
@@CodeTradingCafe Thank you for the feedback. This is actually the issue, the demo account login now takes place under a different MT5 platform not the main Hub one (probably a change made by Oanda). I guess I'd need to open an actual account to get API access...
I think it's region dependent I checked mine and it's still working the same, only the MT accounts are not accessible through android app, but still working through python.
What's the point of the scheduler? Why not just check last three bars? When the markets are closed it will do nothing? Doesn't python lib have an OnBar event? IDK I'm a c# coder just asking. That's how my bots run in an OnTick and OnBar method in CTrader. So I have no idea.
The way the code is built, it doesn't run on bar really, it will keep querying the data and testing for the same result all day long, the scheduler will limit this to once a day as needed.
I'm looking for a bot which can take pictures from a telegram group, the pictures are just metatrader trades, they have all the info like ID, SP, TP, sell or buy, and the symbol. I want to be directed to how would I make a bot which would take the pictures, convert the picture to text, and place orders accordingly.
Hey the field is called computer vision you can use CNN to analyze the pictures. Good luck!
How can I connect to other brokers, oanda is not available in my country, can you make video on that
Hi, try interactive brokers or binance.
@CodeTradingCafe please can you make video on how to use binance
Связка топ, спасибо за информацию.
Thank you for your support
great video! i was wondering about the jupyer file being different from the one you are using in the video and what it is intended for, and where the one you used might be downloadable.
Glad it was helpful! This is the same Jupyter file I used in the video I only had to remove my credentials of my personal trading account, check the pinned comments for update.
my code is identical to yours but it says that name dataF is undefined at the for loop. any ideas ?
You need to run all the cells in order.
@@CodeTradingCafe thank you sir
Where do you find your account ID information on the OANDA API docs? I have my API key but don't see the variable for the Account ID anywhere... anyways thanks in advance
Hi, when you log in to your OANDA account you can find a list of your demo accounts or you can create/open a new demo/practice 'sub' account there, once this is done you will be able to see the account number on the list of accounts.
Very nice channel, thank you for your content. Say please do you have any video similar to this but for binance futures?
Hi thank you for your support, I don't have a demo for binance I hope I can do it in the coming year. Good luck!
Good one!!!… thanks for sharing…
Thank you for your support
Sir.. Can u share me to read option chain.. Oi and change in oi.. Selected Columns.. All comuns not required..
Hi, thank you for your comment, can you be more specific? I am not sure I understood correctly.
Nice one. Do you have a Video to this with MQL4 OR MQL 5 ? without dealing with API
Hi, I used to code in mql but moved to python for trading 10 years ago to try machine learning, I don't have videos about mql though.
if we decided not to make a config file for the oanda account, where should we put the account id?
you can change the accountID variable in the code, like accountID = '....'
Hi what is best sl and tp strategy... Should I place sl on local swing high/low or should it be based on atr/percentage of price?
My best answer is : "trader's job starts after the trade is opened", the reason I am saying this is to highlight the importance of managing you trade actively, SL and TP alone will not provide the best results, I am not saying will not provide winning trades but they will maximize your gains. That being said, I would use the local swing for the SL, and the TP depends on the SL with the TP/SL ratio. And don't forget that if the price moves in your favor you can close half the position and move the SL to break even for the other half that is still opened. I will be making a video about this very soon... it's time to tackle trade management. Good luck!
@@CodeTradingCafe thanks
Very helpful. Thank you!
Thank you for your support
Is it possible to do this but use C++ instead of Python? How would one go about doing it? Could you recommend some reading material?
I guess yes, used to use C++ 10 years ago, but everyone migrated to Python APIs. The easiest for you is to use mql5 language you can run it in MT4/5 and it's very close to C++ (I recap it's C++ actually).
thx bro, what is the good way to set scheduler for trading job, seconds or minutes for timeframe 1m,5m,15m for examples, thx.
Hi, it depends on the timeframe you are trading the scheduler is only there to launch your function.
@@CodeTradingCafe if i trade 15m, so the scheduler is basically 15m? It's better to set lower schedule fe 5m or 1m even seconds bro ? Thx for your reply
Hi, yes it's better to sync with the timeframe as scheduling faster than the timeframe only adds unnecessary CPU and bandwidth work.
thank you very helpfull videos
Thank you for your support
hello! how to create continuation chart for 12 min and 5 min if I have tick data?
You can use the resample () function in pandas with ohlc parameter it does the work for you, it can also sample any timeframe according to your choice.
Good one as usual!
Thanks
I love the content but please use light mode screen because its difficult for visualization .
Thank you, I switched to dark mode because someone advised so 🙂 I guess we have different preferences. I will try to find colors in between dark and light.
@@CodeTradingCafe for writing the code dark mode might be great option but for video tutorials its better to use light mode because its visible for both dark and light environment of the audience . Thank you.
I want to use exness broker on this bot.which lines do I need to change to make it work?
Most of the API related lines you have to check first with the broker if they support python trading
Hello Sir Oanda is not supported in South Africa can you please use Exness broker
Hi, you can check documentation of any broker they usually provide a code example. It's just a small part that is needed for trading mainly querying candles and passing trades.
hello! Did youmplay your strategy on trading view? Or Where?
Hi, no directly from python, this is the purpose of this video.
Thx i wan't aware of Oanda. But how do I get my accountID? EDIT: u just have to go into the trading interface and in the accounts window is the id
I am glad it worked, good luck!
Hi Can you make vedios how to install and broker which supports this algorithm please
You need to pip install oanda_candles and the other packages we're using.
How to do algotrading in Indian Markets? Can you please help me
Hi it works the same for all markets, the same strategy can be tuned for more assets.
@@CodeTradingCafe thanks for replying, can you please help me to setup this algo trading system once for Pivot Points strategies or VWAP strategy using Indian Markets?
Hello I'm unable to find the api access token in my demo account ... Where is the tab situated in new dashboard
From your account page, there is a button on the top left called 'tools' press on it and select 'API'
HI, Sir. Thanks your tutorial. How to get your preview images's "Easy Trading BOT" ui dashboard?
Hi, I am not sure I understand what you mean?
@@CodeTradingCafe What's name of the software in 0:01?
@@tradingsci It's not a software this is the Oanda Interface
Thanks! I did not catch if you monitor open orders and positions, otherwise you may have a pileup of both many times over.
I don't at this point but the scheduler runs once every 15 min so it might happen, piling up open trades (not too many I guess). We can add a condition to avoid this.
... thank you for your support
Hello everybody, please help me. My terminal answering me :from config import access_token, accountID
ImportError: cannot import name 'access_token' from 'config'. I checked config , but nothing is wroted about access_token. PLease helpadvice me some solutions.
Hi, you need to create an account on Oanda (free demo) and generate a token number to be used in Python.
@@CodeTradingCafe Okay, but Sir , I want to create trading bot for binance , tell me please what I need to change in code .
Hi for binance you have to check their API and use their functions it will be very different
Hi, I can't see the download link for the code. I can only seer the Jupyer link.
Hi, yes the jupyter link is the code but you need to open it in Jupyter notebook reader
How do you get around the sell commission that the platform takes?
The easiest way is to trade high timeframes like the 4H or the daily, usually the movements are wide so the spread and commissions are a small portion... but it's slow you get 1 signal every couple of weeks.
Great work !
I need to ask .. after creating the bot do u need to be close to the computer and work with it or just initialize and leave ?
You can initialize and leave it should be got automated, you can modify it to apply any strategy you want. But it is highly advisable to backtest any strategy before using it. Good luck!
What site do you use to download cryptocurrency quotes?
Hi yfinance and dukascopy
Greatt video as usual, we still need a vps for continuous trading rigth?
Hi, thank you, ideally yes a vps but it's not needed for trying you can run this on your laptop for a week to see if it's rewarding.
Hola Crack.. desde CHile un gran abrazo, soy nuevo en trading y agradezco tus videos y tu conocimiento me ayudan muchisimo.. Si puedes permitir el BOT en Discord te lo agradeceré mucho.. Saludos
Gracias :)
Mind blowing
Thank you!
Well done! Is it good for all the crypto? Or just bitcoin?
Hi thank you, this is just a demo of how to trade from python, you can apply any strategy if you modify the code for different assets.
@@CodeTradingCafe great ! But for keeping the code running, do I have to leave the laptop on? Or I can switch it of..
It has to be running, or deploy the code on the cloud if you have an account
Please make a video on copy trading
Hi thank you for sharing, can you be more specific? do you have any strategy?
@@CodeTradingCafe Not Because of Strategy just want to copy my trades from my one account to another two accounts so the time will save and I get accurate price Want to trade and I am doing scalping so small changes also matters.
When ever I place any trade from one account same trade will gets punched to other two account also with same quantity , price , SL , Target price , etc
And if I modified the same change should be happen
@@CodeTradingCafe Thank you for reply sir
I see your point, this can be written in python where the account is scanned every minute and the same trades are copied into another account, the functions and how this is written depends also on your broker's API.
Fantastic !!!
Thank you!
Hello sir, I am not getting the AccountId .....Which account Id i have to put there ? Tradingview account / My forex trading account ? Please help
Hi the oanda demo account you will need the account id the generated token.
what about OTC market bro? how can i read OHLC of pocket option candlestick???
I am not sure if dukascopy has this data I've never traded OTC, try their platform (dukascopy) see if they provide historical data.
Great tutorial ! Thank you. Unfortunately the Google drive file seems to be not accessible. Can you restore the link ?🙏🏼
Hi thank you for your support! Please check the pinned comment with the updated link, let me know if it worked.
Very nice Bro. What is the minimum unit size we can buy ? If I want to buy by example 0.01 units of EUR/USD ? Thank you and Best New Year :)
Hey this is NOT a complete strategy please check the video well it's an example strategy for a trading bot, the results were NOT backtested here, but my other videos present backtests as well, good luck!
Can you make an indicator or alert bot that if a token hits a specific percentage price increase in a matter of minutes the bot will detect and notify.. For example usdt base pair so all usdt pair will be monitored by this bot in a specific exchanges..
Hi thank you for sharing, this is interesting. Technically yes this is relatively simple to achieve using minutes timeframe and measuring movements on a slice of 2 minutes for example so 2 candles. Will put it on my list (it's a long list though, sorry!).
which platform can this python code run on ? ( MT5 ? )
No, this runs on python.
I love this, bought your python udemy course to help me learn coding. Would love if you had a focused one about learning to create and implement a python bot.
Do you know how to implement learning ai for trading? Feels like it would be great for this
Hi thank you for your support. Learning AI you mean reinforcement learning, yes I have an idea on this I should start coding it soon, I will put it in a video here if it goes well (will require some time though).
@CodeTradingCafe ah that should be brilliant. Been looking for tutorials on binding an ai trading bot
Can't you just use chat, gbt? Just properly prompt it? Copy the code, and paste it on your interface? I'm just adking.
Might be a solution :)