Yes, like combine multiple indicators for signal confirmation, determine trend - again as confirmation, using divergence, using non standard stop losses and take profits (like using ATR to calculate stop loss or exit from order after X bars passed and other non-standart approaches, which is really hard to code and there is no good tutorials for that advanced stuff)
The other video tutorials that I came across on YT didn’t go deep enough and left me wanting more. This is exactly what I was looking for. Thanks so much!
You are a god send to so many people for making this, no doubt a like and subscribe earned. I have watched this 6 times now and it really does bring everything together. Your efforts are definitely helping people a ton!
Hi Chad. Lots of thanks for this incredible tutorial. Just in time for me as I'm just starting using vectorbt. Examples are seldom for the non-pro version so this is a real gold mine. Keep up the good work!
Great course, just wanted to mention the docker image[full] for VectorBT works great and tends to work much faster than working in virtual enviroment. It's also a lot easier to load up since all the packages are already installed. Just an alternative for those having difficulty installing or running with complex strategy. It works about 50 times faster on my computer but that might depend a lot on how it's installed. I found that anaconda can be used as a work around if you really want to install it, but are having problems or want to keep working with python 3.10 on the reg while have your anaconda based sub-system on the side.
I have coded along everything until 1:04:30 but after resampling, when I run the res = ind.run() I get this error: AssertionError: (1, 1) and (9618, 1) do not match Before resampling it worked, but after deleting the resample line it still does not work I would really appreciate any help thank you
Great course. Took my time to go thru it over the weekend with my notebook up and running. Issue started when I wanted to implement my own strategy using the Turtle strategy in the IndicatorFactory...
At 1:21:30 it looks like there's an error. The RSI 21 + MA 100 values are different for ETH between runs. Then again when you run the product of the series. What's going on? Shouldn't they be the same?
If you are reading this in may 2023, there is currently a new version of pandas (2.0.1) that is incompatible with vectorBT. You will get errors as soon as you pass a df to vbt (look at me learning the lingo!) the series are fine (meaning you'll get this error as soon as you add the extra symbol). ' If you are using a virtual enviroment, try to roll back pandas and install pandas 1.5.3 and it should work. Good luck!
Thank you Chad over the fantastic tutorial session for VectorBT. I've learned a lot from the session. In case someone is looking for a better way to dump the pf.orders together with the header without referring to the API documentation, here's the magical one liner: print(pf.orders.records_readable) will do
Chad, if you could respond, you would be immensely helpful. Remember around the 42 minute mark where you're returning a "trend" object that's based on entry and exit parameters: did you formulate this structure on your own or was this structure recommended from the VectorBT docs? I'm asking this because my strategy is complicated, and I don't want to necessarily quantify my entries and exits PURELY on indicator signals; essentially, I want it to use the indicators in combination with some candlestick information. Should I be focusing on the "entries" and "exits" objects outside of the custom_indicator class for this? Thanks!
Yeah the trend structure is just something I use to make life easier for myself. The actual important series are the entries and exits which are passed into Portfolio.from_signals
If you run a strategy on multiple symbols, how do you get the metrics in a way that doesn't just return a series with the averages? I'd like to get the metrics for each symbol as a dataframe and store them so I can do more tests afterward but I can't figure out how to do it.
Interested if anyone has used this realistically-backtested and found something useful and deployed and traded it profitably. How did you do live trading? I already run my own systems and strategies that have worked well over the past year and a half (up 300%). It looks like it's almost really useful, issues I see are the level of overfitting if not careful, can it operate on a universe of assets, long and short, and how to deal with live?
Great video! I was wondering if it is also possible to backtest for a universe of assets together instead of just the return on each of them individually.
Thanks so much for putting this together! It's extremely helpful. I notice that everyone seems to test based on standard indicators or moving averages. I'm trying to determine whether or not I can build an indicator inside VectorBT that lets me test based on specific price action? In other words, when price of a certain instrument reaches X, within time window Y. Except the value of X would be variable based on certain factors. Maybe it's impossible?
hi Chad, thanks for the amazing tutorial. I entered into this domain, recently (1 month back) and thank you for explaining the code that you have been writing and sharing with the audience... I have a question Around the 54 minute mark, you integrated MA with RSI...while you did it for the buy side, I did not see you modify the code like this for the sell side: trend = np.where((rsi > 70) & (close > ma), -1, 0) can I request you to comment on this. Many thanks in advance
I am getting "AttributeError: 'numpy.ndarray' object has no attribute 'resample'. Did you mean: 'reshape'?" around 1:04:05?.. Is there any easy solution?
It seems like you've got a numpy array where you should have a pandas series. I believe there's an option somewhere to pass inputs as a series rather than an array, you'll want to use that
Seems like a really good library accept for my strategies I use trend lines High points and low points and I need the open high low and close of the candle as well as volume, so I can see this getting quite complicated when I'm trying to shoe horn my strategies into this back tester.
It is quite complicated to learn at first but it can do thousands of backtests in seconds if you set it up properly. I find the pro version really useful.
Hi Chad, Thanks for your tutorial! That was really helpful but I have one question I hope you can help me with that. I am trying to do hyperparameter optimization with stop loss and take profit, is there a way to perform this hyperparameter optimization in an efficient way? Thank you for your time!
Hello, thanks for the very interesting video, if i understand well, it si not possible in vectorbt to pass 2 orders in the same candle? for example - candle N : there is a bullish engulfing. - so i buy at the candle N+1 @ the open price and I set a takeprofit limit. - candle N+2 : if my limit has not been hit then i sell @ open i manage to create the buy signal and the exit signal but i have the feeling the limit will always be considered as a conflict with the exit order @ candle[N+2]
This isn't possible with vectorisation. With "serial" mode or looping, it's of course possible. I don't use VectorBT but it does use Numba, so it can be fast.
Hi this is really good. I'm just going through it now. The pf.plot().show() command at 27m10s didn't show a plot for me when I ran the program from Spyder, but when I copied the code into a Jupyter notebook cell it showed the plots inline (not opening a web server tab). Do you have any ideas for how I can fix the issue?
Update: I managed to fix it by adding a code snippet from the bottom of the page plotly.com/python/figure-structure/ RUclips doesn't seem to allow me posting code.
how can I fix the error: ERROR: Could not build wheels for TA-lib, which is required to install pyproject.toml-based projects Thank you for your video!
Rather than treating each symbol/asset as its own portfolio, are you able to combine? For example, pull 10 cryptos but only allocate 50/50 to the first two that met your indicator criteria?
Hi all! I got this problem when using (vbt.RSI.run(close_5m, window = rsi_window).rsi) (minute: 1:00:28): ValueError: cannot join with no overlapping index names I checked the indexes of "close" and "close_5m" and there are values that match so I don't know what the problem can be. Any idea? These videos are gold, I appreciate your work!
I managed to fix it creating the rsi dataframe again as follows: (not very efficient) #fixing rsi dataframe valuesrsi = [] for x in rsi.values: valuesrsi.append(list(x)[0]) rsi = pd.DataFrame(index=rsi.index,data={'Close': valuesrsi})
Yeah run into the same problem as well. Indexes look fine for me as well and running the same code using vbt indicator using indicator factory worked as intended so my guess is vbt is doing something to the indexes? Would be nice if this were addressed as having a loop in there kind of defeats the purpose of vbt.
I ran into the exact same issue and I think I was able to fix it. It looks like you get a multi indexed columns data frame. To check if you are having this issue print the rsi.columns and the close.columns I noticed they had different values and that the rsi actually had a layer of the window value placed above it. If you are having this issue get the rsi and ma like normal and do this rsi.columns = rsi.columns.droplevel() This should drop off that added window value index and leave you with the column names as they came in the close dataframe. That also explains why recreating the dataframe worked for you.
I'm wondering how can I plot my price/data as OHLC instead of scatter (so as in 2:47:20, there would be 2 MA's on my OHLC chart, not scatter chart). I have feeling pf.plot() and df.vbt.ohlc.plot() don't work together to well, seems that range-slider always shows up and destroys templates. When I create df.vbt.ohlc.plot() without reference to previous fig from pf.plot(), there is no weird range slider and works normally on it's own...
@@ChadThackray Thank you, that's a good approach. On the note, I discovered that when using df.vbt.ohlc.plot(), we can pass argument "xaxis=dict(rangeslider_visible=False)" as **layout_kwargs, and the devilish slider is gone.
Thank you for that excellent introduction Chad. Nicely paced and with great content. However I experience some problems while experimenting with arrays of params for sl_stop and tp_stop ... ? Broadcasting doesn't seem to work as it does with other params ( tried passing a np.arange array ) Any idea how to solve that?
@@ChadThackray from my understanding. when we code fast ma cross above slow we will have will got exactly singnal when they did crossover eg crossover at day 300 if we use regular simulation we have to shift sinal series due to lookahead bias due to assumption we got signal at end of day 300 we can start buy at day 301. but i seem to not in the case of vectorbt(you send exactly signal to backtest). my guess is they will handle this buy their assumption like when have a signal buy at bar 300 a. they may calculate first return by used close of day 300 to close of day 301 or open to close of day 301 for the first return. so we do't really have to lagged signal is that right?
Got: ValueError: cannot join with no overlapping index names, but great so far. With so far, I dont mean you, I mean myself. I am doing better than before, when it comes to technical indicators and optimization, Python and backtesting. Thanks.
By troubleshooting, as I was using not BTC but my own ticker such AMZN, the error comes as I was only using only one ticker, so by adding AAPL as ["AMZN", "AAPL"] that solved the error.
Thank you for this amazing intro video. I tried running the code and at 44:42, when I run res = ind.run(); I get a value error saying “ number of returned outputs other than expected “ .. tried looking into this error but didn’t find a solution, any advice pls
I got a gaming computer which I use for programming. I know in cases such as Machine Learning, some Python libraries are meant to use GPU too. Do you know if by default gaming computers use GPU's for tasks as those here? I believe when using the Windows tasks it show CPU and GPU wit some kind of use or help from GPU to CPU. Thanks.
Thanks for your work, it is really helpful. Is there any way to integrate VectorBT with crypto exchange API? (Binance, for example). I mean it is double work to make lot management, Take Profits, Stop Loss management, etc., which VectorBT can do. Also, I have some logic so integrated with VectorBT, so it must be rewrite if we will use pure binance API, without any connector/bridge/integration between VectorBT and Binance.
Hi Chad, thanks for the great work. I'm closely working through your tutorial however at 1.08.17 I'm getting errors after writing the align code: rsi, _ = rsi.align(close, broadcast_axis=0) The error I'm getting is "F:\Vectorbt\Scripts\python.exe F:/Vectorbt/test1.py Traceback (most recent call last): File "F:\Vectorbt\test1.py", line 40, in res = ind.run( File "F:\Vectorbt\lib\site-packages\vectorbt\indicators\factory.py", line 13, in run
File "F:\Vectorbt\lib\site-packages\vectorbt\indicators\factory.py", line 2860, in _run results = run_pipeline( File "F:\Vectorbt\lib\site-packages\vectorbt\indicators\factory.py", line 1881, in run_pipeline output = _call_custom_func( File "F:\Vectorbt\lib\site-packages\vectorbt\indicators\factory.py", line 1821, in _call_custom_func return custom_func( File "F:\Vectorbt\lib\site-packages\vectorbt\indicators\factory.py", line 3364, in custom_func return apply_and_concat_func( File "F:\Vectorbt\lib\site-packages\vectorbt\base\combine_fns.py", line 62, in apply_and_concat_one outputs.append(reshape_fns.to_2d(apply_func(i, *args, **kwargs))) File "F:\Vectorbt\lib\site-packages\vectorbt\indicators\factory.py", line 2, in select_params_func # This code is licensed under Apache 2.0 with Commons Clause license (see LICENSE.md for details) File "F:\Vectorbt\test1.py", line 16, in custom_indicator rsi, _ = rsi.align(close, File "F:\Vectorbt\lib\site-packages\pandas\core\frame.py", line 4709, in align return super().align( File "F:\Vectorbt\lib\site-packages\pandas\core\generic.py", line 8862, in align return self._align_frame( File "F:\Vectorbt\lib\site-packages\pandas\core\generic.py", line 8918, in _align_frame join_columns, clidx, cridx = self.columns.join( File "F:\Vectorbt\lib\site-packages\pandas\core\indexes\base.py", line 216, in join join_index, lidx, ridx = meth(self, other, how=how, level=level, sort=sort) File "F:\Vectorbt\lib\site-packages\pandas\core\indexes\base.py", line 4368, in join return self._join_multi(other, how=how) File "F:\Vectorbt\lib\site-packages\pandas\core\indexes\base.py", line 4479, in _join_multi raise ValueError("cannot join with no overlapping index names") ValueError: cannot join with no overlapping index names Process finished with exit code 1" Thanks in advance for your assistance 😀 Pete
Search for "cannot join" in a response by Ignacio Cáceres Ballesteros, 4 months ago. Devin Lee responded with a solution that should solve your problem?
Great tutorial, I am learning so much from your RUclips content. Just 1 question, when I compare the RSI value from vectorBT, the value is quite different to the values calculated using ta_lib, pandas.ta and in fact the chart with all 3 being the same. I have used the code in you video, so is this something you have seen also?
There's a pretty considerable difference. The paid version is the only one getting new features at the moment. I think it's the best backtesting tool out there right now. At least for python and open source.
Vectorbt looks great, but: is it just a bait-and-switch for Vectorbt PRO ? It sounds like all the "you really want it" features are PRO only, all of the maintenance/bugfix work is in PRO, and all the available docs are for PRO. Is Vectorbt non-PRO really a stable and usable platform?
I guess Oleg only has a limited amount of time and right now he's spending most of that on the pro version. Hopefully one day he'll be able to hire some people to maintain/build on the community version. The free version is fairly robust, but there's a real lack of documentation, which I guess this video tries to address. The pro version is very cheap right now, so there's that.
Thank you very much for detailed training ❤. Unfortunately, i keep my eyes open really hard, because of the way you speak :( I am about to sleep man :) Also it may be good to update the video to the latest version of VectorBT Pro ;)
I tried installing vectorbt without luck. I created a venv with python 3.7 to 3.9 and didn’t work in any. Not sure how to fix the issue. I have watched a few of your videos and I enjoyed them. Good content.
This is the best intro to vbt I found, thank you! Please make an advanced part of this course!!
Yes, like combine multiple indicators for signal confirmation, determine trend - again as confirmation, using divergence, using non standard stop losses and take profits (like using ATR to calculate stop loss or exit from order after X bars passed and other non-standart approaches, which is really hard to code and there is no good tutorials for that advanced stuff)
Yessss bring some evolutionary algorithms ❤
Yes please make an advanced part! Loved this one!
The other video tutorials that I came across on YT didn’t go deep enough and left me wanting more. This is exactly what I was looking for. Thanks so much!
Hey Bro..Amazing work. Very few RUclips videos on Algo trading and backtesting using Vector Bt. Please keep up the good work.
4 hours of pure gold! Keep it up
You are a god send to so many people for making this, no doubt a like and subscribe earned.
I have watched this 6 times now and it really does bring everything together. Your efforts are definitely helping people a ton!
Thanks for your tutorial, I am from a non-native English speaking country. The speed of your speech is so friendly to me! Thanks again!
one of the best tutorials in technical analysis. keep it up, thank you chad!
Loved this one! Please continue making VBT videos
Great work. This video will be a hit for so many.
Hi Chad. Lots of thanks for this incredible tutorial. Just in time for me as I'm just starting using vectorbt. Examples are seldom for the non-pro version so this is a real gold mine. Keep up the good work!
I've repeated the tutorial after 1 year of practice, and love it even more than after the first time :)
Amazing tutorial on vectorbt. This helps me a lot of using this lib. Thank you very much! P/s: never comment on any RUclips videos before.
Appreciate your efforts Chad! Very well covered.
Such a great video thanks for taking the time to put this together. I cant even say how much this has helped
Fantastic content, thanks! watching the video multiple times
Great course, just wanted to mention the docker image[full] for VectorBT works great and tends to work much faster than working in virtual enviroment. It's also a lot easier to load up since all the packages are already installed. Just an alternative for those having difficulty installing or running with complex strategy.
It works about 50 times faster on my computer but that might depend a lot on how it's installed. I found that anaconda can be used as a work around if you really want to install it, but are having problems or want to keep working with python 3.10 on the reg while have your anaconda based sub-system on the side.
I have coded along everything until 1:04:30 but after resampling, when I run the res = ind.run() I get this error:
AssertionError: (1, 1) and (9618, 1) do not match
Before resampling it worked, but after deleting the resample line it still does not work
I would really appreciate any help thank you
great job 4h of excellence ! we can see and we can hear your competence in coding, ty very much for this video.
This is very comprehensive explanation of vectorbt. Thank you very much. Excellent work
Hi Chad! Was just gonna ask you plans for DS course but you've come up with some nice stuff here!
Great course. Took my time to go thru it over the weekend with my notebook up and running.
Issue started when I wanted to implement my own strategy using the Turtle strategy in the IndicatorFactory...
At 1:21:30 it looks like there's an error. The RSI 21 + MA 100 values are different for ETH between runs. Then again when you run the product of the series. What's going on? Shouldn't they be the same?
Thank you, for the best possible tutorial on VectorBT.
Hi Chad, isn't the custom indicator you've ceated a signal ? I'm asking because there is a signal factory in vectorbt
If you are reading this in may 2023, there is currently a new version of pandas (2.0.1) that is incompatible with vectorBT. You will get errors as soon as you pass a df to vbt (look at me learning the lingo!) the series are fine (meaning you'll get this error as soon as you add the extra symbol). '
If you are using a virtual enviroment, try to roll back pandas and install pandas 1.5.3 and it should work. Good luck!
Super helpful video. Thank you very much!
Great video! Very simple and on point! Keep up the good work
Thank you Chad over the fantastic tutorial session for VectorBT. I've learned a lot from the session. In case someone is looking for a better way to dump the pf.orders together with the header without referring to the API documentation, here's the magical one liner: print(pf.orders.records_readable) will do
helps a lot, best tutorial ever ,thank you.
Thanks Chad. How to backtest with buy the next day open price?
Chad, if you could respond, you would be immensely helpful. Remember around the 42 minute mark where you're returning a "trend" object that's based on entry and exit parameters: did you formulate this structure on your own or was this structure recommended from the VectorBT docs? I'm asking this because my strategy is complicated, and I don't want to necessarily quantify my entries and exits PURELY on indicator signals; essentially, I want it to use the indicators in combination with some candlestick information. Should I be focusing on the "entries" and "exits" objects outside of the custom_indicator class for this? Thanks!
Yeah the trend structure is just something I use to make life easier for myself. The actual important series are the entries and exits which are passed into Portfolio.from_signals
Absolutely awesome. Thanks a lot for sharing !
awesome tutorial bro, thanks a lot !!!
Thanks a lot for making this detailed and beginner friendly. Wouldn't have been able to get started with this without your help 🙂
If you run a strategy on multiple symbols, how do you get the metrics in a way that doesn't just return a series with the averages? I'd like to get the metrics for each symbol as a dataframe and store them so I can do more tests afterward but I can't figure out how to do it.
how to develop and strategy based on hour, entry at datetime.hour= 8:00, exit at 12:00?
Interested if anyone has used this realistically-backtested and found something useful and deployed and traded it profitably. How did you do live trading?
I already run my own systems and strategies that have worked well over the past year and a half (up 300%). It looks like it's almost really useful, issues I see are the level of overfitting if not careful, can it operate on a universe of assets, long and short, and how to deal with live?
awsome tutorial, thanks a lot for this hardwork
Please make an advanced part about. "portfolio" of this course!!
how to add trade duration in the portfolio. I can add logic in the numpy but hoping if there is any attribute for that
a question about data in Vector bt:
how do you input your own data in Vbt ? a CSV file or you're own DF
Great great job!! Amazing class
You are the best. What a great content.
Great video! I was wondering if it is also possible to backtest for a universe of assets together instead of just the return on each of them individually.
Excellent Tutorial !!!!!!!!!
Very nice. Thanks for sharing it.
Thanks so much for putting this together! It's extremely helpful.
I notice that everyone seems to test based on standard indicators or moving averages.
I'm trying to determine whether or not I can build an indicator inside VectorBT that lets me test based on specific price action? In other words, when price of a certain instrument reaches X, within time window Y. Except the value of X would be variable based on certain factors.
Maybe it's impossible?
Would recommend looking into the indicator factory. You can build any arbitrary indicator using it
@@ChadThackray Thanks for the reply. Based on the documentation, I assume it's possible, but I wanted to make sure.
Great content. Really thorough.
Amazing Chad. Thank you very much.
hi Chad, thanks for the amazing tutorial. I entered into this domain, recently (1 month back) and thank you for explaining the code that you have been writing and sharing with the audience...
I have a question
Around the 54 minute mark, you integrated MA with RSI...while you did it for the buy side, I did not see you modify the code like this for the sell side:
trend = np.where((rsi > 70) & (close > ma), -1, 0)
can I request you to comment on this.
Many thanks in advance
Best video, thanks !
I am getting "AttributeError: 'numpy.ndarray' object has no attribute 'resample'. Did you mean: 'reshape'?" around 1:04:05?.. Is there any easy solution?
It seems like you've got a numpy array where you should have a pandas series. I believe there's an option somewhere to pass inputs as a series rather than an array, you'll want to use that
You find solution already? I have same problem.
@@ChadThackray we all have the same problem. it is your code producing the error, we just typed it from the screen. please advice, thank you!!
how do I find the methods of this API? Is there a method for WMA?
Seems like a really good library accept for my strategies I use trend lines High points and low points and I need the open high low and close of the candle as well as volume, so I can see this getting quite complicated when I'm trying to shoe horn my strategies into this back tester.
It is quite complicated to learn at first but it can do thousands of backtests in seconds if you set it up properly. I find the pro version really useful.
If my strategy use 15 m candles mainly Can I use an indicator that use 5m candles?
2:08:35 Memory optimization
Good video. Where is the advance videos? Apology but i couldn't find it
Thank you. Great video!!
Hi Chad,
Thanks for your tutorial! That was really helpful but I have one question I hope you can help me with that. I am trying to do hyperparameter optimization with stop loss and take profit, is there a way to perform this hyperparameter optimization in an efficient way?
Thank you for your time!
Hello, thanks for the very interesting video, if i understand well, it si not possible in vectorbt to pass 2 orders in the same candle?
for example
- candle N : there is a bullish engulfing.
- so i buy at the candle N+1 @ the open price and I set a takeprofit limit.
- candle N+2 : if my limit has not been hit then i sell @ open
i manage to create the buy signal and the exit signal but i have the feeling the limit will always be considered as a conflict with the exit order @ candle[N+2]
The kind of functionality you're after here is possible, at least in vectorbt PRO, but would take bit of elbow grease to implement
@@ChadThackray thanks a lot, will look into this 👌
This isn't possible with vectorisation. With "serial" mode or looping, it's of course possible. I don't use VectorBT but it does use Numba, so it can be fast.
Hi this is really good. I'm just going through it now. The pf.plot().show() command at 27m10s didn't show a plot for me when I ran the program from Spyder, but when I copied the code into a Jupyter notebook cell it showed the plots inline (not opening a web server tab).
Do you have any ideas for how I can fix the issue?
Update: I managed to fix it by adding a code snippet from the bottom of the page plotly.com/python/figure-structure/
RUclips doesn't seem to allow me posting code.
same issue here, ploty link didn't seem to work. Anyone got another fix without coming out of Spyder? cheers in advance
how can I fix the error:
ERROR: Could not build wheels for TA-lib, which is required to install pyproject.toml-based projects
Thank you for your video!
Hey! You need to install TA-lib if you want to use the indicators from it. There are some good tutorials for it here on youtube
Rather than treating each symbol/asset as its own portfolio, are you able to combine? For example, pull 10 cryptos but only allocate 50/50 to the first two that met your indicator criteria?
Yep! It's called "grouping" in the documentation
Thanks for your knowledge.
Hi all! I got this problem when using (vbt.RSI.run(close_5m, window = rsi_window).rsi) (minute: 1:00:28):
ValueError: cannot join with no overlapping index names
I checked the indexes of "close" and "close_5m" and there are values that match so I don't know what the problem can be. Any idea?
These videos are gold, I appreciate your work!
I managed to fix it creating the rsi dataframe again as follows: (not very efficient)
#fixing rsi dataframe
valuesrsi = []
for x in rsi.values:
valuesrsi.append(list(x)[0])
rsi = pd.DataFrame(index=rsi.index,data={'Close': valuesrsi})
@@ignaciocaceresballesteros9168 Thankyou! Just ran into the same trouble. So strange it worked for our absolute Chad.
Yeah run into the same problem as well. Indexes look fine for me as well and running the same code using vbt indicator using indicator factory worked as intended so my guess is vbt is doing something to the indexes? Would be nice if this were addressed as having a loop in there kind of defeats the purpose of vbt.
I ran into the exact same issue and I think I was able to fix it. It looks like you get a multi indexed columns data frame. To check if you are having this issue print the rsi.columns and the close.columns I noticed they had different values and that the rsi actually had a layer of the window value placed above it. If you are having this issue get the rsi and ma like normal and do this
rsi.columns = rsi.columns.droplevel()
This should drop off that added window value index and leave you with the column names as they came in the close dataframe. That also explains why recreating the dataframe worked for you.
I Cant install vectorbt in visual studio ni spider ni jupiterlab how to fix it?
I'm wondering how can I plot my price/data as OHLC instead of scatter (so as in 2:47:20, there would be 2 MA's on my OHLC chart, not scatter chart). I have feeling pf.plot() and df.vbt.ohlc.plot() don't work together to well, seems that range-slider always shows up and destroys templates. When I create df.vbt.ohlc.plot() without reference to previous fig from pf.plot(), there is no weird range slider and works normally on it's own...
You could extract the data from the portfolio object and just plot it as a regular plotly graph. That way you can customize it however you want
@@ChadThackray Thank you, that's a good approach. On the note, I discovered that when using df.vbt.ohlc.plot(), we can pass argument "xaxis=dict(rangeslider_visible=False)" as **layout_kwargs, and the devilish slider is gone.
Thank you for that excellent introduction Chad.
Nicely paced and with great content.
However I experience some problems while experimenting with arrays of params for sl_stop and tp_stop ... ?
Broadcasting doesn't seem to work as it does with other params ( tried passing a np.arange array )
Any idea how to solve that?
hi chad great work quick question. don't we have to lag buy/sell signal by .shift() data series like other backtest?
Depends on a lot of factors. You'll have to judge for your situation whether it causes look ahead bias or not
@@ChadThackray from my understanding. when we code fast ma cross above slow we will have will got exactly singnal when they did crossover eg crossover at day 300 if we use regular simulation we have to shift sinal series due to lookahead bias due to assumption we got signal at end of day 300 we can start buy at day 301. but i seem to not in the case of vectorbt(you send exactly signal to backtest). my guess is they will handle this buy their assumption like when have a signal buy at bar 300 a. they may calculate first return by used close of day 300 to close of day 301 or open to close of day 301 for the first return. so we do't really have to lagged signal is that right?
Got: ValueError: cannot join with no overlapping index names, but great so far. With so far, I dont mean you, I mean myself. I am doing better than before, when it comes to technical indicators and optimization, Python and backtesting. Thanks.
By troubleshooting, as I was using not BTC but my own ticker such AMZN, the error comes as I was only using only one ticker, so by adding AAPL as ["AMZN", "AAPL"] that solved the error.
In time 9.28 installing vectorbt takes how much data ?
Thank you for this amazing intro video. I tried running the code and at 44:42, when I run res = ind.run(); I get a value error saying “ number of returned outputs other than expected “ .. tried looking into this error but didn’t find a solution, any advice pls
Fixed it 😊. Again great work man 👍🏼
Hello Sir, can we place trailing stop loss using Vector Bt?
Great course!
does vbt have the function or ability to do the parameter optimazation as by Backtrader?
Yep! I'd say that's the strong point of this library
How add custom data in Vbt
I got a gaming computer which I use for programming. I know in cases such as Machine Learning, some Python libraries are meant to use GPU too. Do you know if by default gaming computers use GPU's for tasks as those here? I believe when using the Windows tasks it show CPU and GPU wit some kind of use or help from GPU to CPU. Thanks.
Generally varies from program to program. Usually you have to do some messing around with configurations to get it to work properly
Numpy is CPU only.
Thanks for your work, it is really helpful. Is there any way to integrate VectorBT with crypto exchange API? (Binance, for example).
I mean it is double work to make lot management, Take Profits, Stop Loss management, etc., which VectorBT can do.
Also, I have some logic so integrated with VectorBT, so it must be rewrite if we will use pure binance API, without any connector/bridge/integration between VectorBT and Binance.
Live trading is on the roadmap for the PRO version, but is a while away yet. You would need to write your own adaptor between the two for now
Hi all does anyone know how to set specific entry and exit dates?
Hi Chad, thanks for the great work. I'm closely working through your tutorial however at 1.08.17 I'm getting errors after writing the align code: rsi, _ = rsi.align(close,
broadcast_axis=0)
The error I'm getting is
"F:\Vectorbt\Scripts\python.exe F:/Vectorbt/test1.py
Traceback (most recent call last):
File "F:\Vectorbt\test1.py", line 40, in
res = ind.run(
File "F:\Vectorbt\lib\site-packages\vectorbt\indicators\factory.py", line 13, in run
File "F:\Vectorbt\lib\site-packages\vectorbt\indicators\factory.py", line 2860, in _run
results = run_pipeline(
File "F:\Vectorbt\lib\site-packages\vectorbt\indicators\factory.py", line 1881, in run_pipeline
output = _call_custom_func(
File "F:\Vectorbt\lib\site-packages\vectorbt\indicators\factory.py", line 1821, in _call_custom_func
return custom_func(
File "F:\Vectorbt\lib\site-packages\vectorbt\indicators\factory.py", line 3364, in custom_func
return apply_and_concat_func(
File "F:\Vectorbt\lib\site-packages\vectorbt\base\combine_fns.py", line 62, in apply_and_concat_one
outputs.append(reshape_fns.to_2d(apply_func(i, *args, **kwargs)))
File "F:\Vectorbt\lib\site-packages\vectorbt\indicators\factory.py", line 2, in select_params_func
# This code is licensed under Apache 2.0 with Commons Clause license (see LICENSE.md for details)
File "F:\Vectorbt\test1.py", line 16, in custom_indicator
rsi, _ = rsi.align(close,
File "F:\Vectorbt\lib\site-packages\pandas\core\frame.py", line 4709, in align
return super().align(
File "F:\Vectorbt\lib\site-packages\pandas\core\generic.py", line 8862, in align
return self._align_frame(
File "F:\Vectorbt\lib\site-packages\pandas\core\generic.py", line 8918, in _align_frame
join_columns, clidx, cridx = self.columns.join(
File "F:\Vectorbt\lib\site-packages\pandas\core\indexes\base.py", line 216, in join
join_index, lidx, ridx = meth(self, other, how=how, level=level, sort=sort)
File "F:\Vectorbt\lib\site-packages\pandas\core\indexes\base.py", line 4368, in join
return self._join_multi(other, how=how)
File "F:\Vectorbt\lib\site-packages\pandas\core\indexes\base.py", line 4479, in _join_multi
raise ValueError("cannot join with no overlapping index names")
ValueError: cannot join with no overlapping index names
Process finished with exit code 1"
Thanks in advance for your assistance 😀
Pete
Search for "cannot join" in a response by Ignacio Cáceres Ballesteros, 4 months ago. Devin Lee responded with a solution that should solve your problem?
thanks a lot man, was very helpful, what text editor are you using in the video?
vim!
How do you install VektorBT on terminal?
Use pip
It doesn't work. I have to install Ta-Lib first, I think. @@ChadThackray
Great tutorial, I am learning so much from your RUclips content.
Just 1 question, when I compare the RSI value from vectorBT, the value is quite different to the values calculated using ta_lib, pandas.ta and in fact the chart with all 3 being the same.
I have used the code in you video, so is this something you have seen also?
Yeah, different implementations of the RSI use different smoothing functions, so you'll want to make sure you're using the version that you want
@@ChadThackray Thanks for your quick reply, i will look further into the smoothing functions.
Hey man, thanks for the tutorial. Could you please do tutorial on Portfolio.from_order_func() since there is very little of documentation? :)
I likely will in the future. If you look on the documentation for the pro version you can often reverse engineer it for the free version
Do you think the pro version is worth getting? How different is it to the free one? Thanks
There's a pretty considerable difference. The paid version is the only one getting new features at the moment. I think it's the best backtesting tool out there right now. At least for python and open source.
Amazing 🤩
For the RSI indicator, many of the values it was giving out were wrong..
Is anyone else facing the same issue?
Might depend on which version of the RSI that you're using. There are quite a few different ones.
@@ChadThackray I checked with other libraries as well..
It's wrong.
I tested for "^NSEI", (Nifty 50 Indian Benchmark Index)
Time frame = 1D
@@aryankulshreshtha5236 You can report an issue with VectorBT on its github, along with a full code sample
@@ChadThackray Reported
Dear author! Thank you for your videos. What is your favorite backtesting library?
Overall I'd say Vectorbt!
I watched the first 2 hours, no mention of Optuna, for those who watched the whole thing, did he show how to utilize Optuna?
Vectorbt looks great, but: is it just a bait-and-switch for Vectorbt PRO ? It sounds like all the "you really want it" features are PRO only, all of the maintenance/bugfix work is in PRO, and all the available docs are for PRO. Is Vectorbt non-PRO really a stable and usable platform?
I guess Oleg only has a limited amount of time and right now he's spending most of that on the pro version.
Hopefully one day he'll be able to hire some people to maintain/build on the community version.
The free version is fairly robust, but there's a real lack of documentation, which I guess this video tries to address.
The pro version is very cheap right now, so there's that.
How to import your own csv file sir?
instead of using vbt.Yfdata use your pandas variables
data = pd.read_csv('BTC-USD_1y_1h.csv',index_col='Datetime',parse_dates=['Datetime'])
just awesome
Can it be used for options ?
Yep! basically any tradeable asset
When you switch entries for exit and exit for entries for the first RSI code you get phenomenal returns.
Thank god for the playback speed option!
Is vectorbt event driven?
As far as I know it's basically 100% vectorized for speed purposes
Left a like because I saw linux mint! OG
Wtf this is great:0
Thank you very much for detailed training ❤. Unfortunately, i keep my eyes open really hard, because of the way you speak :( I am about to sleep man :) Also it may be good to update the video to the latest version of VectorBT Pro ;)
Watching 1.25 x faster makes it better :)
I tried installing vectorbt without luck. I created a venv with python 3.7 to 3.9 and didn’t work in any. Not sure how to fix the issue. I have watched a few of your videos and I enjoyed them. Good content.
ruclips.net/video/28eLP22SMTA/видео.html