How To Build A Trading Bot In Python

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ธ.ค. 2022
  • This video shows how to use APIs in python to build a live trading bot. The market is scanned by the bot and the prices are downloaded for analysis. A simple strategy is presented to generate long and short signals using engulfing candles as an example. Buying and selling orders are executed from our jupyter notebook file. It's a very powerful method that you can implement to test any strategy live in real time for as long as you wish... and it's all free you don't have to pay for the practice oanda account nor to use python so nothing to loose!
    💲 Discount Coupon for My Udemy course on Algorithmic Trading:
    bit.ly/CouponAlgorithmicTrading
    The jupyter notebook file can be downloaded from the following link:
    drive.google.com/file/d/1akgy...
    Good luck and thank you for following!

ความคิดเห็น • 590

  • @LaRoccaAlessandro
    @LaRoccaAlessandro ปีที่แล้ว +195

    Hey buddy, FYI your jupyer notebook is coming with all data readabled, which means we can see your accountID and userID

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +47

      Thanks for this ! I didn't pay attention to it will try and fix it tomorrow 🙂 (anyway it's a demo account)

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +33

      drive.google.com/file/d/1akgyiR2lFOPT3OLjLTc142vtHkts2x-q/view?usp=share_link
      It should be fine with this link, thanks again!

    • @pun3203
      @pun3203 ปีที่แล้ว +21

      Haha. LEGEND!

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +3

      @@pun3203 I didn't even recheck my details might be still there lol

    • @venomas100
      @venomas100 3 หลายเดือนก่อน

      @@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

  • @MrQuinn1012
    @MrQuinn1012 ปีที่แล้ว +40

    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!

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      Thanks a lot for your support, I am glad you liked it

  • @Crash3214
    @Crash3214 ปีที่แล้ว +12

    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
      @CodeTradingCafe  ปีที่แล้ว

      Thanks a lot for your support, appreciation really counts!

  • @white_sheep_media_business
    @white_sheep_media_business ปีที่แล้ว +47

    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.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +4

      Hi, thank you for your support

    • @Crownedheadqueso
      @Crownedheadqueso 3 หลายเดือนก่อน

      How do you use it on robinhood?

  • @thinketh2408
    @thinketh2408 ปีที่แล้ว +3

    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

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Thank you for your support 😊 I am happy you're enjoying these topics, good luck

  • @cctvshoppee583
    @cctvshoppee583 ปีที่แล้ว +2

    just saw you video and can say one of the finest video , i have ever seen. Keep it up sir.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Thank you so much for your support 😊

  • @sheilanfc
    @sheilanfc 6 หลายเดือนก่อน +3

    Thank you, it is very helpful for me who is studying in the Nusantara FX Community class

  • @federicopanichi9874
    @federicopanichi9874 ปีที่แล้ว +4

    You deserves for 1 million subscribers ! amazing classes

  • @brytonalley9356
    @brytonalley9356 ปีที่แล้ว +22

    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

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +14

      You will enjoy it, but first you will suffer :)

    • @Yassine-kw2eo
      @Yassine-kw2eo 5 หลายเดือนก่อน

      Did you get to it?

  • @senteix2
    @senteix2 ปีที่แล้ว +1

    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

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Thank you for your support, good luck with your research!

  • @aliandy.jf.nababan
    @aliandy.jf.nababan ปีที่แล้ว +1

    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.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      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.

    • @aliandy.jf.nababan
      @aliandy.jf.nababan ปีที่แล้ว +1

      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.

  • @PoivronJaune
    @PoivronJaune ปีที่แล้ว +19

    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!

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      Hi, happy it worked, I will check for single trade at a time. Good luck to you!

    • @orolimomov5866
      @orolimomov5866 ปีที่แล้ว

      How is your demo performing? Are you making profit?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      @@orolimomov5866 Hi, this is just a demo not a full strategy it was just to show how to connect from python.

    • @user-rt8zy3ql1s
      @user-rt8zy3ql1s ปีที่แล้ว +1

      how is it going so far?

  • @ast3077
    @ast3077 ปีที่แล้ว +10

    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

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +2

      Thank you for your support, I am researching some ideas hopefully will get interesting ideas soon into more vids. Good luck to you!

  • @denijane89
    @denijane89 10 หลายเดือนก่อน +4

    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!

  • @viaanfc
    @viaanfc 9 หลายเดือนก่อน +1

    wow cool thank you for the update, especially for me who is a beginner who is learning and joining the Nusantara Fx Community

    • @CodeTradingCafe
      @CodeTradingCafe  9 หลายเดือนก่อน

      Thank you for your support!

  • @maurolimaok
    @maurolimaok ปีที่แล้ว +2

    Thanks for the channel.
    I'm studying coding 101 now, and hope to begin investing sometime ahead.
    This knowledge will be valuable for me.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      It's a nice hobby, I hope you will enjoy it as much as I do. Good luck!

    • @maurolimaok
      @maurolimaok ปีที่แล้ว +1

      @@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.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +2

      @@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).

    • @maurolimaok
      @maurolimaok ปีที่แล้ว +1

      @@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.

  • @antagonizeracing
    @antagonizeracing ปีที่แล้ว +2

    Thank you so much! You explained this so well

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Thank you for your support! it's motivating to know that these videos are useful.

  • @sureshpatil7005
    @sureshpatil7005 ปีที่แล้ว +1

    Thankypu. This was exactly what I was looking for as a starting point.

  • @elmaridrisov2491
    @elmaridrisov2491 ปีที่แล้ว +10

    Haven't even viewed the video yet, but leaving the comment for algorithm. Wishing you a million subscribers asap!

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +7

      This is one of the most generous comments ... Thank you so much, wishing you a million dollars in return 🙂
      Edit: asap as well

    • @mananazhar9207
      @mananazhar9207 ปีที่แล้ว +1

      But why

  • @Zenoandturtle
    @Zenoandturtle 9 หลายเดือนก่อน +3

    Great video. I’ve done some programing in C++ & Java but I am new to TradingBot. Very insightful. Great presentation.

  • @aingo6521
    @aingo6521 ปีที่แล้ว

    Thank you sir ! love your work and your channel so far

  • @davidbristoll195
    @davidbristoll195 10 หลายเดือนก่อน +1

    Top quality video, thank you for creating!

    • @CodeTradingCafe
      @CodeTradingCafe  10 หลายเดือนก่อน

      Thank you for your support, glad you liked the video!

  • @CricketKBrown
    @CricketKBrown ปีที่แล้ว +4

    Eres un excelente maestro, muchas gracias por tus explicaciones tan claras.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      Muchas gracias for your support 😊

  • @cosmicdive
    @cosmicdive 7 หลายเดือนก่อน +1

    The automation itself is good. The signal generation I would use as a template. Great video nonetheless!

    • @CodeTradingCafe
      @CodeTradingCafe  7 หลายเดือนก่อน

      Hi, thank you, you are right this is just a template model, we need to replace the signal with a more complete one.

  • @bipmix
    @bipmix 6 หลายเดือนก่อน +1

    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.

    • @CodeTradingCafe
      @CodeTradingCafe  6 หลายเดือนก่อน

      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.

  • @chaddsmith3354
    @chaddsmith3354 ปีที่แล้ว +1

    Thank you so very much! Great video!

  • @LegendaryLlama_
    @LegendaryLlama_ ปีที่แล้ว

    I am happy to find this channel.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Thank you! I am glad these videos are useful.

  • @devsunny10
    @devsunny10 ปีที่แล้ว +1

    Thank you so much, lots of love !!

  • @mariomoheb
    @mariomoheb ปีที่แล้ว +1

    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 ?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      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!

  • @red_rassmueller1716
    @red_rassmueller1716 ปีที่แล้ว +1

    Very helpful. Thank you!

  • @Chuygbg
    @Chuygbg ปีที่แล้ว +2

    I cant wait to code this. I found the video but im away from my pc but this, this deserves a watch

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      Good luck, maybe next I will put a full strategy live in a video... 🙂

  • @smokarcool4954
    @smokarcool4954 ปีที่แล้ว +1

    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.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      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.

    • @smokarcool4954
      @smokarcool4954 ปีที่แล้ว

      @@CodeTradingCafe absolutely 💗👌

  • @AZG324
    @AZG324 ปีที่แล้ว +2

    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.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      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.

  • @lennard4454
    @lennard4454 ปีที่แล้ว +1

    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.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      Yes you are right we need to get the spread first and include its value in SL and TP calculations.

  • @victorbarge-zwick3565
    @victorbarge-zwick3565 ปีที่แล้ว +1

    Hi mate ! Thanks for the video ! Instead of having stoplosses and takeprofits I would like to have a signal that close my sell or buy position. Do you know if there a way to identify the positions I opened in order to implement this strategy ? Because on your video you open positions but you cant really track them

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      Hi yes there is a way to check opened trades and close them if needed in backtesting module I used something similar in a video on Rayner Teo Bollinger Bands strategy.

    • @victorbarge-zwick3565
      @victorbarge-zwick3565 ปีที่แล้ว +2

      @@CodeTradingCafe Allright I'll check this out ! Thanks a lot for your help and quick answer :)

  • @vaabroinnabro6952
    @vaabroinnabro6952 11 หลายเดือนก่อน +1

    i really enjoyed your videos brotha !

    • @CodeTradingCafe
      @CodeTradingCafe  11 หลายเดือนก่อน

      I appreciate your support, thank you!

  • @homealone75
    @homealone75 ปีที่แล้ว +2

    Thanks! I did not catch if you monitor open orders and positions, otherwise you may have a pileup of both many times over.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      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

  • @thehussains3100
    @thehussains3100 6 หลายเดือนก่อน +1

    great video! can i use other API's instead of Oanda?

    • @CodeTradingCafe
      @CodeTradingCafe  6 หลายเดือนก่อน

      Thank you! yes you can a lot of brokers are now offering Python APIs, need to go through their docs though.

  • @tradewithtony
    @tradewithtony 5 หลายเดือนก่อน +1

    Nice one. Do you have a Video to this with MQL4 OR MQL 5 ? without dealing with API

    • @CodeTradingCafe
      @CodeTradingCafe  5 หลายเดือนก่อน

      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.

  • @santhoshdasari7
    @santhoshdasari7 ปีที่แล้ว +1

    Good one!!!… thanks for sharing…

  • @abdokarsous3521
    @abdokarsous3521 8 หลายเดือนก่อน +1

    Nice and clean thanks man

    • @CodeTradingCafe
      @CodeTradingCafe  8 หลายเดือนก่อน

      Any time! thank you for your support.

  • @leandrogoethals6599
    @leandrogoethals6599 9 หลายเดือนก่อน +1

    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

    • @CodeTradingCafe
      @CodeTradingCafe  9 หลายเดือนก่อน

      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.

  • @dwarakid3663
    @dwarakid3663 ปีที่แล้ว +1

    good info ..it was easy to understand

  • @pandatech3245
    @pandatech3245 ปีที่แล้ว +1

    Thank for the video i will try it ! By the way have you french accent ? And have you made money from your bots ?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      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 😂

  • @ninjaz5979
    @ninjaz5979 ปีที่แล้ว +1

    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

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      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.

  • @bwtknakhstr
    @bwtknakhstr ปีที่แล้ว +2

    Very nice channel, thank you for your content. Say please do you have any video similar to this but for binance futures?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +2

      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!

  • @sadootaqoo981
    @sadootaqoo981 ปีที่แล้ว +1

    Greatt video as usual, we still need a vps for continuous trading rigth?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      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.

  • @eliotharreau7627
    @eliotharreau7627 ปีที่แล้ว +1

    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 :)

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      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!

  • @adamcad5954
    @adamcad5954 ปีที่แล้ว +6

    Hi, bro! I appreciate your video a lot it's very informative, I wonder if you would like to program the Quasimodo pattern with divergence it's a very useful strategy especially when it's combined with the supply and demand concept

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +3

      Hi thank you for your supportive comment, I did something similar check it out I hope it helps th-cam.com/video/Mxk8PP3vbuA/w-d-xo.html

  • @dumbcat
    @dumbcat ปีที่แล้ว +1

    i am a discretionary trader looking to get into automation. i sometimes trade multiple times per minute. not always, but sometimes. do you think python is suitable for such rapid trading? thank you

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Hi, yes you can make fast trading algorithms in python, expected lag is less than a second per trade from python side, then you have the connection and other factors, but it usually works well.

  • @musiclover1067
    @musiclover1067 10 หลายเดือนก่อน +1

    Love your work!
    Can you make a video on how to connect your bot on to MT5 please?
    Thank you!

    • @CodeTradingCafe
      @CodeTradingCafe  10 หลายเดือนก่อน +1

      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?

    • @musiclover1067
      @musiclover1067 10 หลายเดือนก่อน

      @@CodeTradingCafe Thank you for the reply!
      I was hoping to be able to connect python straight to MT5 and trade.

  • @aurelberger6847
    @aurelberger6847 ปีที่แล้ว +1

    Thanks for that great video! However, I can't find the BTC_USD pair. Is there any way to import live BTC data from oanda?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Thank you for your support, I tried to check their website they only mention "bitcoin" as the name of the instrument but couldn't find anything related to the python API I guess you can simply try the few sensible options see which one works (BTC_USD, USD_BTC, BTCUSD, USDBTC, bitcoin...) not sure if my comment is helpful sorry!

  • @TheJonnysmith10
    @TheJonnysmith10 ปีที่แล้ว +1

    hi there! Interesting video, thanks for the time spent on it, I have the following error, any ideas what might be causing it?
    ImportError: cannot import name 'access_token' from 'config'

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      Hi thank you for your support. The error is because you either need a config.py file where you create a variable access_token, or you can directly do it in the python code and remove the "from config import..." I hope this helps

  • @alexanderjrmuchimba8436
    @alexanderjrmuchimba8436 ปีที่แล้ว +2

    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!

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      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!

    • @alexanderjrmuchimba8436
      @alexanderjrmuchimba8436 ปีที่แล้ว +1

      Thanks will be waiting

  • @Dr.jayfrancis
    @Dr.jayfrancis ปีที่แล้ว +1

    Good one as usual!

  • @rahilyouness8331
    @rahilyouness8331 ปีที่แล้ว +1

    thank you very helpfull videos

  • @thinketh2408
    @thinketh2408 11 หลายเดือนก่อน +1

    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?

    • @CodeTradingCafe
      @CodeTradingCafe  11 หลายเดือนก่อน +1

      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!

    • @thinketh2408
      @thinketh2408 11 หลายเดือนก่อน

      @@CodeTradingCafe thanks

  • @rodrigomoreno8858
    @rodrigomoreno8858 8 หลายเดือนก่อน +1

    hello! Did youmplay your strategy on trading view? Or Where?

    • @CodeTradingCafe
      @CodeTradingCafe  8 หลายเดือนก่อน

      Hi, no directly from python, this is the purpose of this video.

  • @chibuikeanene5016
    @chibuikeanene5016 ปีที่แล้ว +7

    Hey dude, love what you’re doing. I’m curious to know how long have you been live trading with this bot and how are the returns so far?.
    I am still a python beginner so If you can point me to the right resource to build my own algo then I’ll appreciate that. Thanks again💪🏽

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +12

      Hey thank you for your support. Trading since 10 years, algorithms since 6 years, don't expect to be rich (8-12 percent yearly return) unless you put high numbers in there but will you risk it? (I don't like high risk not adrenaline rush lol so I kept it as a side hobby along with my job that is in a similar field).
      Edit: for programming check my python learning playlist

    • @chibuikeanene5016
      @chibuikeanene5016 ปีที่แล้ว +2

      I’m also a trader and I know the realities lol. 8-12% ROI is decent and hard to come by in any investment. Maybe you don’t need to risk your own capital, you could try trading with some prop firms that allow it.
      Thanks I’ll check out your playlist.

    • @CaptainCsaba
      @CaptainCsaba ปีที่แล้ว +4

      @@CodeTradingCafe Can I ask which strategies you use for this? I know you will not tell but I'll try anyway.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +13

      @@CaptainCsaba it's something very similar to the strategies I show in here but the lot size is not fixed it's proportional to a set of rules and the TP/SL also (I change these myself when the trade is opened), so in brief take any good indicators from this channel it's already half the strategy the other half is lot size and trade management. This is how I do. And by the way many people think a winning strategy is a very complex one, my experience is exactly the opposite, simple strategies are more rewarding.

    • @CaptainCsaba
      @CaptainCsaba ปีที่แล้ว +1

      @@CodeTradingCafe That was very insightful, thank you very much!

  • @viktormarkus7291
    @viktormarkus7291 ปีที่แล้ว +2

    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.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      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.

  • @marcocetraro9675
    @marcocetraro9675 ปีที่แล้ว +2

    Great video. I have been using Oanda API for several months already. Have you tried to obtain the Spreads of the pairs?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      Hi, I haven't but I would assume there is a way to get the ask price the bid price and process the difference.

  • @MaterialBoy18
    @MaterialBoy18 ปีที่แล้ว +1

    Do you think this is reproduceable for example for scalable capital?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      Hi, this is not a full strategy just an example to connect from python, but I have backtested strategies in my previous videos.

  • @LUDOVICOPAPALIA
    @LUDOVICOPAPALIA 4 หลายเดือนก่อน

    Hey, how can you determine how much to invest? Does it has a minimum and a maximum? Or a fixed amount? Thanks

    • @CodeTradingCafe
      @CodeTradingCafe  4 หลายเดือนก่อน

      In this example I used fixed lot size, but more complex systems use dynamic sizing.

  • @EmanuelDemetrescu
    @EmanuelDemetrescu ปีที่แล้ว +1

    Great tutorial ! Thank you. Unfortunately the Google drive file seems to be not accessible. Can you restore the link ?🙏🏼

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      Hi thank you for your support! Please check the pinned comment with the updated link, let me know if it worked.

  • @josipgregoric5380
    @josipgregoric5380 2 หลายเดือนก่อน +1

    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?

    • @CodeTradingCafe
      @CodeTradingCafe  2 หลายเดือนก่อน

      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).

  • @muhammadabdulmumeen2122
    @muhammadabdulmumeen2122 ปีที่แล้ว +1

    Hey code trading. I've finally built my forex forecasting model thanks to you. My question is instead of SL and TP. I want my model to tell me to buy or sell or hold. Like a python code.
    Thank you as I'm looking forward for your help.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      I am glad it's working for you, so instead of backtesting just let it print the signal on the screen, you can also make it send you an email it works good too.

    • @muhammadabdulmumeen2122
      @muhammadabdulmumeen2122 ปีที่แล้ว +1

      @@CodeTradingCafe your email please.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Hi it's in the about section of the channel

  • @lennard4454
    @lennard4454 ปีที่แล้ว +1

    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

  • @VonSchelzen
    @VonSchelzen ปีที่แล้ว +1

    I love your videos

  • @sharemarketinvestorsgroups5602
    @sharemarketinvestorsgroups5602 6 หลายเดือนก่อน +1

    i have problem with three last candle signal generator can u help for that

    • @CodeTradingCafe
      @CodeTradingCafe  6 หลายเดือนก่อน

      You need to have an account set with a key to access live data otherwise the code should work.

    • @sharemarketinvestorsgroups5602
      @sharemarketinvestorsgroups5602 6 หลายเดือนก่อน

      @@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

  • @leeroylita637
    @leeroylita637 8 หลายเดือนก่อน +1

    How do you get around the sell commission that the platform takes?

    • @CodeTradingCafe
      @CodeTradingCafe  8 หลายเดือนก่อน +1

      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.

  • @DalazG
    @DalazG 7 หลายเดือนก่อน +1

    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

    • @CodeTradingCafe
      @CodeTradingCafe  7 หลายเดือนก่อน +1

      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).

    • @DalazG
      @DalazG 7 หลายเดือนก่อน +1

      @CodeTradingCafe ah that should be brilliant. Been looking for tutorials on binding an ai trading bot

  • @ThaiTran-ly2ok
    @ThaiTran-ly2ok ปีที่แล้ว +1

    hey mate, do you have any recommendation about the places to download historical data for Forex ?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      Hey, yfinance and dukascopy are good. Good luck!

    • @ThaiTran-ly2ok
      @ThaiTran-ly2ok ปีที่แล้ว +1

      @@CodeTradingCafe dukascopy is awesome, super thank

  • @aakuthotaharibabu8244
    @aakuthotaharibabu8244 ปีที่แล้ว +1

    I love the content but please use light mode screen because its difficult for visualization .

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      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.

    • @aakuthotaharibabu8244
      @aakuthotaharibabu8244 ปีที่แล้ว +1

      @@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.

  • @jerrydoyungoy-nc8qd
    @jerrydoyungoy-nc8qd 9 หลายเดือนก่อน +1

    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..

    • @CodeTradingCafe
      @CodeTradingCafe  9 หลายเดือนก่อน

      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!).

  • @alexmoeller8650
    @alexmoeller8650 6 หลายเดือนก่อน +1

    if we decided not to make a config file for the oanda account, where should we put the account id?

    • @CodeTradingCafe
      @CodeTradingCafe  6 หลายเดือนก่อน

      you can change the accountID variable in the code, like accountID = '....'

  • @cityofjoy8830
    @cityofjoy8830 3 หลายเดือนก่อน +1

    Programmer + trader 😮 deadly.
    Overall markets are highly manipulated.

    • @CodeTradingCafe
      @CodeTradingCafe  3 หลายเดือนก่อน

      Hi, thank you for your support. Yes the market is not as friendly but we can always sneak around in someway :)

  • @moaminbj9588
    @moaminbj9588 5 หลายเดือนก่อน +1

    very good thanks

  • @atinmehra5819
    @atinmehra5819 ปีที่แล้ว +2

    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 ..

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      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.

    • @atinmehra5819
      @atinmehra5819 ปีที่แล้ว

      @@CodeTradingCafe sure and thanks 😃

  • @heenakowsar4538
    @heenakowsar4538 3 หลายเดือนก่อน +1

    Hi Can you make vedios how to install and broker which supports this algorithm please

    • @CodeTradingCafe
      @CodeTradingCafe  3 หลายเดือนก่อน

      You need to pip install oanda_candles and the other packages we're using.

  • @dfcastro
    @dfcastro ปีที่แล้ว +3

    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.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      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.

  • @thepunter1
    @thepunter1 24 วันที่ผ่านมา +1

    Hi, I can't see the download link for the code. I can only seer the Jupyer link.

    • @CodeTradingCafe
      @CodeTradingCafe  23 วันที่ผ่านมา

      Hi, yes the jupyter link is the code but you need to open it in Jupyter notebook reader

  • @tradingview-strategy
    @tradingview-strategy ปีที่แล้ว +1

    HI, Sir. Thanks your tutorial. How to get your preview images's "Easy Trading BOT" ui dashboard?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Hi, I am not sure I understand what you mean?

    • @tradingview-strategy
      @tradingview-strategy ปีที่แล้ว +1

      @@CodeTradingCafe What's name of the software in 0:01?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      @@tradingview-strategy It's not a software this is the Oanda Interface

  • @sadikelouahabi398
    @sadikelouahabi398 ปีที่แล้ว +1

    Thank you.

  • @uchennagodfrey8343
    @uchennagodfrey8343 3 หลายเดือนก่อน +1

    Thanks alot

    • @CodeTradingCafe
      @CodeTradingCafe  3 หลายเดือนก่อน

      Most welcome, thank you for your support.

  • @victorortiz9694
    @victorortiz9694 ปีที่แล้ว +1

    Sir, Thank you for the video, I try to find the file and not is possible?, you have other news files?, Thank you for your support!!!

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Hi thank you for your support, the file is in the new link check the pinned comment. Let me know if you got it. Good luck!

  • @alexandersorbas1881
    @alexandersorbas1881 ปีที่แล้ว +1

    Fantastic !!!

  • @nagarzunaam9642
    @nagarzunaam9642 8 หลายเดือนก่อน +1

    Sir.. Can u share me to read option chain.. Oi and change in oi.. Selected Columns.. All comuns not required..

    • @CodeTradingCafe
      @CodeTradingCafe  8 หลายเดือนก่อน

      Hi, thank you for your comment, can you be more specific? I am not sure I understood correctly.

  • @leocycling
    @leocycling ปีที่แล้ว +1

    thx bro, what is the good way to set scheduler for trading job, seconds or minutes for timeframe 1m,5m,15m for examples, thx.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      Hi, it depends on the timeframe you are trading the scheduler is only there to launch your function.

    • @leocycling
      @leocycling ปีที่แล้ว +1

      @@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

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +1

      Hi, yes it's better to sync with the timeframe as scheduling faster than the timeframe only adds unnecessary CPU and bandwidth work.

  • @ChristianLazoFuentes
    @ChristianLazoFuentes 2 หลายเดือนก่อน

    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

  • @courtneylomax7254
    @courtneylomax7254 ปีที่แล้ว +1

    How do you feel about QuantConnect? I was originally going to try their "Lean Engine", but your way seems less complicated, and better explained. Great content btw.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว +2

      Thank you for your support. It all depends how much time you want to spend on learning and trying around. It's good to master many tools and be part of different communities but sometimes it can become overwhelming and maybe too much to handle which is bad for trading. Out of experience, simple approaches tend to be more successful!

  • @hariranormal5584
    @hariranormal5584 ปีที่แล้ว +1

    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.

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Hey the field is called computer vision you can use CNN to analyze the pictures. Good luck!

  • @Anonymous-re9fd
    @Anonymous-re9fd 4 หลายเดือนก่อน +1

    my code is identical to yours but it says that name dataF is undefined at the for loop. any ideas ?

    • @CodeTradingCafe
      @CodeTradingCafe  4 หลายเดือนก่อน

      You need to run all the cells in order.

    • @Anonymous-re9fd
      @Anonymous-re9fd 4 หลายเดือนก่อน +1

      @@CodeTradingCafe thank you sir

  • @tarahansystemkaviryazd344
    @tarahansystemkaviryazd344 4 หลายเดือนก่อน

    what about OTC market bro? how can i read OHLC of pocket option candlestick???

    • @CodeTradingCafe
      @CodeTradingCafe  4 หลายเดือนก่อน

      I am not sure if dukascopy has this data I've never traded OTC, try their platform (dukascopy) see if they provide historical data.

  • @sureshpatil7005
    @sureshpatil7005 ปีที่แล้ว

    Does this code work with Binance account ? Do I need to make lot of changes or only account ID and access_token changes are required?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Hi no it doesn't work you will need to modify it including the binance libraries and functions instead of oanda.

  • @filipeantunes5967
    @filipeantunes5967 ปีที่แล้ว

    how i can make the code running? what i need? can u tell me pls? love the video, i want to try it

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Hi, you need to install python on your PC try anaconda installer it's easy, then you open it with jupyter notebook. But if it's your first experience with python try this playlist first, good luck! Python Learning: th-cam.com/play/PLwEOixRFAUxZVV0XNWlapem1yoRA4rt_O.html

  • @harryowuor4851
    @harryowuor4851 ปีที่แล้ว +1

    I want to use exness broker on this bot.which lines do I need to change to make it work?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Most of the API related lines you have to check first with the broker if they support python trading

  • @user-rr7yi3ru2p
    @user-rr7yi3ru2p ปีที่แล้ว +1

    hello! how to create continuation chart for 12 min and 5 min if I have tick data?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      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.

  • @vishalsingh-ks4ji
    @vishalsingh-ks4ji ปีที่แล้ว +1

    Mind blowing

  • @muhammadabdulmumeen2122
    @muhammadabdulmumeen2122 ปีที่แล้ว +1

    The sl and tp shows up after every 15mins you used right?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      Can you explain I am not sure if I understood correctly?

    • @muhammadabdulmumeen2122
      @muhammadabdulmumeen2122 ปีที่แล้ว

      @@CodeTradingCafeyou used a 15 mins time frame, yeah. So our SL and TP shows after every 15 mins? Or we have to go back to the code manually?

    • @CodeTradingCafe
      @CodeTradingCafe  ปีที่แล้ว

      @@muhammadabdulmumeen2122 SL and TP are set at the beginning of the trade and remain there as long as the trade is opened

  • @antonmakarenko3110
    @antonmakarenko3110 7 หลายเดือนก่อน +1

    Awesome!