Overall Statistics
Total Trades
701
Average Win
0.40%
Average Loss
-0.71%
Compounding Annual Return
15.260%
Drawdown
32.600%
Expectancy
0.407
Net Profit
457.065%
Sharpe Ratio
0.998
Probabilistic Sharpe Ratio
40.392%
Loss Rate
10%
Win Rate
90%
Profit-Loss Ratio
0.57
Alpha
0.137
Beta
-0.035
Annual Standard Deviation
0.135
Annual Variance
0.018
Information Ratio
0.201
Tracking Error
0.224
Treynor Ratio
-3.818
Total Fees
$710.78
### <summary>
### All Weather Strategy (Dalio)
### https://www.iwillteachyoutoberich.com/blog/all-weather-portfolio/
### </summary>>


class AllWeatherStrategy(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2008, 1, 1)  
        self.SetEndDate(2020, 1, 31)  
        self.SetCash(100000) 
        self.monthCounter = 0
        
        self.etfs = [
            (self.AddEquity('SPY', Resolution.Daily).Symbol,0.3),   #S&P 500
            (self.AddEquity('TLT', Resolution.Daily).Symbol,0.4),   #iShares 20+ Year Treasury ETF (TLT) / EU alternative: IS04 https://www.ishares.com/de/privatanleger/de/produkte/272124/ishares-usd-treasury-bond-20-yr-ucits-etf
            (self.AddEquity('IEF', Resolution.Daily).Symbol,0.15),  #iShares 7 – 10 Year Treasury ETF (IEF) / EU alternative: IBTM https://www.ishares.com/uk/individual/en/products/251716/ishares-treasury-bond-710yr-ucits-etf
            (self.AddEquity('GLD', Resolution.Daily).Symbol,0.075), #SPDR Gold Shares ETF (GLD),  #SPDR Gold Shares (GLD)  / EU alternative: IS0E https://www.ishares.com/de/privatanleger/de/produkte/251908/ishares-gold-producers-ucits-etf
            (self.AddEquity('VPU', Resolution.Daily).Symbol,0.075)  #Vanguard Utilities Index Fund ETF  / EU alternative: IUUS https://www.ishares.com/uk/individual/en/products/287115/ishares-s-p-500-utilities-sector-ucits-etf-fund 
            ]
        self.Schedule.On(self.DateRules.MonthStart(self.etfs[0][0]), self.TimeRules.AfterMarketOpen(self.etfs[0][0]), self.Rebalance)
        self.leverage = 2
     
    def Rebalance(self):
        self.SetHoldings([PortfolioTarget(etf,target*self.leverage) for etf,target in self.etfs])