• H-Barrio

Your Life In Overdrive

Actualizado: 18 de sep de 2020

Our traditionalist robot advisor was effective and boring. What if we override its risk protocols and allow for some leverage in our model? It goes against the traditional wisdom directives, do not spend more than you have. In this case we are going to disregard this one advice and see what happens when we combine two antagonistic pieces of advice.


We are impatient, we want to increase our wealth as fast as possible, we believe life is short and want to retire very early and with a good amount of money. Still, we will start slow on the insistent advice of our robot: with a leverage of x1.5. We do not have to do much to our previous model to simulate this:

class YourLife(QCAlgorithm):

    def Initialize(self):
        self.start = datetime(2002, 9, 1)
        # Your initial age in 2002: 
        self.INITIAL_AGE = 35
        self.SetStartDate(self.start)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.AddEquity("SPY", Resolution.Daily)
        self.AddEquity("TLT", Resolution.Daily)
        self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage,
                               AccountType.Margin)
                               
        self.Securities["SPY"].MarginModel =  PatternDayTradingMarginModel()
        self.Securities["TLT"].MarginModel =  PatternDayTradingMarginModel()
        self.leverage = 1.5

    def OnData(self, data):
        
        # Your age since simulation start, in days and years:
        your_age = (self.Time - self.start).days
        your_years = (your_age/365) + self.INITIAL_AGE        
        ratio = ((100 - your_years)/100) 
        
        self.SetHoldings('SPY', ratio * self.leverage)
        safe_ratio = ((1-ratio) )
        self.SetHoldings('TLT', safe_ratio * self.leverage)

We transform our cash account to a margin account. With this type of account we can set a leverage value to multiply our available funds. We are telling to our robotic advisor that each day it should re-balance our positions according to traditional stocks/bond ratio according to our age, and then multiply those ratios by the leverage, 1.5 in this initial case. Our broker will charge as required for these extra funds, and as our equity positions are being used as collateral they will be subjected to margin calls. If our leverage is large enough and our stock and bonds holdings drop too low, we can end up with a portfolio value of 0 and in extreme cases even end up owing more money than we deposited into our broker.


With a x1.5 leverage, we end our simulation period of 2002 to 2020 with a little bit more money than in the cash only model:


This was our x1 leverage model from our previous post:


All movements are magnified, and we are a little bit less effective in terms of Sharpe ratio. Our traditionalist robot advisor is selecting, from folklore, uncorrelated assets and these are behaving as expected under a x1.5 leverage. The maximum draw down is 42%, a lot more than without leverage. This is the most interesting part of the 2002 to 2020 period:

In a period of 12 months our wealth is reduced to 2002 levels in 2009, it could be considered too much of a hit to continue using the model, the effect is in relative terms very similar to what happened without any leverage, but in absolute terms the psychological impact is twice as large. Going through this ordeal sets us up 500K USD at the end of the period, more reward, more suffering. These are the draw-down profiles with 1.5 leverage:

We seem to be in the right track, we will disregard these losses, we have iron hands and can hold hot lead in them, so we increase our leverage to almost 2, 1.95. We will use 1.95 as usually the leverage limit for retail traders for inter-day positions is 2 as a maximum. If we set the leverage to 2 and generate operations that are to be filled at market open the next day we may exceed the limits a have our orders partially filled or not filled at all.

Nothing out of the ordinary. Now we are making very good money in the period, we turn 100K USD into 2M USD, going through similarly painful draw-down periods. The risk-reward profile of the traditional model is maintained and our gains and losses are magnified without margin calls or ruin. It is interesting to see how the COVID19 crisis dents our wealth:


Remember that at this point in time we are 53 years old and lean towards bonds more than to stocks, the draw-down periods are becoming shallow as we move forward in time.


We see this leverage and see that it is good, how much further can we go as retail investors? The normal maximum leverage point for regular individual traders and small firms is an intraday 4x through US pattern day trading. To qualify for this maximum 4x we will be forced to liquidate our holdings at the end of the day, re-balance at market open and sleep well as our positions will not change in value overnight. We will have to pay the full re-balancing, sell everything, buy everything every day. We need to move our algorithm to minute resolution data and control for the opening and closing times of the market in order to place our operations in good order:

class YourLife(QCAlgorithm):

    def Initialize(self):
        self.start = datetime(2002, 9, 1)
        # Your initial age in 2002: 
        self.INITIAL_AGE = 35
        self.SetStartDate(self.start)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.AddEquity("SPY", Resolution.Minute)
        self.AddEquity("TLT", Resolution.Minute)
        self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage,
                               AccountType.Margin)

        self.Securities["SPY"].MarginModel =  PatternDayTradingMarginModel()
        self.Securities["TLT"].MarginModel =  PatternDayTradingMarginModel()
        self.leverage = 3.95

    def OnData(self, data):
        
        # Your age since simulation start, in days and years:
        your_age = (self.Time - self.start).days
        your_years = (your_age/365) + self.INITIAL_AGE        
        ratio = ((100 - your_years)/100)

        time_table = self.Securities["SPY"].Exchange.Hours
        next_close = time_table.GetNextMarketClose(self.Time, False)
        next_open =  time_table.GetNextMarketOpen(self.Time - timedelta(days=1), False)

        if self.Time == next_open + timedelta(minutes=3):
            self.SetHoldings('SPY', ratio * self.leverage)

        if self.Time == next_open + timedelta(minutes=5):
            safe_ratio = ((1-ratio) )
            self.SetHoldings('TLT', safe_ratio * self.leverage)

        if self.Time == next_open - timedelta(minutes=3):
            self.Liquidate()

In this case, you lost almost all your money, the broker takes it for themselves, it will be mostly unfavorable margin calls and too many operations with too much margin:


We can still try something to simulate this 4x without pattern day trading but paying leveraged ETF fees, we can use our 2x (1.95x) model with, for example: UBT and SPUU. Both will offer a 2x leverage on their tracked assets, long term bonds and SPY index. These products are new, generated around or after the subprime mortgage crisis, so we will move our model to 2014 and set our age at 50. We will have our share of bull market and crisis in this shorter period too:


The results are not bad, we are able to replicate 2x results with 2x products, at the cost of the ETF fees. This may not be very significative as we enter the market at 4x in the middle of a bull market period, we go through the crisis and recover quickly, we are 56 at this point in 2020 and leaning to bonds.


So, we can conclude timidly (these experiments may not be sufficient, statistically speaking) that moderate leverage with properly managed diversification risk can help grow our equity and will always result in larger, more worrisome draw-down periods. Proper management of risk beyond the traditional lore and a little bit more of signal control could produce very good wealth preservation trading models for individuals. Further tricks (options substitutions for example) will be investigated in the future to obtain better balanced models beyond the stocks-bond by age model.


Remember that our publications are not financial advice. Ostirion.net does not hold any positions on any of the mentioned instruments at the time of publication. If you need further information, asset management support, automated trading strategy development or tactical strategy deployment you can contact us here.

12 vistas0 comentarios

Entradas Recientes

Ver todo

© 2019 Ostirion

-Trabajo honesto, precision matematica-