Introduction to BACKTRADER [Backtesting Trading Strategies Library for Python]

Поділитися
Вставка
  • Опубліковано 4 лис 2024

КОМЕНТАРІ • 146

  • @Algovibes
    @Algovibes  2 роки тому +3

    Hi everyone,
    If you are interested how to build a more sophisticated Trading Strategy implementing a SMA/BB/RSI Trading Strategy with Buy Limit orders and a holding perios, check out my newest video here:
    ua-cam.com/video/9RfFKV0c_u8/v-deo.html

  • @hannes6116
    @hannes6116 2 роки тому +3

    Sehr cool. Wollte es mir schon ansehen. Umso cooler, dass Du es hier vorstellst

    • @Algovibes
      @Algovibes  2 роки тому

      Nice, danke für deinen Kommentar :-)

  • @JohnnyQuestFishing
    @JohnnyQuestFishing 7 місяців тому +1

    Thank you so much for this video. It really gets me started quickly on Backtrader. I have a couple of strategies I wanted to plug in, but did not want to put them in the cloud because I am going to sell them later. Again, thanks for the Backtrader intro.

    • @Algovibes
      @Algovibes  6 місяців тому

      Very welcome mate, thanks for dropping a comment!

  • @sweealamak628
    @sweealamak628 2 роки тому +2

    That's the great thing about Python. There are so many libraries out there that make our lives easier. 👍

    • @Algovibes
      @Algovibes  2 роки тому

      Agreed. Preferring doing it from scratch tho :-)

    • @sweealamak628
      @sweealamak628 2 роки тому

      @@Algovibes 😅 makes you a better programmer that way.

  • @chigstardan7285
    @chigstardan7285 2 роки тому +3

    I'm so happy you made this video! Can't wait to see a more advanced tutorial for this, Maybe a macd stoch rsi strategy?

    • @Algovibes
      @Algovibes  2 роки тому

      Happy you like it! Thanks for the suggestion :-)

  • @ふらちゃん-y6i
    @ふらちゃん-y6i 2 роки тому +5

    Hello Algovibes! Thank you so much for providing a backtester solution (that I was asking for in one of my comment to your previous video)! In the meantime, I didn't give up and made a event-driven itertuple iteration back testing code that is working mostly fine. Still very interesting to see how you are doing it and learning everytime a lot from your videos!

    • @Algovibes
      @Algovibes  2 роки тому +1

      Awesome man. Thanks a lot for your kind words.

  • @ajayramprasad6457
    @ajayramprasad6457 2 роки тому +4

    Good video. I have been trying to use backtrader. This video cleared few of my questions. I am waiting to see to test your strategies with this library especially STOCH, MACD, RSI

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks man, happy to read. Also thanks a lot for the suggestion!

  • @pranjalchaubey
    @pranjalchaubey 2 роки тому +2

    Please looking forward to more videos on Backtrader, specifically some price pattern strategy where distance between consecutive candles is not fixed.
    For example,
    "going long only at the second inverted hammer formed after a bullish EMA cross"

  • @kondor7
    @kondor7 2 роки тому +2

    I discovered Backtrader recently , would be happy to have more videos about it with some logics

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks for your feedback!

  • @amitbuch
    @amitbuch 2 роки тому +2

    Very precise and targetted introduction of the main features with good examples that once can immediately implement. Thanks. I enjoyed your style of nerration, length of content and depth of coverage,

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks a lot Amit for your feedback. Very happy that you enjoyed it!

  • @sandunga666
    @sandunga666 2 роки тому +1

    This was amazing, thanks for share and explain it. I was getting crazy thinking in my backtests developments and this tool make it simple. Thank you again! Greatings from Argentina!

    • @Algovibes
      @Algovibes  2 роки тому +1

      Thanks for watching man and best regards to Argentina 🇦🇷

  • @davidbristoll195
    @davidbristoll195 Рік тому

    Thanks for creating this video. It's been a really helpful intro and has got me into a position where I can understand the code and even create and test some of my own basic strategies.

  • @blakeramsey3373
    @blakeramsey3373 5 місяців тому +1

    Very well made and explained

    • @Algovibes
      @Algovibes  5 місяців тому +1

      thank you mate, appreciate your comment

  • @rajeevmenon1975
    @rajeevmenon1975 2 роки тому +2

    Happy to see you with BackTrader. Cool stuff as always. Pray to God that you are always healthy & peaceful to release such great contents. Would be great if I can know your name so as to address you correctly

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks buddy for your kind words :-)

  • @EpicChivers
    @EpicChivers 2 роки тому +3

    Love the videos, very informative and structured in a way that makes the process easy to follow. I see your focus to date has been primarily in the technical indicator side of things, but I'd be super interested to see your views on value investing automation.

    • @Algovibes
      @Algovibes  2 роки тому

      Thank you my man. Appreciate your feedback! Do you have something specific regarding value investing in mind?

    • @EpicChivers
      @EpicChivers 2 роки тому +1

      @@Algovibes I'd be interested in seeing something that automates the security analysis of companies. This would provide you with a pool of stock picks which you could then go on to invest in via one of the strategies you have previously outlined, or to create an automated value-based portfolio.

    • @pietraderdetective8953
      @pietraderdetective8953 2 роки тому

      Yes please! automation based on value investing criterions would be super interesting!
      Maybe start with the most commonly used value investing criteria? That in my opinion would be one of these: PER, EV/EBITDA, PBV
      Then compare between the valuation ratios vs the industry's average --> the output from this: we get which stocks are undervalued compared to its industry.
      Last step would be to backtest if we buy undervalued stocks and see what's the returns for this value investing strategy.

  • @BOSprodz
    @BOSprodz 2 роки тому +2

    Can't wait to watch! Best channel ever

  • @olivierdefosse5956
    @olivierdefosse5956 2 роки тому +1

    Hooooo God Alfovibes,
    I even get up at night to listen to your divine light, enlightening us all with your investigations and your divine reflections
    Keep showing us the way
    We beg you!
    :-)

    • @Algovibes
      @Algovibes  2 роки тому

      😀 Thanks for your support man!

  • @print3d344
    @print3d344 2 роки тому +1

    So excited video thankful for you buddy

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks a ton for your support :-)

  • @stalepalemale
    @stalepalemale 2 роки тому +1

    Very good video, would love to see some more in depth stuff

  • @moondevonyt
    @moondevonyt 2 роки тому +1

    so happy i found this video. i was thinking of making something similar. maybe i will to cover a few things missed

    • @moondevonyt
      @moondevonyt 2 роки тому +1

      ill try to add some custom strategies too, i think that will be useful

    • @Algovibes
      @Algovibes  2 роки тому

      Sure man, good luck! 🍀

  • @bhoyt4530
    @bhoyt4530 Рік тому +1

    Do you have any videos explaining how to take this one more step to set a broker for live trading? Mostly interested in connecting to Binance.

  • @sheps5656
    @sheps5656 2 роки тому +2

    I'd like to see you add a Forex currency pair or two into the tests to round out markets the strategies are tested on. Crypto, stock, currencies. EURUSD makes sense.

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks a lot for your suggestion!

  • @SmithVestors
    @SmithVestors 2 роки тому +1

    Great video! Thanks for sharing

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks for watching man :-)

  • @marcogelsomini7655
    @marcogelsomini7655 2 роки тому +2

    series on BT would be appreciated!

    • @Algovibes
      @Algovibes  2 роки тому +1

      Cannot promise a series but quite sure I am gonna cover on of "my" previous strategies.

  • @luketyler1875
    @luketyler1875 2 роки тому +1

    Hi, awesome tutorial big fan of the videos. I'd really like to see you use backtesting your previous stochastic, RSI and MACD strategy

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks a lot Luke, great to read!

  • @daniele9986
    @daniele9986 2 роки тому +11

    Great content thanks!!! It would be great if you could backtest your STOCH MACD RSI strategy with Cryptos (BTC and ETH) which I believe is one of the best you have published. Thanks again for sharing.

    • @Algovibes
      @Algovibes  2 роки тому +3

      Thanks for your comment man. That would be indeed interesting to check out! Noted it.

    • @carlocarnevali7790
      @carlocarnevali7790 2 роки тому

      @@Algovibes I'm following! It'd be very useful

  • @ahmetbinatlioglu8848
    @ahmetbinatlioglu8848 2 роки тому +1

    Love your work bro

  • @krishnathakur7982
    @krishnathakur7982 2 роки тому +1

    Hi Algovibe, can you do some option buying strategy with backtrader. If you can do then it will be very helpful. Thanks bro for such kind of awesome content.

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks buddy for watching my stuff. It is not on my list for the next videos but I noted your suggestion.

  • @itayhilel2168
    @itayhilel2168 2 роки тому +1

    Nice!! Can we level up and do some flush loans? Or is that a big ask?

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks man. There is nothing like a big ask ;-) I am always thankful for suggestions. But in this specific case I don't have enough exposure to make a resourceful video on that (yet).

  • @Bobbycarrot83
    @Bobbycarrot83 7 місяців тому +1

    Super video!
    Quick question though, my cerebro plot doesnt show and I have the exact same code with %matplotlib inline.
    Could you help? =)

    • @Algovibes
      @Algovibes  7 місяців тому

      Thx mate. I had to downgrade matplotlib as far as I remember. Maybe you give that a shot. cheers!

  • @PavelSumik
    @PavelSumik 2 роки тому +1

    perfect video as always, thank you much

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks a lot Pavel. Appreciate your support.

  • @noiseforthealgorithm4668
    @noiseforthealgorithm4668 6 місяців тому +1

    i'm completely new to algo trading and coding. Can you test an intraday strategy on Backtrader?

    • @Algovibes
      @Algovibes  6 місяців тому +1

      Hi mate, already did on one of my videos. Be sure to check out the ones in the Python for Finance playlist. Cheers!

    • @noiseforthealgorithm4668
      @noiseforthealgorithm4668 6 місяців тому

      @@Algovibes ok thanks!

  • @alihobballah
    @alihobballah Рік тому +1

    having spent one month on zipline, i decided to use another friendly backtesting library.. what would be yoru second pick after Zipline? Something with a big community and lots of documentation .. Zipline is just to hard to use .. with gratitude

    • @Algovibes
      @Algovibes  Рік тому

      Sorry for my late reply ali. My preferred way of Backtesting is doing it from scratch :-)

  • @Gavinnnnnnnnnnnnnnn
    @Gavinnnnnnnnnnnnnnn 2 роки тому +1

    you should use geometric mean for the return

    • @Algovibes
      @Algovibes  2 роки тому

      This is a Backtrader Introduction. I don't even use any returns here. Can you elaborate? Thx in advance!

  • @ManojAP
    @ManojAP 11 місяців тому +1

    thank you.

    • @Algovibes
      @Algovibes  10 місяців тому

      Welcome mate. Thanks a lot for watching! :-)

  • @mastercrypto9587
    @mastercrypto9587 2 роки тому +2

    hi.
    you are amazing.
    could you please write a code for kucoin with websocket and RSI STOCH and MACD?
    i could not implement kucoin websocket to dataframe.
    i am very new in python
    thanks bro

  • @samueltamayogaviria3377
    @samueltamayogaviria3377 2 роки тому +1

    Hello bro! nice to see that you are using Backtrader. Could you make a strategy from scratch? thanks!

    • @Algovibes
      @Algovibes  2 роки тому

      Hi :-)
      Sure, do you have something specific in mind?

  • @suchan7889
    @suchan7889 2 роки тому +1

    Your tutorial is good. Can you do a similar video using Vector BT ? thanks a lot.

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks mate,
      vectorBT is on my list, yes. Not quite sure when I will cover it tho.

  • @damianwysokinski3285
    @damianwysokinski3285 Рік тому +1

    Is it possible to plot the trading graph on frontend like Angular or Reacts?
    I mean if the backtrader can return needed data and for exaple use Plotly to plot it from angular?

  • @mohammednasser6948
    @mohammednasser6948 2 роки тому +1

    Great content what about live trading with backtrader?

  • @its_code
    @its_code 2 роки тому +1

    Amazing 😍 bro. Really amazing 😍😄😃.
    Love 💕 from Pakistan ❤️❤️

    • @Algovibes
      @Algovibes  2 роки тому +1

      Love to 🇵🇰 ❤️ Thanks for your support!

    • @its_code
      @its_code 2 роки тому +1

      @@Algovibes ❤️😍😘🤩💕💕😊 thanks 👍💕

  • @Abrahamis
    @Abrahamis 2 роки тому +1

    Awesome Video, as always!
    Have you every tried vectorbt?

    • @Algovibes
      @Algovibes  2 роки тому +1

      Thanks buddy. Nope, had a look but didn't dive deeper yet. Should probably give it a shot. Will do a vid on it if I like it, thx for the suggestion!

    • @Abrahamis
      @Abrahamis 2 роки тому

      @@Algovibes I came to it after watching a vid from Larry ua-cam.com/video/9rpMzng_aw0/v-deo.html. Currently stuck with cascaded trades though 🤪

    • @mr.gk5
      @mr.gk5 2 роки тому

      @@Algovibes Please do a vectorbt in depth tutorial. Vectorbt is like way more cooler

  • @lambolin600
    @lambolin600 2 роки тому +1

    is it possible to test multiple symbols plus multiple timeframes? like every time any of the 500 stocks out of the sp500 rsi(Daily) went < 30, we want to open one(only one until the next stocks rsi turns < 30) trade on the m15 timeframe if the sma50(m15) crosses the sma200(m15)?

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks for watching man! Sure, that's possible. I wouldn't do it with BT tho if I wanted to do that.

  • @AlexanderLetetski
    @AlexanderLetetski Рік тому

    which browser yure using? in your point of view this one is best pip lib? thanks

  • @castleko3764
    @castleko3764 2 роки тому +1

    Any chance you can make a video with a different api besides Binance it’s banned in my country

    • @Algovibes
      @Algovibes  2 роки тому

      Hi Daniel, I roughly covered Kucoin here:
      ua-cam.com/video/0QKXso4PIc4/v-deo.html

    • @castleko3764
      @castleko3764 2 роки тому

      @@Algovibes thanks man!!! Love ya vids

  • @franky12
    @franky12 2 роки тому +1

    What would you prefer, *Backtrader* or *Backtrading.py* library?

    • @Algovibes
      @Algovibes  2 роки тому +1

      Depends on the purpose. Backtrading surely for quickly backtesting stuff. Backtrader probably for more extensive stuff.

  • @theWSt
    @theWSt 2 роки тому +1

    Can Backtrader also be used for live trading or only backtesting?

    • @Algovibes
      @Algovibes  2 роки тому +1

      Regarding the docs also for live trading but I do not have any experience with that!

  • @ryantao6015
    @ryantao6015 2 роки тому +1

    I use VSCode and just followed the quickstart; however, the third step doesn't work and gives multiple file errors. What did I do wrong?

  • @vinnyvidivici5930
    @vinnyvidivici5930 Рік тому

    what screen is that at :38 in the video? i'm trying to import backtest into python and i don't know what screen that is that you're using. thank you

  • @markfreeman3287
    @markfreeman3287 2 роки тому +1

    Is it possible to get intraday data and test this back testing on it?

    • @Algovibes
      @Algovibes  2 роки тому

      Sure, also possible. You could e.g. use the Binance API or just take the 1m interval from yfinance.
      Binance API -> Just check out some videos in my cryptobot playlist

  • @sokolnushi2149
    @sokolnushi2149 Рік тому +1

    Can the same be done in VSCODE

  • @thomas2004ch
    @thomas2004ch Рік тому

    What Python version is supported?

  • @linas1211
    @linas1211 Рік тому +1

    does this library work for 3min timeframe or 1h timeframe?

  • @ahmetsuatyildiz4836
    @ahmetsuatyildiz4836 2 роки тому +1

    Is optimization possible?

    • @Algovibes
      @Algovibes  2 роки тому

      Yea, pretty sure it is. The author is actually covering some optimization topics in the docs.

  • @STANDBYME.
    @STANDBYME. Рік тому +1

    ERROR: Could not build wheels for ta-lib, which is required to install pyproject-toml based projects can you solve this

    • @Algovibes
      @Algovibes  Рік тому

      I am not using ta-lib in this video. Can you double check? thx!

    • @STANDBYME.
      @STANDBYME. Рік тому

      @@Algovibes but do you know I can solve this issue

  • @JomanSofly
    @JomanSofly 2 роки тому +1

    Can i ask how to use cerebro.plot in pycharm ? it seems to only work on Jupyter notebook ??

    • @Algovibes
      @Algovibes  2 роки тому

      Should be working similarly but with an external plot (window with the plot popping up)

  • @yigityilmaz2786
    @yigityilmaz2786 2 роки тому +1

    My kernel dies every time at cerebro.plot(). Our codes are totaly the same. I'm using Jupyter Notebook on macbook pro'17. I would really appreciate if you can help/ direct me with the solution. Thanks for the video!

    • @Algovibes
      @Algovibes  2 роки тому

      Hi Yigit,
      did you add the matplotlib inline line as I mentioned in the beginning?

    • @yigityilmaz2786
      @yigityilmaz2786 2 роки тому +1

      @@Algovibes yes I did. Our codes are totally the same. Do u know any possible solutions or causes to this issue? Thanks for your reply

  • @antonioluchinger8115
    @antonioluchinger8115 2 роки тому +1

    Hello, i would like to contact for a privatd coding service if is posible. Thanks

  • @salemabualem
    @salemabualem 2 роки тому +1

    Can I have the code you used in this video ?

    • @Algovibes
      @Algovibes  2 роки тому

      It's basically copy pasted from the Backtrader documentation. For getting my Notebooks you are invited to join as a member:
      ua-cam.com/users/Algovibesjoin

  • @viniciuscaetano7267
    @viniciuscaetano7267 2 роки тому +1

    top!!!

    • @Algovibes
      @Algovibes  2 роки тому

      Thx for your comment :-)

  • @aarondelarosa3146
    @aarondelarosa3146 7 місяців тому

    It's incomplete. Where's the last plot?

  • @hackingtamila8594
    @hackingtamila8594 2 роки тому +1

    How can i get the codes

    • @Algovibes
      @Algovibes  2 роки тому

      ua-cam.com/users/Algovibesjoin

    • @Algovibes
      @Algovibes  2 роки тому

      The vast majority of this code can just be found in the docs. Anyhow: Happy to welcome you as a member!

  • @WinWiiiiin120
    @WinWiiiiin120 2 роки тому

    Why is cerebro.plot() not working for me ?

    • @niikurasu2855
      @niikurasu2855 2 роки тому

      forgot matplotlib inline?

    • @WinWiiiiin120
      @WinWiiiiin120 2 роки тому

      @@niikurasu2855 I’ve done it

    • @eastwesttrading269
      @eastwesttrading269 2 роки тому

      I got this
      "ImportError: cannot import name 'warnings' from 'matplotlib.dates' (C:\Users\anaconda3\lib\site-packages\matplotlib\dates.py)"

    • @Algovibes
      @Algovibes  2 роки тому +2

      Backtrader can be a bit petulant sometimes 😛
      The Matplotlib error is dependent on your version as far as I remember.

    • @thepuma8558
      @thepuma8558 2 роки тому +3

      i had same issue and just
      pip install matplotlib==3.0.0
      and it all worked

  • @rafalsza
    @rafalsza 2 роки тому +1

    vectorbt is better then backtrader

    • @Algovibes
      @Algovibes  2 роки тому

      Thanks for the suggestion! Will have a look.

  • @chapmansbg
    @chapmansbg 2 роки тому +1

    man that is some sluggish backwards code.

    • @Algovibes
      @Algovibes  2 роки тому

      What exactly are you referring to? 😄

    • @chapmansbg
      @chapmansbg 2 роки тому +1

      @@Algovibes probably a bit strongly worded but I would tidy up some of those if else statements and use np.where, it is a lot faster and it is very tidy and requires fewer lines of code. I have been building software that works dynamically with 250 pairs so I was basing my view on that.
      for example this one line of code hammers through hundreds of pairs in a fraction of a second.
      np.where(mean.mean() > tempdf5.loc[0,[s for s in symlist]].values, 1, 0)
      this is an example of what I would do.

  • @calvinglover752
    @calvinglover752 2 роки тому +1

    My code executes without error but won't stop running. I have to kill it with taskmaster(windows). Any ideas?

    • @Algovibes
      @Algovibes  2 роки тому

      Which IDE/environment are you using?