Excellent information and this is the only video on YT with clear method on how to optimize and validate our strategy. Thanks for taking time and sharing your knowledge. Greatly Appreciated and it benefited a lot! Thanks!
This is top notch stuff. Although the total profit of the strategy may not beat buy and hold, the advantage is you are not in the position full time. When you are out of the position, your capital could be invested in another asset if it is in a state that expects to outperform AAPL at that particular time... or you could stay in cash and sleep easier at night.
Once upon a time I was testing my grid trading strategy, and I got my balance to be 100x as much as initial balance in a matter of one year. But if I move the starting point of a testing literally by one day, i got busted almost immediately. So you shouldn't be obsessed with optimization. It should be able to keep being on the flow no matter of the 'financial weather'.
Referring to that at the end of the video. For a bulletproof optimization you need a train test split. I have covered something very similar here: ruclips.net/video/mabCIr-a4HA/видео.html
does the cross join and then loop over the dataframe way have a performance benefit over the nested loop? Intuitively I would have iterated just over x and y in a nested for loop
What is the probabilty that optimized parametrs will bring profite in the future trading? The probability is very low, because you a looking for a best parametr using past data, but not checking, how this parametrs works on the future data! It is much more interesting to listen about forward testing, not about backtesting!
You repeated exactly what I said in the video. I have content on that as well - Just watch all my videos and you will get a detailed and holistic view. Let me know if you need anything!
From a coding perspective, have you ever tried list comprehension for the conditional looping logic? I'm taking an online python course and they suggest "pythonic" way of coding. Their recommendation is centered around dealing with very large datasets. Just wondering whether you think there's a material benefit switching styles for this specific case of trading labels.
No definitely not. I am just referring to the interesting result that no matter which values you are passing you never outperform the asset itself over the long term (at least Apple). Interestingly this is not true for assets with a rather bad performance (e.g. MMM). There is much more to be considered: Exposure Time, Volatility, Max Drawdown, turnover and trading costs.
@@Algovibes just curious. Cuz I always hear people talking about whether it does or doesn't. Drawdown is another term that lacks intuitive-ness for me too. Thanks.
@@Algovibes would be fun to use volume as an indicator to determine how likely your trade would go through. For Apple it might not be an issue but this is another dimension of a full optimisation strategy.
I took algovibes' code and did a quick test on XOM to test this idea. To save time I only examined sma's from 10 to 50. Buy and hold had profit of 1.664 and the sma strategy produced a profit of 2.180 so it can (not necessarily will) work better on cyclical stocks.
don't take AAPL, bet something wavy instead, like efs - TLT, HYG, JNK. SPY is not "wavy" but still a tiny bit outperform "buy and hold". Need something volatile but horizontal to outperform growing monsters.
Probably one of the most practical algotrading/backtesting content on the Web. Most of which is just pure water.
Thanks a lot mate! Be kindly invited to check out my other stuff.
Excellent information and this is the only video on YT with clear method on how to optimize and validate our strategy. Thanks for taking time and sharing your knowledge. Greatly Appreciated and it benefited a lot! Thanks!
Thank you very much!
This is top notch stuff. Although the total profit of the strategy may not beat buy and hold, the advantage is you are not in the position full time. When you are out of the position, your capital could be invested in another asset if it is in a state that expects to outperform AAPL at that particular time... or you could stay in cash and sleep easier at night.
Agreed! Be invited to check out my newest series. I am going more into details there.
Incredible Algovibes! Never met so clear explantions and so concise code in the same tutorial!!
Very happy to read! Thanks a lot for watching and leaving a comment :-)
this is so much fun to find combinations of SMAs which doe not make much sense but works very well.
This is really great. Very clean and concise code. Well done.
Thanks buddy! Be invited to check out my other stuff :-)
I'd love to see more of these.
Thx for your feedback Dennis! Appreciate it.
Hi Dennis Carver, I can guide you how to invest in cryptocurrency. So you can leave me your contact. Regards
Great. It will be nice to expand as stated. Thanks.
Thanks for your feedback, highly appreciated!
you can optimise if you filter where SMA_1 and SMA_2 have inverted values.
ex. SMA_1=10 and SMA_2=15 vs SMA_1=15 and SMA_2=10
ahh, I just threw away all values where sma_1 > sma_2
very nice approach and great explanation of multiple fundamental concepts. you keep producing interesting content, thanks
Thanks a lot mate. Appreciate your comment!
Once upon a time I was testing my grid trading strategy, and I got my balance to be 100x as much as initial balance in a matter of one year. But if I move the starting point of a testing literally by one day, i got busted almost immediately.
So you shouldn't be obsessed with optimization. It should be able to keep being on the flow no matter of the 'financial weather'.
Good point, overfitting isn't a good idea always.
Referring to that at the end of the video. For a bulletproof optimization you need a train test split. I have covered something very similar here:
ruclips.net/video/mabCIr-a4HA/видео.html
@@Algovibes I'm sorry for commenting before watching the full video.
does the cross join and then loop over the dataframe way have a performance benefit over the nested loop? Intuitively I would have iterated just over x and y in a nested for loop
very interesting!
Thanks for your feedback Bryan!
Hi, how to make the same cartesien product with tree paramaters x y z , because the merge function only accept two parameters ? Thank you
Could you explain how to use tensor flow to use GPU power when you have many more parameters
What is the probabilty that optimized parametrs will bring profite in the future trading? The probability is very low, because you a looking for a best parametr using past data, but not checking, how this parametrs works on the future data! It is much more interesting to listen about forward testing, not about backtesting!
You repeated exactly what I said in the video. I have content on that as well - Just watch all my videos and you will get a detailed and holistic view.
Let me know if you need anything!
If you have access to the "future data" then you don't need a trading strategy. Unfortunately google doesn't provide any links to future stock prices.
Would a nested for loop work the same way as the cartesian product method, in the case of optimizing for 2 parameters?
Also possible to solve this with a Nested loop but I highly recommend using the cartesian product/cross join here.
One point:
You should check the period for sma_1 is less than that for sma_2
Not necessarily as I wanted to test both sides but definitely an option.
Could we please have a video about support and resistance level detection in python for bitcoin?
Cool suggestion! Thanks a lot
Thanks Bro, How to detect support and resistance using python?
Interesting topic. Thanks for the suggestion!
@@Algovibes Thanks for reply. Please make the code as simple as you can😇
From a coding perspective, have you ever tried list comprehension for the conditional looping logic? I'm taking an online python course and they suggest "pythonic" way of coding. Their recommendation is centered around dealing with very large datasets. Just wondering whether you think there's a material benefit switching styles for this specific case of trading labels.
Wouldn't make sense here at all. But yes I am a big time user of list comprehensions :-)
@@Algovibes Thanks for replying. Will keep a look out for instances where you use list comprehension. 👍 Lots to learn 🫡
Does it need to outperform the underlying vehicle to be viable?
No definitely not. I am just referring to the interesting result that no matter which values you are passing you never outperform the asset itself over the long term (at least Apple). Interestingly this is not true for assets with a rather bad performance (e.g. MMM).
There is much more to be considered: Exposure Time, Volatility, Max Drawdown, turnover and trading costs.
@@Algovibes just curious. Cuz I always hear people talking about whether it does or doesn't. Drawdown is another term that lacks intuitive-ness for me too. Thanks.
@@Algovibes would be fun to use volume as an indicator to determine how likely your trade would go through. For Apple it might not be an issue but this is another dimension of a full optimisation strategy.
@@Algovibes this type of strategy should work much better for cyclical stocks like energy companies.
I took algovibes' code and did a quick test on XOM to test this idea. To save time I only examined sma's from 10 to 50. Buy and hold had profit of 1.664 and the sma strategy produced a profit of 2.180 so it can (not necessarily will) work better on cyclical stocks.
don't take AAPL, bet something wavy instead, like efs - TLT, HYG, JNK. SPY is not "wavy" but still a tiny bit outperform "buy and hold". Need something volatile but horizontal to outperform growing monsters.
poor GDX goes like chupa-chups. I do not see sense for n > 75-100 (edit: well 100... )
@@ageens 😄
Energy stocks are perfect for this type of strategy.
try vectorbt
☢☢☢☢☢
Thx for watching Konstantin! :)
Its better to use final = final[final.sma_1 < final.sma_2]