Backtesting.py - Full course in python

  Рет қаралды 195,639

Chad Thackray

Chad Thackray

Күн бұрын

Пікірлер: 249
@danchatka8613
@danchatka8613 2 жыл бұрын
This is an amazingly good tutorial and you, Chad, are an amazingly good teacher/guide. You don't make things more complicated than they are. You stay on track.
@TundraKaffe1
@TundraKaffe1 2 жыл бұрын
Perfect course! The best out there by far. What I still don't get is how to replace a sl or tp if a certain event happens. For example I would like to move my stop loss up if a take profit of another order was hit.
@MLAlgoTrader
@MLAlgoTrader 2 ай бұрын
You can access the trades with self.trades and you can adjust the stop loss and take profit by doing for example for trade in self.trades: trade.sl=NEW_VALUE
@transcendmoney
@transcendmoney Жыл бұрын
Best tutorial of backtesting.py on youtube !, thanks
@jmarsh411
@jmarsh411 4 ай бұрын
This is a fantastic tutorial, errors and all. You're a hero!!
@samueltamayogaviria3377
@samueltamayogaviria3377 2 жыл бұрын
Holy ...!! I've been waiting for a course for this library, thanks!!
@deviatewithDarrell
@deviatewithDarrell 11 ай бұрын
Great video Chad. I really appreciate you taking the time. I'm three months into learning Python and stock investing and I was able to follow along this entire video.
@ChadThackray
@ChadThackray 11 ай бұрын
Good luck Darrell!
@glenrichzuso9076
@glenrichzuso9076 Жыл бұрын
I am watching your tutorial over the others because your using VIM as your editor :) This shows the commitment of a person to learn beyond what is required Awesome work and thank you for the wonderful tutorial !
@simulateworld3198
@simulateworld3198 8 ай бұрын
I was looking for this type of tutorial you are the man❤❤
@dilip.rajkumar
@dilip.rajkumar 2 жыл бұрын
Thank you for another Great video. I really do Love your video and channel, so much information on topics where there is hardly any information elsewhere ✌️. BTW, could you post in the description a pros and cons table comparing VectorBT vs. Backtesting.py or perhaps you can make a short 5 min video comparing the differences and highlighting the use cases.
@jontycraine4903
@jontycraine4903 2 жыл бұрын
Another great Backtesting video Chad
@oliverSaquarema
@oliverSaquarema Жыл бұрын
Chad, I really appreciate your content, very well explained, you are an excellent teacher and your content is incredible! thanks again! I will study all the content on your channel!
@ishaangupta3471
@ishaangupta3471 2 жыл бұрын
Thanks a lot for this! Found exactly what I was looking for to run optimization.
@naelshichida7940
@naelshichida7940 2 жыл бұрын
Absoultely love the content, thanks for your hard work and grit.
@GEORGESDominique
@GEORGESDominique 2 жыл бұрын
Very interresting and clever explanation about backtesting. I'm looking since a few months for readable and understandable content about backtesting, and .. I just found it now :) Thanks for that. I'm more "crypto market" oriented, and more scalping strategy interrested (I don't have so much time to trade :'( ) Thanks for this video, and waiting for the next ones. PS : I modified this message and deleted my "request" about developping a BOT, it is in your blog ;)
@jungkyunyang5184
@jungkyunyang5184 2 жыл бұрын
Hi Chad, Thank you for the good video. If I had known this video first, I could have saved a lot of time. But I was able to get a lot of ideas from watching this video. Thanks once again.
@aingo6521
@aingo6521 Жыл бұрын
Thank you for sharing this. I learn a lot from you ! much respect !
@vivekghule5601
@vivekghule5601 Жыл бұрын
How to write a strategy in backteting like : input data to backtest is one-minute chart, logic : get High and Low of 2 PM (5 minute candle), and then if current close > high buy order with target 20points , if current close < low sell with tartget of 20 points. Thanks
@devby9
@devby9 2 жыл бұрын
Thank u… By the way, I like your contents a lot because of your exclusive content, as well as your deep and soothing voice, With that British accent :) so because of that, I can normally watch an hour-long video with no boring
@Machiuka
@Machiuka 8 ай бұрын
Very good tutorial. I have some problems to install TA-LIB on my Win11 computer, because of the Python version that I have (3.11). I solved this by creating an environment with Python 3.10.
@andhikaseptiawan8036
@andhikaseptiawan8036 2 жыл бұрын
Very Informative, helpful and Educational video! Thx for the tutorial man!
@nukewares
@nukewares 10 ай бұрын
great work, this is excellent. I also appreciate the northern accent. It's been a while since I've heard a proper one.
@gkr7078
@gkr7078 Жыл бұрын
This is the best tutorial on backtesting iN KZbin.. a quick question. How do I for loop through different strategy classes for running tests in backtesting.py
@virtuallore
@virtuallore Жыл бұрын
Brilliant. Very high quality work ❤
@markethd
@markethd Жыл бұрын
Thanks for sharing your wealth of knowledge in this excellent series Chad. I love your name by the way.
@flydr2
@flydr2 2 жыл бұрын
Thank you for taking the time to do this... Very helpfull to me.
@ЕвгенийКрасилов-о9о
@ЕвгенийКрасилов-о9о 2 жыл бұрын
There is df.droplevel(axis=0, level=2) to drop "rsi_window" index level. That would be more reasonable to use instead of grouping and using meaningless .mean method.
@stansuen8072
@stansuen8072 2 жыл бұрын
Awesome tutorial! Learnt a lot! Thanks a lot.
@MrWittzHD
@MrWittzHD Жыл бұрын
this was wonderful, thank you very much
@transcendmoney
@transcendmoney Жыл бұрын
Hello, by default is doing size of units, how will be possible to make sizes with decimals, for example always enter with 0.95 of equity in ethereum, should be units with decimals
@K_line_sorter
@K_line_sorter Жыл бұрын
How to set the transaction time? For example, trading is only done between 8-12 New York time.
@trilokyadav4159
@trilokyadav4159 7 ай бұрын
Hi Chad, thanks for the detailed tutorial! Is it possible to backtest mulit-asset strategies using this API i.e. say option straddle strategy, or say buying a stock and shorting an index at the same time if a signal is generated? Otherwise this would be really limited long/short strategies only and not dollar/delta neutral strategies.
@zeus_2001
@zeus_2001 2 жыл бұрын
Excellent tutorial. I like the simplicity of this library. It's too bad it can't test and aggregate results for multiple tickers.
@damienong1462
@damienong1462 2 жыл бұрын
There is a way to do it. By using for loop, where you will be able to test multiple tickers and even multiple timeframe. (if this is what you mean, it's easy to do it especially with this library, compare to freqTrade)
@zeus_2001
@zeus_2001 2 жыл бұрын
@@damienong1462 No, that's not what I meant. Looping just runs a sequential series of separate tests. What I'm talking about involves trading multiple instruments as a single strategy.
@shortmeister6776
@shortmeister6776 2 ай бұрын
22:00 when we did optimization over a much larger set of configs, we maximized the return and the sharp ratio improved as well. Why is it a bad thing. Please explain =) THanks
@karthickb1973
@karthickb1973 8 ай бұрын
i needed this today. chad sent
@brianrowe1152
@brianrowe1152 2 жыл бұрын
Maybe cover trailing stop in a future video? Or can you replace an open order to sell with a new order that you want instead? For example a trailing stop % from the average price, not the close?
@tradewithaakash2939
@tradewithaakash2939 Жыл бұрын
You are just amazing !! thankyou so much for sharing your knowledge
@JurinoJr
@JurinoJr 11 ай бұрын
That was an awesome tutorial, thanks a lot!
@studiox_ui
@studiox_ui 2 жыл бұрын
dude you're the fucking best please post more about algotrading thanks
@ramanuj_g
@ramanuj_g 9 ай бұрын
dude this was fantastic... helped a ton..thx...
@richardchu1593
@richardchu1593 Жыл бұрын
In the tutorial, there is example to resample from daily to weekly data such as: self.weekly_rsi = resample_apply("W-FRI", talib.RSI, self.data.Close, self.rsi_window). However for future contract such as MNQ, its session opening time is not exactly in the same day (using Eastern Time as base). For example MNQ's monday session starts trading from Sunday 6PM ET until Monday 5PM ET. Than for the above case, how do you define "session", "daily" and "weekly" resample? Thank you so much!
@LrdKGB
@LrdKGB Ай бұрын
Hi Chad, how confident are you to deploy a strategy after backtesting it? As in is there a strategy that is as profitable as/reflects the backtest without too many discrepancies? If not till what extent can we trust the backtest stats?
@ChadThackray
@ChadThackray 21 күн бұрын
Depends on your setup but generally a backtest alone is not enough. Paper trade it before deploying actual cash
@canea4637
@canea4637 2 жыл бұрын
If you are on Mac OS and use home brew just do brew install ta-lib
@VidyabhushanUpadhye
@VidyabhushanUpadhye 2 жыл бұрын
Hi Chad, this is a wonderful tutorial. Very well explained with the right context.I need help with the date column from a CSV file. python is not reading it as DateTime format but instead, it is reading it as an object. Not able to solve it, and because which not getting Sharpe and other ratios.
@ChadThackray
@ChadThackray 2 жыл бұрын
I would look into the pd.to_datetime function from pandas, that will help you convert the date column from a string into datetime format
@VidyabhushanUpadhye
@VidyabhushanUpadhye 2 жыл бұрын
@@ChadThackray Thanks a lot. It worked. not the ratios are being calculated.😊👍
@VidyabhushanUpadhye
@VidyabhushanUpadhye 2 жыл бұрын
Hi @@ChadThackray, I am observing that my entries and exits are delayed by two candles not sure why it is happening. Send you an email with the python code and data file. Thanks
@cosmicblack
@cosmicblack Жыл бұрын
I justo hace a question When i'm un the next method To use the actual data and the before injusto need yo use (for ex) self.rsi[-1] and [-2].?
@BOSprodz
@BOSprodz 2 жыл бұрын
EDIT SOLVED: Downgrading bokeh to 2.4.3 solved the plotting issue I am unable to see the plotting using Jupyter notebooks. I've looked through the issue tracker and the fixes didn't work(or I couldn't figure out how to downgrade Python to 3.7). Any ideas?
@ChadThackray
@ChadThackray 2 жыл бұрын
Is there any particular reason you need jupyter? If not you can just run it as a regular .py
@BOSprodz
@BOSprodz 2 жыл бұрын
@@ChadThackray Thank you for answering! I just like Jupyter, but I had the same problem with VSCode as well
@CricketKBrown
@CricketKBrown Жыл бұрын
@@BOSprodz I had the same problem in both places to.
@CricketKBrown
@CricketKBrown Жыл бұрын
Thank´s for your Idea. I used pip install bokeh==2.4.3 in MacOS for degreed bokeh from 3.0.3 to 2.4.3 and then the HTML in safari browser was ok.
@andreagiunta168
@andreagiunta168 Жыл бұрын
hi there. I would like use Bollinger Bands and consider "lenght" and "stdev" as variables to be used within the optimization function. have you got some solving answer?!??!?! pllsssssss
@lukaju1320
@lukaju1320 3 ай бұрын
Great tutorial! I have a question. Why is my stats not calculating any of the Ratios or Volatility, there is multiple trades and everything else is displayed. Ratios and Volatility are NaN values.
@lukaju1320
@lukaju1320 3 ай бұрын
Found the answer, you should change the data frame like this with pandas: spx500.set_index('Date', inplace=True)
@StrategyFactory
@StrategyFactory 2 ай бұрын
Hi Chad! I hope you are doing really well. Thanks for this amazing tutorial! Do you know if it's possible to do live trading with a strategy developed using this library?
@MLAlgoTrader
@MLAlgoTrader 2 ай бұрын
Chad's course is amazing. Sorry if not the place to answer, but I happen to be working on a video to try to easily convert to Interactive Brokers live trading so eventually check out my video in maybe a week or so lol.
@shishanliu5851
@shishanliu5851 4 ай бұрын
Thank you for the detailed explanation. I have a question, what's the difference between ''' crossover(self.daily_rsi, self.upper_bound) ''' and ''' self.daily_rsi [-1] > self.upper_bound ''' It would be helpful for the explanation :) Thanks first!
@shishanliu5851
@shishanliu5851 4 ай бұрын
btw, I want to ask: ''' self.buy(sl = 0.95 * price) ''' Does that mean if the order is less than 95% of the price, the order will be sold? Or if the order is bought when the price is 95% of the current price?
@syng9596
@syng9596 2 жыл бұрын
thx for the very detailed tutorial! appreciate it!
@astrojes849
@astrojes849 Жыл бұрын
You really are a Chad. Fr
@SOMEONE-eq5bu
@SOMEONE-eq5bu 2 жыл бұрын
that was an excellent tutorial, thanks for sharing, liked and subbed.
@transcendmoney
@transcendmoney Жыл бұрын
so seems backtesting.py can't trade with fractional sizes (fractional ethereum for example 0.99 have to be 1 or 2 ethereum)
@mohamedhicham6298
@mohamedhicham6298 7 ай бұрын
Hey Chad great work, i have a question. If i have a dictionary of dataframes for 50 stocks. All of the dataframes have the same start and end date. So how can i run a backtest over all of them instead of running the backtest only one a single dataframe?
@220SouthlandAve
@220SouthlandAve 8 ай бұрын
Hey, great content! I'm wondering how your init function is working properly without a double underscore..isn't init usually a dunder method? Thanks.
@ChadThackray
@ChadThackray 8 ай бұрын
It's not a real __init__ function. We're just overriding a function from the parent class
@trollrequiem0444
@trollrequiem0444 Жыл бұрын
Thank you! Nice video! Is there any way to save the equity line data, so that you can, for example, draw it with matplotlib?
@ChadThackray
@ChadThackray Жыл бұрын
Yep! You can get it from the stats. So you have something like: output = bt.run() curve = output._equity_curve If you look it's just under all the other stats like sharpe, etc. You get a nice pandas df you can plot to your heart's content
@Luca-wg4cv
@Luca-wg4cv Жыл бұрын
hi i have a huge problem, if i fix the quantity 1 i don’t work the code regarding the peack and the final how can i fix it?
@Cavz001
@Cavz001 Жыл бұрын
Great video sir. Quick question. Delving deeper into algorithmic trading, I’ve found that mere backtesting isn’t sufficient and processes like out-of-sample backtesting, Sample parameter optimization, walk-forward optimization and Monte Carlo Simulation are viltal to creating a solid system. Question is: how do you conduct these tests with Python?
@ChadThackray
@ChadThackray Жыл бұрын
You are correct. There are many videos here on youtube that will teach you how to do these other tests. Some of those topics I've covered myself on this channel
@Cavz001
@Cavz001 Жыл бұрын
@@ChadThackray cool. I’ll check them out. Thank you
@ghazanferali366
@ghazanferali366 2 жыл бұрын
Great video, very informative. I am just having one problem while applying the multitimeframe strategy. If resample_apply is done on an indicator which takes more than one inputs, it is giving all sorts of errors.
@ghazanferali366
@ghazanferali366 2 жыл бұрын
self.tf2MDI = resample_apply( '3T',ta.MINUS_DI(high,low,price,self.n) As an example is not working
@ArneGockeln
@ArneGockeln 7 ай бұрын
Good tutorial and introduction of this backtest library! Thanks. One last question: Would you bet your real money on strategies that you have tested with this library?
@behradio
@behradio Жыл бұрын
Awesome Tutorial, Thanks a lot.
@naveenkumar-mh6zf
@naveenkumar-mh6zf 2 жыл бұрын
Enjoyable and informative video.
@shalomadormeo_hustle
@shalomadormeo_hustle Жыл бұрын
how do I pull data of crytocurrencies?
@hourglass9
@hourglass9 Жыл бұрын
Great Video! Can you simultaneously do a backtesting on all symbols like for example EURUSD and SPUSD so if I buy on SP500 on 2011-01-07 and sell on 2011-01- 10 then in the next buy this program will recheck the opportunity in EURUSD and SPUSD and automatically matches the buying signal and then buy that stock after 2011-01-10 in this way we can have a full return on investment 😀
@timonfranz4996
@timonfranz4996 10 ай бұрын
Hi Chad, is there any possibility to extend the _trades dataframe with for example the stop loss and take profit? Or any other trade attribute like a specific trade enty criteria? This would be very helpful to analyse which trades working and which are not working.
@ChadThackray
@ChadThackray 10 ай бұрын
It's open source so anything is possible. I would just build my own logger though in the main logic and use that to analyse
@chimgaebu8419
@chimgaebu8419 Жыл бұрын
thank you very much. this is very gorgeous video !!!! . It is very helpful.
@protopan7722
@protopan7722 10 ай бұрын
Hey what do you think of quant connect?
@priyankamore1458
@priyankamore1458 Жыл бұрын
is there any other forex backtesting library, because I am having an issue regarding order size, leverage, lot size which are bit different than stock or crypto market...It would be very helpful. Thank you
@surprise7917
@surprise7917 Жыл бұрын
Amazing video!
@kvekka9300
@kvekka9300 Жыл бұрын
@chad...how can it be run to test bracket orders
@pinalpatel5474
@pinalpatel5474 8 ай бұрын
Can't download talib in python 3.12 version
@raphaelarguello5020
@raphaelarguello5020 7 ай бұрын
Great content, thanks for your work! I am struggling with the size of the position for the backtesting. I am trying to risk 1% of the available cash per position so I enter the sl and size = 0.01. However, the risk is completely off and it only risk 0.014% I am also confused because in the video you just enter size without stop loss, but risk is normally calculated in function of the sl Would you maybe have a solution please? Thanks for your help!
@nicolasepalaciosm8072
@nicolasepalaciosm8072 2 жыл бұрын
Thanks for the video, awesome explanations! New subscription ;) I'm left thinking if it's possible to use some of the functions of the library in a different code which is mean to do trades and not only backtesting? Specifically, the bars since function. I ask because as I understand it as of now (after watching the video), you only seem to be able to use it inside a class which is extending the Strategy class imported also from this specific library, your RsiOscillator in this case.
@supertamtamtom
@supertamtamtom Жыл бұрын
Can we put constraints on more than 1 parameter, and maximize/minimize several (more than 1) parameters?
@GascanNBK
@GascanNBK Жыл бұрын
nice video, what about extending the Stats with CAGR/MaxDD?
@stujadz
@stujadz 3 ай бұрын
Hi, great video, thank you so much. I am getting the error "" My research says its to do with the version of Bokeh not able to display in Jupyter Notebooks. Can you help at all?
@HarpreetSingh-ps9rx
@HarpreetSingh-ps9rx 2 жыл бұрын
Brilliant video
@vinnyvidivici5930
@vinnyvidivici5930 Жыл бұрын
noob question here, what is that screen at 5:10 when you type "from backtesting import Backtest, Strategy" ? i successfully downloaded python, and my 'pip install backtest' in the CMD window worked, but where do i go to get what you have at 5:10? what screen is that? thx!
@ChadThackray
@ChadThackray Жыл бұрын
I'm using vim here as my text editor on the command line. You might want to use something like visual studio code or pycharm or similar program, which will do the same thing
@fauxz3782
@fauxz3782 Жыл бұрын
Excellent video
@jroche1832
@jroche1832 2 жыл бұрын
great video however I have a complex indicator which I am struggling to backtest. Do you have any strategies that you have built which are complex for example VIX/VVIX correlation?
@nevanncopeland8093
@nevanncopeland8093 Жыл бұрын
how is gone since then?
@V3ritas1989
@V3ritas1989 Жыл бұрын
hey, nice intro. Waht about position sizing with futures or CFDs ? With margins, over night margins, what about slippage, broker costs as well as spreads?
@samueltamayogaviria3377
@samueltamayogaviria3377 2 жыл бұрын
could you make more in depth explanations for each action you can make with this library?
@pauljones9150
@pauljones9150 5 ай бұрын
You multi-timeline test code is somehow broken. Not sure how or how to fix. It has something to do with this line: self.daily_rsi = self.I(ta.rsiI, pd.Series(self.data.Close), self.rsi_window). It doesn't think that ta.rsil is a thing
@mrrrokas
@mrrrokas Жыл бұрын
You an absolute chad
@Thegiant4296
@Thegiant4296 Жыл бұрын
I am new to python and was just curious what you're using to write your code in? I couldn't make it out when you said it in the beginning but would like to use the same platform
@ChadThackray
@ChadThackray Жыл бұрын
I'm using Vim, a command line based text editor
@Thegiant4296
@Thegiant4296 Жыл бұрын
@@ChadThackray Thank you!
@purasuerte1.0
@purasuerte1.0 9 ай бұрын
how do you use a backtesting strategy to do live trading? is there an easy way to re-use this code and instead of do backtesting do live trading?
@ChadThackray
@ChadThackray 9 ай бұрын
An easy way is to use a framework that does both. Backtesting.py only does backtesting.
@purasuerte1.0
@purasuerte1.0 9 ай бұрын
@@ChadThackray thanks for the reply, so I think I should use backtrader then. Any recommendation if I'm looking to trade forex?
@purasuerte1.0
@purasuerte1.0 9 ай бұрын
I was thinking in collecting the last n candles live with the broker api and run the backtesting strategy, every time that a new candle is added, the backstesting strategy is run again and place an order (or close one) according to the last row of generated dataframe. Ugly? yes, not the best performance? yes. But since I will be using 1 minutes candles, it doesn't have to be fast. @@ChadThackray
@10milesfromnowhere
@10milesfromnowhere 2 жыл бұрын
Thanks! Great tutorial.
@garychan2833
@garychan2833 Жыл бұрын
I'm getting this error: NameError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_3820\2972227237.py in . It's pointing at the line for stats = bt.run()
@ierogosse
@ierogosse 6 ай бұрын
Big thanks to you!
@specialnwachukwu7031
@specialnwachukwu7031 3 ай бұрын
Thank you for this amazing tutorial. i am having an issue with a strategy i am trying to implement. Error setattr(strategy, attr, indicator[..., :i + 1]) ~~~~~~~~~^^^^^^^^^^^^^ IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed. The error above keeps coming up
@purasuerte1.0
@purasuerte1.0 9 ай бұрын
please could anyone provide an example of a simple macd strategy. I've got: class RsiOscillator(Strategy): def init(self): self.macd = self.I(ta.macd, pd.Series(self.data.Close)) But I don't know how to refer to the signal & the macd column in def next(self):
@borismiz
@borismiz 2 жыл бұрын
If I run a backtest using moving averages with n periods, the dataframe will contain Nan values for the first n1 periods. So the strategy will actually not be backtested at the start date I initially set up. But it will compare with a buy and hold return strategy using the correct dataframe. So the comparison is actually not correct. What would be the fix?
@sChaikovsky
@sChaikovsky 2 жыл бұрын
def next(): if len(self.data) < n: return ….continue with your code….
@borism4849
@borism4849 2 жыл бұрын
@@sChaikovsky Here is my code: class SMAcross(Strategy): n1 = 20 n2 = 50 def init(self): self.sma1 = self.I(SMA, self.data.Close,self.n1) self.sma2 = self.I(SMA, self.data.Close,self.n2) def next(self): if crossover(self.sma1,self.sma2): self.buy() elif crossover(self.sma2,self.sma1): self.sell() Can you help me please
@sChaikovsky
@sChaikovsky 2 жыл бұрын
@@borism4849 Just insert this under def next(self): if len(self.data) < self.n2: return if crossover… self.buy() elif crossover,,,, self.sell()
@borism4849
@borism4849 2 жыл бұрын
@@sChaikovsky This will not solve the issue. Let's say my dataframe starts on January 1, 2015. Whether I add "if len(self.data) < self.n2" or not, the SMA cross strategy will start in n2 periods after January 1, 2015. But when I run output, the start period of the buy and hold strategy will still be January 1, 2015. So the periods for both strategies will not be the same.
@sChaikovsky
@sChaikovsky 2 жыл бұрын
@@borism4849 then you need to create backtesting library by yourself. Their backtesting library will start from the first date on your input data frame. I think instead of caring so much about NA values, you should focus on finding the best strategy with optimized parameters. NA values period is where no tradings took place, so your money still be the same. If you care so much about NA values, why don’t you prepare everything (e.g. 2 sma values into your data frame) first. Then in init() function you don’t need to perform anything, just type only “pass”. But by doing this, you will not be able to use their optimize function anymore I think. Nothing in this world cannot answer for all of what you need, you need to create it by yourself. I create everything by myself too. I just use everything on the internet as the guideline.
@guidomarquez8973
@guidomarquez8973 Жыл бұрын
Hello!! Excellent video. I am exactly the code shown in the video, however I get the following error: "TypeError: Can't instantiate abstract class GoldenCross with abstract method init". What can it be, the version of python (I use 3.8.0)?
@ПавелСкрябин-х5х
@ПавелСкрябин-х5х Жыл бұрын
Type def init(self) instead of def __init__(self) . It was my mistake too
@cosmicblack
@cosmicblack Жыл бұрын
nice video, i just have a question. im looking into de the documentation how i can set the data to the strategy instead of using GOOG or EURUSD. Buy i still not able to find it. Do you know how to feed the data to the strategy from a csv file?
@cosmicblack
@cosmicblack Жыл бұрын
i'm just guessing, but i dont know if i just need to set self.data = my_data, where my_data is a pd.DataFrame with my data. but i'm looking if its correct and the structure fo the datafram because what i read in the doc seems to be de open_time as index. am i correct?
@ChadThackray
@ChadThackray Жыл бұрын
@@cosmicblack Just load in the CSV as a pandas dataframe. Then feed it in the same as we do for GOOG
@cosmicblack
@cosmicblack Жыл бұрын
@@ChadThackray thanks a lot. Im creating an indicator, the SSL because i didnt found it in talib library to test it. But i still have the problem with my dta. With GOOG its not issue but with my data it is. It has the Open High Low Close columns but im using 5m timeframe and my open_time colmn i setted as the index. is that correct? the Documentation doesnt says much about the topic
@gurkanozturk4620
@gurkanozturk4620 Жыл бұрын
this is a very good video thanks for the information u gave but I have a problem. when I optimize my variables I can see the variables for example length_of_ema = 24,std_of_bbands = 2 but when I use same variables(24,2) as bt.run() in my code I don't get the same output as bt.optimize() gave me. also I don't have other variables
@gurkanozturk4620
@gurkanozturk4620 Жыл бұрын
I'd be very happy if you can help me
@davidhazle3234
@davidhazle3234 7 ай бұрын
Chad, another really good training tutorial . Are you able to share the python code with each of your tutorialss pls?
@garyin5
@garyin5 2 жыл бұрын
Hi Chad, I am interested in running the backtesting with multiple threads in gpu-process. Could you please help to talk more about how to run it with GPU?
@daxj9133
@daxj9133 Жыл бұрын
You can use CUDA
@FilSerge
@FilSerge Жыл бұрын
Have you succeeded in that?
@KWMtrading
@KWMtrading 9 ай бұрын
Talib package not working for me
@simulateworld3198
@simulateworld3198 8 ай бұрын
You need install it first
@GD-bx5pk
@GD-bx5pk 2 жыл бұрын
Hi Chad @ 1:15 you said it doesn’t try to integrate with a broker does that mean i can only backtest and optimise i cant trade with it via api or whatever. I’m a python beginner
@ChadThackray
@ChadThackray 2 жыл бұрын
Yes, there are no live trading functionalities. You could probably modify it to do that if you wanted, but it wouldn't be too easy
@arivuazhagan218
@arivuazhagan218 Жыл бұрын
I am using this library ...while placing limit order it execute away from the order price.. if I place limit buy order as 100.2 it execute at 100.6...this affect the backtesting result.
@ChadThackray
@ChadThackray Жыл бұрын
Are you using commission? I believe the way that's simulated in backtesting.py is to change the price the order gets executed at
Custom Indicators In Backtesting.py - Python Deep Dive
35:19
Chad Thackray
Рет қаралды 31 М.
Stop Losses in Backtesting.py
27:08
Chad Thackray
Рет қаралды 16 М.
ROSÉ & Bruno Mars - APT. (Official Music Video)
02:54
ROSÉ
Рет қаралды 319 МЛН
龟兔赛跑:好可爱的小乌龟#short #angel #clown
01:00
Super Beauty team
Рет қаралды 139 МЛН
Car Bubble vs Lamborghini
00:33
Stokes Twins
Рет қаралды 39 МЛН
Automated Price Break Out Detection: Algorithmic Trading In Python
16:34
Backtrader Vs. VectorBt
9:01
Chad Thackray
Рет қаралды 18 М.
Data Analysis with Python for Excel Users - Full Course
3:57:46
freeCodeCamp.org
Рет қаралды 3 МЛН
Backtest Your Dollar Cost Average Strategy easily in Python
25:07
Chad Thackray
Рет қаралды 10 М.
APIs for Beginners 2023 - How to use an API (Full Course / Tutorial)
3:07:07
freeCodeCamp.org
Рет қаралды 2,4 МЛН
Python Django Web Framework - Full Course for Beginners
3:45:41
freeCodeCamp.org
Рет қаралды 4,6 МЛН
Machine Learning for Everybody - Full Course
3:53:53
freeCodeCamp.org
Рет қаралды 7 МЛН
ROSÉ & Bruno Mars - APT. (Official Music Video)
02:54
ROSÉ
Рет қаралды 319 МЛН