I have to say that I'm more interested in the python coding than whether this strategy works. I've written bots for metatrader, indicators for trading view and write python/C++ for work but I do like the way you structure your code. very straightforward. thanks for sharing!
@Algovibes2 жыл бұрын
Same for me! Appreciate your comment man :-)
@Tryndamereization2 жыл бұрын
Agree. Great structure of code
@Kr3m3rsVids2 жыл бұрын
Very educational, looking forward to part 2! Thanks!
@Algovibes2 жыл бұрын
Thank you very much man. Part 2 coming this or next week!
@olivierdefosse59562 жыл бұрын
just amazing! Above all, don't stop... I love it
@Algovibes2 жыл бұрын
Thanks Olivier, I won't stop, no worries 😄
@CryptoWizards2 жыл бұрын
Awesome video - am going to try this now and post a vid on my channel. Big shoutout to you.
@Algovibes2 жыл бұрын
Nice, thank you mate :-)
@walterweyers66192 жыл бұрын
Waiting for part 2. Great work. Very informative!
@gmmg32202 жыл бұрын
Waw. Part 2 please.And again amazing episode 👏
@Algovibes2 жыл бұрын
Thank you very much :-)
@GenNextAnalyst2 жыл бұрын
very clear and structured tutorial! Thanks man!
@Algovibes2 жыл бұрын
Thanks a lot for watching :-) Happy to read that!
@PaulanerStudios2 жыл бұрын
was working on something exactly like this just a couple days ago. Just slightly different and also did a hyperparameter search to find a better parametrization for my specific strategy. Currently livetesting it.
@waynetrain86502 жыл бұрын
I suggest doing Walk Forward Optimization, to not overfit, if u didn't already think about that. Would love to hear your results!
@PaulanerStudios2 жыл бұрын
@@waynetrain8650 yeah already did that...
@Algovibes2 жыл бұрын
Hey man, thanks a lot for sharing. Would be quite interested in your insights as well!
@PaulanerStudios2 жыл бұрын
@@Algovibes I use exponential moving averages on the lows and highs instead of simple ones. The window size on the lows and highs, aswell as the timeframe (the interval a candle represents in a chart) are really the only parameters that I searched on. For the hyperparameter search I vectorized as best as I could and threaded everything so the code is a little more extensive but quiet fast. Backtesting an entire year in 0.1s something like that. Livetesting currently on the FTX API using max volume of the last 10 orders in the orderbook as a price heuristic. This just sorta makes sure that when I'd actually close a trade at market price the heuristic would most likely underestimate that.
@SnoopFix2 жыл бұрын
Great Video! Informative and Understandable, even for me as a C++ user. I am fairly new to Trading with bots and can't help but be annoyed by the quantity of trades in such 'deeply conditioned' strategies. Imagine only trading
@Algovibes2 жыл бұрын
Thanks a lot for your comment man. Would love to be proficient in C++ !
@itayhilel21682 жыл бұрын
Very interesting, waiting for part 2
@Algovibes2 жыл бұрын
Thanks mate, coming probably this or next week!
@agustinkashiraja4012 жыл бұрын
THAKS! FANTASTIC! WAINTING FOR BACKTESTING!
@Algovibes2 жыл бұрын
Hi man, thanks a lot for your comment. Video will probably come within the next couple of days.
@ÜmitKirenci2 жыл бұрын
Yess, new video :) 👍
@davidburcham79512 жыл бұрын
Great! Now I dont have to do the Btesting on some strat ,(that I do not have much faith in) that wanna-b trader rip off from someone. I write my strats on Tradingview here in the states. I really like pinescript (user friendly) and they have a great community! This will be interesting so keep up the great work!
@Algovibes2 жыл бұрын
Thanks a lot David!
@ordinarygg2 жыл бұрын
Also do not include wicks in backtesting, because you just literally will miss liquidity to fill. I'm a profitable 1-year bot trader and could say, the final structure you will have: -> bots -> collecting trades system + worker who syncs order info -> dashboard API that provides aggregation about your trades including fees calculation, also balance tracking of your reinvest and withdrawals. I don't use anything that is related to chart drawing -> MarketMaker could draw any chart, so your strategy should use intra-day intra-hour intra-second, or global strategies that could survive long term on any market. You just need to realize there are a lot of players in the market and all these indicators should be used from a different angle than retail strategy does, just saying. If you automate what retail does -> you will lose in 90% of cases. Money and risk management is a key -> you could use even a 50 cent coin flip for desicion to buy or sell, results will blow your mind)
@yadsasusi39772 жыл бұрын
Hi, I am interested in algotrading, can you just provide me some resources and guidance to start learning this. It will be very helpful
@Algovibes2 жыл бұрын
@@yadsasusi3977 you are already in the very right place! Be kindly invited to check out my stuff- in specific the Python for Finance playlist and the cryptobot playlist as well. @Yaroslav: Good inputs, thanks a lot! I agree on some points , yet disagree on some. By the way: I would also take your comment seriously without the "profitable trader" claim.
@ordinarygg2 жыл бұрын
@@Algovibes If you are interested we can collaborate I will show you my system in some live stream or could make a video, whatever) would be helpful for your viewers. "profitable trader" agree that sounds a bit selfish)) long road to stable passive income
@akashjariwala53542 жыл бұрын
Wow... thats amazing... would you mind sharing show doc or guiding me?
@rje42422 жыл бұрын
backtesting is a great topic, worth the membership :)
@Algovibes2 жыл бұрын
Thanks a bunch for being an Algovibes channel member! :-)
@Daniel-fv1ff2 жыл бұрын
Great video, very interesting
@Algovibes2 жыл бұрын
Thanks mate :-)
@HarryLi2 жыл бұрын
Hi, thanks for this video and it’s informative in many ways. However I found that there is some forward looking issue in the code. E.g. 10:16 you are setting the buy price at 3% below “today” (current row)’s close price. And in reality a person can’t exactly know current day’s close price hence this buy price is not set correctly. It actually should be yesterday’s close price with a 3% reduction. And it tells us another issue of Buy signal setting. Buy signal should check today’s low against previous day’s close, instead of today’s close against previous day’s Low.
@2k10clarky2 жыл бұрын
I've been bitten by the forward looking issue, it can make you think you have the strat to end all strats :) when in fact you have pure garbage
@Algovibes2 жыл бұрын
In general you are right, in this specific case not. At the end of day X I know that my Close is above the SMA and also the Close crosses the lower BB. If that's the case I am placing a Buy limit order on 97% of Day Xs Close price (I can do that because I am placing the order once the market closes). I am checking now if on the next day my buy limit order would have gone through. If it's going through it is being executed with 97% of the close price. There is no look ahead bias. It seems like a look-ahead bias only because I am using this information but as I don't have intraday data that's the only way to find out if the Buy limit order would have gone through. Look-ahead bias would be e.g.: I am buying (market order) when todays close is above yesterdays close and I am buying on todays close price. I cannot take today's close price as I only have the information when the market closes and need to take the next days open price instead.
@2k10clarky2 жыл бұрын
@@Algovibes Make sense. I'll be specific my look ahead bias was using the BB from the current candle close price on a 5 min strat. Needless to say a big wick would change it and is unknowable in real time. As soon as I changed it to previous candle close all alpha was lost :-/ Would be really great if you had a discord to discuss this stuff in depth as its pretty much a lone persuit creating trading bots.
@rupindersingh13122 жыл бұрын
Awesome dude 😎
@Algovibes2 жыл бұрын
Happy that you like it man!
@ByteM3N0w2 жыл бұрын
Great work!
@Algovibes2 жыл бұрын
Thanks :-)
@loryo802 жыл бұрын
Thank You for this video, very instructif ass usuel
@Algovibes2 жыл бұрын
Thanks for your feedback man, that's great to read!
@larrybird37292 жыл бұрын
From my experience as a quant any code that forecasts into the future can be problematic , its not when you first do it, its more when you add more code and forget about it then one day you run a back-test and this innocent snippet of code synergises into a filter that takes out all the bad trades and gives you false hope on a system that does not work, its better to simulate everything like your trading in real time that includes fees and any type of slippage or spread But thanks for sharing keep it up
@Algovibes2 жыл бұрын
Thanks a lot Larry for sharing your thoughts. Agree with your statement btw.
@ahmetbinatlioglu88482 жыл бұрын
Great video bro
@Algovibes2 жыл бұрын
Thanks a lot mate
@rraul2 жыл бұрын
I love this content. Keep up!
@rraul2 жыл бұрын
I did the backtest in brazilians stocks, not profitable. But i really appreciate this video. You Motivates me to keep up learning Python. I would suggest you to make a video testing if any strategy is statistically significant or not. Steps to verify a strategy, whatever it be. Thanks
@Algovibes2 жыл бұрын
Good to know, thanks a lot for sharing rraul!
@scottphillips81172 жыл бұрын
This strategy is implicily overfitted. A long only "buy the dip" strategy will work in a long running and powerful bull market, even if the strategy sucks. To know if the rules describe noise or signal you'd have to test it over a longer period including bear markets. Suggest the long running Japanese equity bear. Otherwise your backtest is a fig leaf and almost certainly forward results don't match historical. Not saying it is garbage just that a backtest on a long only strategy in a period where long only strategies have crushed tells you literally nothing about future performance.
@Algovibes2 жыл бұрын
Hi Scott, really appreciate sharing your thoughts!
@flyaway36292 жыл бұрын
Scott you're a true G! When it comes to BB strategies, the Holy Grail system is the way to go
@adulting_wellatleasttry35752 жыл бұрын
Was using bits of your code trying to make a strategy and used your part to filter the dataframe for matching buys and sells, and noticed that it might be the case on some stock that first entry is sell rather than buy, so from the looks of it, it turns to a short seller rather than a buy first and sell later. Might be I miseed something.
@Algovibes2 жыл бұрын
Shouldn't happen. Can you go through it again please?
@Crazy17932 жыл бұрын
8:30 - 9:20(ish) are you sure it's not s forward looking biased? They way you explained it made it really seemed like it. Because you said that you check the next day closing price
@Algovibes2 жыл бұрын
It isn‘t. I am only checking if the buy limit order would have gone through. If the low is equal or below 97% of the prior close the order would have been executed so I can consider it.
@luclonjon22322 жыл бұрын
Hi, great content as usual! Would such a strategy apply on crypto trading ?
@Algovibes2 жыл бұрын
Will probably test that out in the future. Stay tuned ;-)
@luclonjon22322 жыл бұрын
@@Algovibes Actually I've tried implementing the indicators on BTCUSDT and ETHUSDT already (couldn't wait sry lol). But it seems like we're getting very few buying signals, where would it be coming from ? i.e. I've been trying over 2000 day / 1 day per row periodization and got 3 buying signals... I'd be glad to have your insight on this. Thx again for the content!
@theemperor11432 жыл бұрын
Can you explain to us how to program a strategy based on multiple time frame?
@Algovibes2 жыл бұрын
I think I covered it here: kzbin.info/www/bejne/fnOUdH-wZb9khLs or here: kzbin.info/www/bejne/rIi5i6uflsaHedU Please let me know if you are missing something. Happy to include that in future videos.
@revenge94312 жыл бұрын
Yo whats up How did u get ur jupyter notebook dark theme? U can show?
@Algovibes2 жыл бұрын
Hi man, here you are: stackoverflow.com/questions/46510192/change-the-theme-in-jupyter-notebook ;) Thanks a lot for watching!
@revenge94312 жыл бұрын
@@Algovibes your the man thanks!
@mr.gk52 жыл бұрын
Very nice please do win rate calculation in part 2
@Algovibes2 жыл бұрын
Thanks mate, I included win rate in part 2 - just released it. Let me know below the video what you think about it: kzbin.info/www/bejne/mmW6mIJ_p8esa7M
@santhoshdasari72 жыл бұрын
Thanks a lot for sharing…
@Algovibes2 жыл бұрын
Thanks for watching!
@ranunculusrouge12722 жыл бұрын
Hey, love your videos. Have you ever thought about writing a flash loan bot?
@Algovibes2 жыл бұрын
Thanks a lot, no not yet.
@tams56952 жыл бұрын
In which video do you explain how to download all the libraries for binance and papas? Thanks
@Algovibes2 жыл бұрын
There nothing magic about it, just install them with pip. I usually show the installation command when I first use the library. For binance e.g. that would be: kzbin.info/www/bejne/lXq5YqSciLWDras
@tams56952 жыл бұрын
@@Algovibes thanks 🤙
@Mr.Flo.Official2 жыл бұрын
What GUI are you using for python code?
@Algovibes2 жыл бұрын
Using Jupyter Notebook here.
@Mr.Flo.Official2 жыл бұрын
@@Algovibes thank you.
@leewsimpson12 жыл бұрын
So explain again how we get to 1689% ?
@ventiladorbueno18462 жыл бұрын
Thank you
@Algovibes2 жыл бұрын
Thanks for watching! :-)
@riccardoronco6272 жыл бұрын
there is one MAJOR issue: when you calculate the LIMIT order to buy, you use AdjCloses to get your 3% limit order. That is correct. However, you compare this price with a NON ADJUSTED Low. With the passing of time, dividends will impact on closes but not on your lows. So you have to adjust the LOWS with the same FACTOR used for AdjClose. If you fail to do that, this backtest will trigger not all the trades that could have happened in reality. Attention!
@CAGB-cx4xe2 жыл бұрын
what is your favorite indicator?
@Algovibes2 жыл бұрын
The ones that are working over long Backtesting (and Validation) periods ;-)
@goldenhany52482 жыл бұрын
thanks for your video ... can i apply this in a real account ?
@Algovibes2 жыл бұрын
Well I didn't test that in the real market yet but I am planning to test that on cryptos in the upcoming weeks and probably make a video about it so stay tuned!
@EricNeilson_2 жыл бұрын
I can't get the yf to download the data. I keep getting this note: - MSFT: No data found for this date range, symbol may be delisted
@EricNeilson_2 жыл бұрын
every ticker.
@EricNeilson_2 жыл бұрын
@@stanvanillo9831 I did search, thanks for your useless feedback
@Algovibes2 жыл бұрын
@Barney Gumble That's quite rude. Please just be kind - will bring you far in life, I guarantee! Besides that: Can you elaborate on your problem? Did you update yfinance? Did you somehow deviate from the code? Does it also happen when you are pulling a single stock?
@arpanmaji2 жыл бұрын
"Import ta" How get that module?
@Algovibes2 жыл бұрын
pip install ta
@sasuke1234ization2 жыл бұрын
would love to see the same method but on binance.
@Algovibes2 жыл бұрын
Thx for your suggestion!
@sweealamak6282 жыл бұрын
I've got my own algo ready but in excel format. Was wondering whether to code a recognised pattern as a class with functions to calculate a successful buy/sell indication but it turns out it is more straightforward just adding a new column directly to the pandas dataframe. I come from old school C++ programming, python pandas is truly amazing. Awesome coding! 👍
@Algovibes2 жыл бұрын
Hey man, that's awesome. C++ knowledge is an asset! Appreciate your comment. And yes you can do both: Doing a vectorized approach or use a simple loop logic. Both is fine. Got using loops in my older videos as well if you are interested in that.
@sweealamak6282 жыл бұрын
@@Algovibes Thanks for replying. I suppose looping has been the traditional way of repeating the same function on different input variables but that is single threaded limited by CPU speed. Your vector method is so much faster taking advantage of multithreading! I'm slowly pouring through your vids now 👍
@freddurst44202 жыл бұрын
it doesn't seem like this strat will make the return as claimed, but not sure of back testing params
@Algovibes2 жыл бұрын
Let's see in the next part! ;-)
@shinderaju1232 жыл бұрын
I want to learn Python and want to create my own strategy with BB and RSI
@gglendormi2 жыл бұрын
What is adjusted close ?
@Algovibes2 жыл бұрын
I think I explained that in one of my age old vids: kzbin.info/www/bejne/bKLFhX6qg6ibapo Pls check that out and let me know if that is clarifying!
@billychan47882 жыл бұрын
is it legal to use it on the real market?
@Algovibes2 жыл бұрын
Why shouldn't it?
@MansourAlAkeel2 жыл бұрын
report of profit and loss, including broker fees is not very clear. Can be improved by using an existing back testing framework with some visual presentation
@Algovibes2 жыл бұрын
Hi Mansour, thx a lot for your comment. Sure, could be added. Go ahead and do that ;-) I have shown how to do that in previous videos.
@theresalwaysanotherway39962 жыл бұрын
the real question is, does it beat the market?
@stanislavyackon18872 жыл бұрын
it beats trader
@Algovibes2 жыл бұрын
Probably the most important one!
@xxGamerKidx2 жыл бұрын
So are using a backtest library like backtrader or zipline or is this strictly back testing using imports only ?
@Algovibes2 жыл бұрын
In this one I don't use a backtesting lib, no. But I am pretty sure the 97% buying order part would be quite painful to add at least with Backtrader.
@shinderaju1232 жыл бұрын
Sir great video but 97% concept not clear pls guide
@Algovibes2 жыл бұрын
Just checking if the limit buy order would have gone through. Doing that by checking if the next days low was hitting 97% of the priors close. With that I know that the limit order would have been placed.
@knightofLotus2 жыл бұрын
mmm I don't understand what should mean 1689% in your title...
@Algovibes2 жыл бұрын
Did you check the referenced video? Then you know! 😛
@lez0752 жыл бұрын
1689% = Multiplying your investmente by 17.89x, if you invest $1000, you get $17890 ($16890 neto)
@knightofLotus2 жыл бұрын
@@lez075 thank you! now I undesrtand! :)
@luisnegrao59512 жыл бұрын
You are not taking into consideration any kind of trading fees wich makes the strategy look better tthan what it actualy looks like. Anyway great content!
@ghaithalmasri30392 жыл бұрын
how would u implement trading fees into a backtest?
@Algovibes2 жыл бұрын
By simply adding an amount of x from the profit. It isn't a huge deal and I already did that in a lot of my videos.
@luisnegrao59512 жыл бұрын
@@ghaithalmasri3039 In order to do so you would need to look on an exchange to see what fees they charge. Kucoin for example charges 0.1% which does not seem a lot but realy eat at the profits specialy when you make a small trade since it charges the fee when you buy and when you sell
@luisnegrao59512 жыл бұрын
@@Algovibes I have been into algo trading for some time and i found that it makes a resonable Diference. Maybe i didnt notice on the other videos. I can give you a git link if you are interested um cheking out. The catch is that i coded it with nodejs
@ghaithalmasri30392 жыл бұрын
@@luisnegrao5951 found a way to implement it and im actually surprised at how much it reduced my profits. And thats only 0.04% on each trade.
@andreainvernizzi85102 жыл бұрын
Rayner Teo is just an income youtuber who doesn't know jack about trading and capital markets. YT is his source of income, not trading.
@ahmadieb2 жыл бұрын
peeking biased does not work
@Algovibes2 жыл бұрын
Can you elaborate?
@fate56242 жыл бұрын
LOL jemand deutsches
@Algovibes2 жыл бұрын
🤫 Bleibt unter uns, ok?
@letsgobrandon20442 жыл бұрын
I think the tables will turn for the worst with your channel. A lot make that mistake. What this means is that the content you make free will not be profitable. Wanting us to pay for the profitable code. Just like the rest now brother
@Algovibes2 жыл бұрын
Nah, I am just giving people the option to get access to the code. The written code is the exact same thing as the presented code. I would never claim to sell "profitable" code. That being said: You could consider becoming a supporter of the channel :-) Would be happy to welcome you!
@sohailchouhan78442 жыл бұрын
Hey brother great effort, can you tell me how to contact you.
@Algovibes2 жыл бұрын
Thanks mate, how can I help?
@luismanuelzuccolo14382 жыл бұрын
Buy conditions has a value of the future "df.Low.shift(-1)". This doesn' t' work in a live environment
@theafricanquant5012 жыл бұрын
You are right...but its still okay to use it in Backtesting...just to see if a trade would have been taking.
@Algovibes2 жыл бұрын
Hi Luis, did you listen to what I said in the video? 😛