Hi everyone, some of you raised that the 10m SMA should be calculated on monthly data - I tend to disagree but I understand the intuition behind that. Anyhow I did it just for you: Return: 461.394957 % since 1985. So overall distinctly worse.
@asutin Жыл бұрын
I coded the strategy. A significant contributor to outperforming the s&p by so much was just sitting out the great depression
@Algovibes Жыл бұрын
Thanks for your contribution!
@flashrun6093 Жыл бұрын
Interesting video. I think would be nice to have a for loop in a range to find the sma length which achives the highest return.
@siddharthkumar2824 Жыл бұрын
that is called overfitting ser
@Algovibes Жыл бұрын
You can do that but I would follow a train test split approach here to avoid the overfitting pointed out by siddharth. I did it e.g. here: kzbin.info/www/bejne/o5LFdHyoYsZnfqM
@tjoppies Жыл бұрын
@@Algovibes Thanks, exactly what I was going to ask as well @Flash Run. Thanks Algovibes. I was thinking of using this highest return sma as my trend indicator and then use other TI to trigger my buy and sell positions. Is there any other suggestions that I could look at re trend indicator? KR
@82fedlom Жыл бұрын
Hi AlgoVibes, using easy language on tradestation I found that a simple strategy to invest in SP500 by greatly reducing the DrawDown, but obviously also reducing the annualized return is in practice a small correction of this one. If you want to integrate in a later video, you can use the following conditions: Buy if Close > SMA(200) and Close > SMA(20) Exit position if Close < SMA(200) However, the backtest I ran is from 2000, not 1985. given the efficiency of the market it is absolutely obvious that these simple strategies (among other things without Wolk forwad analisys, in sample, out of sample backtesting) cannot outperform the market, but at best they can improve the sharpe and increase the Net Profit/Max DD ratio.
@Baldur1338 Жыл бұрын
Hi, thanks for the great video as always. Could you elaborate why you used the Close instead of the Adjusted Close price. I know the difference between them but Im not quite sure which one to pick and why. Thank you in advance
@Algovibes Жыл бұрын
Hi, welcome buddy. I explained the difference in the earlier videos of the Python for Finance playlist. In a nutshell: Adjusted Close is correcting for dividends/splits. In this case it's perfectly fine to take the close price.
@mikehaks Жыл бұрын
Thanks for the video. I kind of expected it not to be better, since you need an instrument that has very deep pullbacks and recoveries, so that the next entry has to be much cheaper (lower) than the last exit in order to get an advantage over buy and hold. You'd need more 1929's and 1987's, and be longer. Maybe it would work better on individual stocks rather than index, but then you have the question of which stocks.
@rraul Жыл бұрын
I think Factor investing is the unique way to outperform sp500. In Brazil it works. Congratulations for Stay motivated all this year bringing interesting content, my friend!
@danielewart8811 Жыл бұрын
Algo could you do a video on your JupyterNotebook setup how to get all libraries etc ?
@Algovibes Жыл бұрын
I did some years ago 😛 Check out the Python Introduction playlist.
@danielewart8811 Жыл бұрын
@@Algovibes thanks man!
@andycare Жыл бұрын
This is a very nice example of how difficult it is to replicate backtests - even if they are so simple as this. The results really depend on the settings: Are the Entries and Exits at the next Open or at this bar’s Close? Is the 10-month MA calculated on true monthly bars or approximated by daily bars? Are crossovers of the 10-month MA and the 200-day MA evaluated daily or only at the end of the month? Are the statistics based on daily bars or monthly bars (which has significant impact on the risk parameters like drawdown and volatility). I can replicate the backtest of the original video from 1928 until today and I see similar results as you from 1985. Try 2000-01-01 as a start date and the outperformance of the true 10-Month MA with Entries EOM is significant.
@ΠαναγιώτηςΛουκοπουλος-ι7β Жыл бұрын
Excellent work 👏👏👏... Is possible to do a futures bot
@sastianp Жыл бұрын
I wouldn't expect a strategy that is based on 'enter when crossing up and exit when crossing down' to be particularly efficient. There's just too much lag between the high of profits and return to SMA. Is there any chance you could simulate something like 'enter when crossing over (buy when up, sell when down) and exit on RSI divergence'?
@DawidGdybadz Жыл бұрын
I was interesting. I would love to code python to do backtesting of my own strategies. What is at least for now the best strategy backtested? Can you also backtest on crypto?
@lucasparisi7394 Жыл бұрын
Thanks for the video, your content has been quite insightful. About this strategy, 1.89 SQN is not great.
@Algovibes Жыл бұрын
Welcome mate. Thanks for watching!
@hourglass9 Жыл бұрын
Great Video! Can you simultaneously do a backtesting on all 4 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 😀
@Sirleopard666 Жыл бұрын
Hello, have you tried some strategy base on hidden markov models detecting trends?
@FrancescoGoodwin Жыл бұрын
Hi bro, great video. Is it possible to contact with you, for example in TG or another Dm way?
@Algovibes Жыл бұрын
Hi mate, thanks a lot. Just drop me a mail. You can find that in the About section of my channel.
@elu1 Жыл бұрын
what about to use SP500 as a broad market indicator to guide buying and selling for a particular stock and to see if that is better than in and out based on the stock's own SMA?
@Algovibes Жыл бұрын
Interesting idea!
@Kr3m3rsVids Жыл бұрын
Not so interested in the strategies themselves as in the way to code them in Python here. Like the nice reports the backtesting lib is producing though. Maybe it’s worth spending some time trying to code something like this myself to compare strategies. Love your channel.
@Algovibes Жыл бұрын
Thank you so much!
@riccardoronco627 Жыл бұрын
I love monthly models - the only issue is that there are FEW signals hence we need to apply this to many time series (at least 100) - here you are using DAILY data and the comparison is not correct for prices are crossing much less a 10 month ma than a 200 day ma. There is a massive difference. May I suggest you re-run the test using MONTHLY data? tia
@Algovibes Жыл бұрын
Did that, pls check the pinned comment. Thanks for watching btw 🙂
@minhducbui9660 Жыл бұрын
Thanks you for your work . I have a question in your other video "How to build a RSI Trading Strategy and Backtest over 500 stocks in Python [70% Winning Rate]" , if close price > ma200 and rsi < 30 for 3 consecutive days then there will be 3 consecutive buy signals right? Thanks you in advanced !
@Algovibes Жыл бұрын
Yes! I was taking overlapping positions there but linked a video where I am excluding overlapping positions. Be invited to check that out!
@nadonadia2521 Жыл бұрын
great video, but i do not agree with you from the begining SMA(300 days ) is not SMA(10 months), you have the possibility to take yahoo finance values on a monthly basis to calculate SMA(10 monthly), i have a stock chart platform, when i plot the SMA on a daily basis and Monthly time frame there are not same values.
@DiabolusBR Жыл бұрын
You've nailed it. The original video is using closing prices of the monthly bars, which is VERY different from what he is testing in this video. HOWEVER, I tested that, and got similar results to buy and hold (still didn't get that amazing backtest he showed in the original video), but really limited the drawdown
@Algovibes Жыл бұрын
Thanks mate. Strategy base setting were the 200 day SMA and both settings were meant to outperform the S&P. Everything is perfectly fine. But you can also take monthly based MA values. Would indeed be interesting if that changes the picture. Might test that later on.
@kingtrippy5006 Жыл бұрын
10mo is different than 300 day SMA as it reduces whipsaws/trade #