My trading journey so far and how i created my portfolio

Forums ProRealTime English forum General trading discussions My trading journey so far and how i created my portfolio

Viewing 11 posts - 1 through 11 (of 11 total)
  • #170119

    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:

    • Momentum algorithms tend to go into drawdown when new highs dont result in new trends/swing higher, which typicly happens after a big trend/swing up, as the market pauses/goes into consolidation. If the market just dips down a little then swings up again, your mean reverting algorithms should make up for the losses from the momentum algorithms.
    • If however the market turns sharply down after reaching new highs then you will most likely experience a drawdown in both your mean reverting and your momemtun algorithms. This is when your tail-losses/biggest losses occur and this is what you need to be the most afraid of.
    • It really gets the darkest before it turns brighter, do not turn off algorithms just because they are in a drawdown. My biggest losses have all been accompanied by my biggest winners. When investing long term buy’n’hold, if you miss out on the top 10 days your investment will suffer greatly, same goes for algorithms in my experience. Make sure your portfolio makes money, even if its small money, when your biggest losses happen in your backtests. This will help your mental game alot.
    • Exporting backtest data into excel to study the graphs of different algos can give much needed help and clues as to how 2 different algorithms work together.
    • Treat each algorithm as a seperate investing object. Look at the maximum drawdown from the backtest, add a little bit to that and put that max drawdown together with all the other max drawdowns in your portfolio. If they all hit their max drawdowns at the same time, would it ruin your account? If the answer is yes, you need to make DAMN SURE that they will never hit at the same time. If they start going into huge drawdowns at the same time its alot easier to turn off the algorithms which could be a disaster.
    • You can create sub-portfolios such as a mix of your most un-correlated algorithms running on a seperate account to keep the drawdown at a minimum, allowing you to buy even more contracts on the same strategies without experiencing the potential drawdown of running more strategies in that portfolio. Personally i havnt gotten this far just yet, but im looking into it as we speak.
    • For me, looking at the average monthly expected return from 1 algorithm is not as helpful as looking at quarterly results. You have to expect drawdowns on all algorithms in 1 month, unless you have some very good short term algorithms at least. Quarterly numbers even out the numbers more, and this makes things easier when comparing the different backtests of different algorithms.
    • What is the risk of all the algorithms going into a deep drawdown at the same time? For example I run mostly Long only in stock indices. And as we all know, most stock indicies are very correlated. You would therefore assume that if “all markets” are down -0.5% you would most likely be down on your total equity, but this is not always the case. A 15 min algorithm might spot an amazing trade during the night/day. Even if the market ends -0.5% it dosnt mean it couldnt have been +1% at some point. I might have lost 2-3 trades on the 1h algorithms, but i might have made back all those losses on the 15-30m algorithms. How your algorithm trades and at what timeframe it trades might have a huge impact on your portfolio when adding the algorithm. Dont assume that a Long only momentum 15m algorithm and  a Long only momentum 1h algorithm are 100% correlated.
    • Even running an algorithm that produces a net 0 in the long run could theorieticly be worth running as long as it covers its own costs of trading in the long run and can help diversify your 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!

    Total of 12 users thanked author for this post. Here are last 10 listed.
    #170260

    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!

    #170277

    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:

    • I want to test a theory, im not throwing stuff to check what sticks.
    • If i include any piece of code into my algo I want to be 100% sure that it should be included. I dont want to add anything that does minor improvement and/or dosnt make sense to add.
    • I dont like big spikes in backtests, thats usually cherry piced trades from optimizing.
    • I love this quote, i cannot remember who said it tho, was on a trading podcast: “You want your algorithm to fit like a mitten instead of a glove” and this is honestly the best advice i can give as well. This sentence just speaks to my algo-heart. You want a bunch of losing trades! You want to see that equity curve take a few hits. If it never does then its curvefit most likely.
    • I want many trades. Theres no exact number for me, but when im looking at a 1h backtest from 2006 -> 2021 i want to see as many as 1000 trades or close to it.
    • Robustness > profit. I wont add stuff that make my equity curve better if i feel that i make my algorithm less robust. This can be for example trailing stop losses or other filters/code.
    • Walk forward is great to test robustness
    #170299

    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

    #170308

    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.

    #172143

    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

    #172542
    JS

    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:

    • Linear relation between input and output
    • Time invariance, so in different timeframes the same respons!
    #172547

    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???

    #172550
    JS

    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.

     

    #172624

    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?

    #174909

    @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 🙂

Viewing 11 posts - 1 through 11 (of 11 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login