Overall Statistics
Total Trades
334
Average Win
0.52%
Average Loss
-0.35%
Compounding Annual Return
8.101%
Drawdown
20.700%
Expectancy
1.434
Net Profit
273.829%
Sharpe Ratio
0.831
Probabilistic Sharpe Ratio
17.389%
Loss Rate
2%
Win Rate
98%
Profit-Loss Ratio
1.48
Alpha
0.03
Beta
0.341
Annual Standard Deviation
0.07
Annual Variance
0.005
Information Ratio
-0.221
Tracking Error
0.113
Treynor Ratio
0.169
Total Fees
$338.57
Estimated Strategy Capacity
$6300000.00
Lowest Capacity Asset
VBR SVS2QA8SPHET

class RSITrendAlgorithm(QCAlgorithm):

    def Initialize(self):
        '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''

        self.SetStartDate(2005, 1, 1)  # Set Start Date
        #self.SetEndDate(2018, 1, 1)  # Set Start Date
        
        self.SetCash(100000)             #Set Strategy Cash
        self.spy=self.AddEquity("SPY", Resolution.Daily)
        self.tlt=self.AddEquity("TLT", Resolution.Daily)
        self.shy=self.AddEquity("SHY", Resolution.Daily)
        self.gld=self.AddEquity("GLD", Resolution.Daily)
        self.vbr=self.AddEquity("VBR", Resolution.Daily)
        
        self.SetBenchmark("SPY")
        
    def OnData(self, data):
        
        if not self.Portfolio.Invested:
            
            self.SetHoldings([PortfolioTarget("SPY", 0.2), 
            PortfolioTarget("TLT", 0.2),
            PortfolioTarget("SHY", 0.2),
            PortfolioTarget("GLD", 0.2),
            PortfolioTarget("VBR", 0.2)
            ])
            
        if data.Dividends.ContainsKey("SPY"):
            self.SetHoldings([PortfolioTarget("SPY", 0.2), 
            PortfolioTarget("TLT", 0.2),
            PortfolioTarget("SHY", 0.2),
            PortfolioTarget("GLD", 0.2),
            PortfolioTarget("VBR", 0.2)
            ])