ProRealCode - Trading & Coding with ProRealTime™
Hello all, its been a while since I’ve last posted a 3 page long post about whatever is on my mind, so i figured it was time for another one. This post is based only on my own experiences, research and my own algorithms.
I thought I’d post another long post about something that has taken up (too) much of my time the past years. The topic is going to be about creating robust portfolios of strategies and how to manage the risk of each algorithm, combined into 1 portfolio. Im going to assume that if youre reading this you already have a couple of algorithms or maybe even 10+ running, if so im guessing questions regarding this topic has been hovering in your head also. Sadly however, I do not pocess the recipe for a perfect portfolio, but I have been running 10+ algorithms for a few years now and lessons have been learned, some the hard way. Before i start i also want to say that most of my algorithms are Long only. I got 15m, 30m, 1h, 2h, daily timeframes going on. My main markets are Dax, US tech 100, wall st, us500. The majority is momentum algorithms, but I also got some mean reverting algorithms.
When i first started with algorithmic trading I was very fixated on the portfolio part of it. I kind of knew that with enough time spent, I would be able to create profitable algorithms, but how should I put together systems to create a portfolio with as much diversification as possible? And how diversified are you really, when shit hits the fan?
My portfolio has truly been tested throughout the covid crisis and all the spikes and volatility leading up to it as well. I started my journey in 2016-2017 but it wasnt until february 2018 that i turned “everything” on/live. Just days later a huge drop in most stock markets happened and they went down roughly -10 to -15%. Before I knew it iIwas in a huge drawdown. There had basicly been no volatility since 2016 -> 2018 and suddenly it was right in my face. Panic set in and I realized that when “shit hits the fan” i wasnt diversified at all. My momentum algos got faked out at the tops right, before the fall happened and so they went into drawdown. At the same time my mean reverting algorithms tried to pick bottoms when in facts there was no bottom for another -10% down.. I realized that I had been blinded by greed and potential profits, that I had accepted way more risk than I was comfortable with. I turned off most of the algorithms and got to work. Creating new filters, looking into high volatility markets and meassures I could get in place to help stop the losses.
Now before i continue on my journey it must be said that even tho all my algorithms at that time was in the red, in the long term they all have turned green. But being red day after day, week after week, even month after month is extremely hard. You want to do anything to stop the pain that is inflicted on your account, even turning off your algorithms.
So with most algorithms turned off, i started to re-evaluate how I should construct my portfolio. I extracted the backtesting results and pasted it into excel, I did this for every strategy. I could then start running deeper analysis on each algorithm and start comparing one algo perfomance to another. I also started to look more deeply into each algorithms winning/loss per month/quarter/year, again comparing them to each other. I also researched how un-correlated (or should i say correlated?) momentum and mean reverting algorithms actually are (my algorithms at least). So here are a few of my key points when constructing a portfolio:
So with all this and more, I jumped into the portfolio game once again in october 2018. Just days after i pressed play, all markets crashed like they havnt crashed since 2008. All stock markets was down roughly -20% and my portfolio was instantly in another huge drawdown. However this time it was alot better than the last time. I had learned from my mistakes, i had adjusted the contract sizes of each algorithm to fit my portfolio better. I was bleeding money the rest of 2018, but then at christmas times santa claus blesse the stock market with a face ripping rally going straight up non stop for months, making all that bleeding worth it. I had held through a huge crash and a huge rally. Even tho i had lost money at the end of 2018 it felt good.
2019 comes around, the markets are volatile compared to 2016-2018. Obviously nobody knows yet that the corona virus is coming. My results was sadly not as good as i had hoped. Turned out that I was running some forex algorithms that was not performing as the backtest said they should be. The edge was too small, the slippage and price to play was just too high and those strategies ended up bleeding my account. Luckily I was doing very well in the indicies but overall I wasnt making alot of money. I turned off the bad strategies and my equity started to climb. I adjusted some of my best algorithms contract sizes up, at the same time i adjusted up the size of the algorithms that was most un-correlated to those strategies, to even things out.
Things was looking great, but then covid came and boy oh boy.. The markets dropped like nothing I had ever seen before. it would be roughly -30% down before markets turned up again, and I would have loved to say that I was perfect and let my algorithms run, but in the heat of the moment, at the very last drop, i turned off 2 algorithms that had lost the most, and of course, 1 week later one of these algorithms would have won back all those losses and then some if i had just kept it going. This very expensive lesson however has been proven to be worth its cost.
Finally I have included a picture of all my trading (my whole portfolio from 2020-2021), including the corona-dip, and I have compared it to the SP500. What I want to show is that by using diversification you will OVERPERFORM when the market is rough and bad, but you will UNDERPERFORM when the market is going straight up. And by my own standards I would argue that if your portfolio does this then you are on the correct path! You can now beat the market by leveraging up (depending on how much you over/underperform vs the market obviously).
And you can sadly see the huge coronavirus drop.. that dip would have just been only 50% of its size, had i not turned off 2 of the algorithms. Fear got to me, hopefully wont do something that stupid ever again.
Thanks for reading about my journey and I hope it can bring you either tips and tricks you can use or at least the knowledge that there are others out there struggling just like you are.
Lets continue the climb!
Thanks for sharing, some really good points in there.
In terms of algos, are they all your own? Or have you purchased/rented any?
also in terms of what to look for in algos/backtests/walkforward… what would you say are the most important things you look for to give best chance of success?
thanks!
all my own. (edit: except 1 short only eur/usd 15m algo i got from this forum)
In terms of backtest etc, i would say these are my main points:
Hi @jebus89
Thanks for your post
I confirm what you said in the french forum : there is (notably) no corrélation between max drawdown in IS and in OOS
In other words you can have very big winners with big max drawdown 😉
I study many many things to evaluate IS and OOS results / corrélation and it’s so disapointed…
Cheers
Indeed the drawdown periods in your backtest might not match your drawdown periods going forward.
However in my opinion the true diversification comes from how the algorithms work. Lets for example say your have 1h algorithm that buys then there is much positive momentum. And lets say that in the same market we have a 15m algorithm that buys when theres much positive momentum and sells on higher momentum.
What you will find is that for the 1h algorithm to activate a trade, theres a big chance that the 15m algorithm is already in a trade and maybe will sell when the 1h algorithm enters a trade! So if the 1h algorithm then fails, the 15m will hopefully have gained profits and maybe you will net 0 for the day, but all in all thats much better than losing money.
Same goes for mean reversion vs trend following algorithms. Now as i wrote, when shit hits the fan, aka things go down -30% and your long only, your probably going to end up in a drawdown because for example what happened to me: The trend following failed as we reached peak high in the market, and then the mean reverting ones failed as market just went down “forever”. But as everything went down, my 15m and 30m still made money because of the high volatility and swings that happen when the market turns so volatile. So yes i will loose money during the next huge crisis, but i will not lose as much as buy and hold because i have algorithms that will still profit even tho the market is going down, but my majority of algorithms are probably down.
Figuring out how much your algorithms are actually correlated is much more than just looking at the backtest and comparing.
Hi @jebus89
I have always found your posts really insightful and in many ways mirror a number of my own experiences
I have put together a budget for Prorealtime/algotrading content creators for https://robofuturestrader.com/ to support my own work
If you would be interested in working on some content together then I would love to hear from you
https://robofuturestrader.com/contact/
Thanks
Ruark
Thanks for the interesting post.
I am also running multiple algorithms at the same time, all trend following, only long and only indices.
My algorithm is the difference equation of the signal itself, so no indicators only the difference equation.
When you use this difference equation in a trading system, the system has some remarkable characteristics:
Hello Js
can you explain me what is :
My algorithm is the difference equation of the signal itself, so no indicators only the difference equation.
Have you an exemple???
Hi
See the price of a index as a signal or better as a discreet signal (equal intervals in time).
With DSP (Digital Signal Processing) you will be able to discover the characteristics of the signal.. is it lineair?, is it time invariant?, etc.
When you know this you can describe the signal by a difference equation and that equation is the basis of your trading system.
Hello @ jebus89,
I am also pursuing a similar diserfication. That’s why I have several systems running with the same inputs but different trend filters in the same time unit. Do you remember our conversation? I have found that the same basic system with different trend filters also causes good diserfication. I also think it’s extremely important that TP is always larger than SL. No matter how good the hit rate appears in the backtest. That seems to make a system more robust in sideways phases. (Consolidation) Since I also use a kind of momentum strategy … which indicator did you base your strategies on?
@phoentzs
Hello! I think the TP and SL needs to match your strategy. For me its been bigger TP than SL on all my strategies EXCEPT for my mean reversion strategies. Im a much bigger trend following person however.
Same strategy, but with different filters, i can see how it could work. For me I do run a couple of “same strategies” on same markets, but im doing it with trailing stop loss and without trailing stop loss. Im still unsure about trailing stop losses and how much more curvefit they make the strategy, so im running both at the moment to see.
My strategies are based on all kinds of indicators. MACD, bollingerbands, moving average, RSI, OHLC and everything in between. I try to keep all my strategies as simple as possible with as few variables as possible.
Sorry about late reply, i have had a bad back for about a month now 🙁 However im much better now and back at it 🙂
My trading journey so far and how i created my portfolio
This topic contains 10 replies,
has 8 voices, and was last updated by jebus89
4 years, 6 months ago.
| Forum: | General Trading: Market Analysis & Manual Trading |
| Language: | English |
| Started: | 05/21/2021 |
| Status: | Active |
| Attachments: | 1 files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.