Introduction to BACKTRADER [Backtesting Trading Strategies Library for Python]

Поделиться
HTML-код
  • Опубликовано: 4 янв 2025

Комментарии • 147

  • @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:
    ruclips.net/video/9RfFKV0c_u8/видео.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 :-)

  • @ふらちゃん-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.

  • @BOSprodz
    @BOSprodz 2 года назад +2

    Can't wait to watch! Best channel ever

  • @JohnnyQuestFishing
    @JohnnyQuestFishing 9 месяцев назад +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  8 месяцев назад

      Very welcome mate, thanks for dropping a comment!

  • @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 🇦🇷

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

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

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

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

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

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

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

  • @blakeramsey3373
    @blakeramsey3373 7 месяцев назад +1

    Very well made and explained

    • @Algovibes
      @Algovibes  7 месяцев назад +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.

  • @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! 🍀

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

  • @damianwysokinski3285
    @damianwysokinski3285 2 года назад +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?

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

  • @SmithVestors
    @SmithVestors 2 года назад +1

    Great video! Thanks for sharing

    • @Algovibes
      @Algovibes  2 года назад

      Thanks for watching man :-)

  • @vinnyvidivici5930
    @vinnyvidivici5930 2 года назад

    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

  • @ahmetbinatlioglu8848
    @ahmetbinatlioglu8848 2 года назад +1

    Love your work bro

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

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

  • @PavelSumik
    @PavelSumik 2 года назад +1

    perfect video as always, thank you much

    • @Algovibes
      @Algovibes  2 года назад

      Thanks a lot Pavel. Appreciate your support.

  • @Bobbycarrot83
    @Bobbycarrot83 9 месяцев назад +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  9 месяцев назад

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

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

  • @noiseforthealgorithm4668
    @noiseforthealgorithm4668 8 месяцев назад +1

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

    • @Algovibes
      @Algovibes  8 месяцев назад +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 8 месяцев назад

      @@Algovibes ok thanks!

  • @AlexanderLetetski
    @AlexanderLetetski Год назад

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

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

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

  • @ManojAP
    @ManojAP Год назад +1

    thank you.

    • @Algovibes
      @Algovibes  Год назад

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

  • @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 ruclips.net/video/9rpMzng_aw0/видео.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

  • @linas1211
    @linas1211 Год назад +1

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

  • @mohammednasser6948
    @mohammednasser6948 2 года назад +1

    Great content what about live trading with backtrader?

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

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

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

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

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

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

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

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

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

  • @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:
      ruclips.net/video/0QKXso4PIc4/видео.html

    • @castleko3764
      @castleko3764 2 года назад

      @@Algovibes thanks man!!! Love ya vids

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

  • @thomas2004ch
    @thomas2004ch Год назад

    What Python version is supported?

  • @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 👍💕

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

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

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

  • @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:
      ruclips.net/user/Algovibesjoin

  • @hackingtamila8594
    @hackingtamila8594 2 года назад +1

    How can i get the codes

    • @Algovibes
      @Algovibes  2 года назад

      ruclips.net/user/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!

  • @aarondelarosa3146
    @aarondelarosa3146 9 месяцев назад

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

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

  • @viniciuscaetano7267
    @viniciuscaetano7267 2 года назад +1

    top!!!

    • @Algovibes
      @Algovibes  2 года назад

      Thx for your comment :-)

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

  • @rafalsza
    @rafalsza 2 года назад +1

    vectorbt is better then backtrader

    • @Algovibes
      @Algovibes  2 года назад

      Thanks for the suggestion! Will have a look.

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