Overall Statistics
Total Trades
318
Average Win
1.60%
Average Loss
-1.13%
Compounding Annual Return
13.803%
Drawdown
25.600%
Expectancy
0.557
Net Profit
170.670%
Sharpe Ratio
0.762
Probabilistic Sharpe Ratio
20.565%
Loss Rate
36%
Win Rate
64%
Profit-Loss Ratio
1.42
Alpha
0.07
Beta
0.346
Annual Standard Deviation
0.136
Annual Variance
0.019
Information Ratio
0.033
Tracking Error
0.161
Treynor Ratio
0.3
Total Fees
$3618.57
Estimated Strategy Capacity
$1900000.00
Lowest Capacity Asset
BIL TT1EBZ21QWKL
Portfolio Turnover
3.33%
from AlgorithmImports import *
from datetime import datetime, timedelta

class CustomDataWeighAlgorithm(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2016,1, 1)
      #  self.SetEndDate(2020,5, 1)
        self.SetCash(100000)
        self.symbols = "SPY", "SPXL", "UVXY", "SSO","BIL","TQQQ","QLD","USD","SOXL"
        self.rsi = {}
        self.bil_holdings = 0
        self.uvxy_holdings = 0
        self.sso_holdings = 0
        self.qld_holdings = 0
        self.usd_holdings = 0
        for symbol in self.symbols:
            equity = self.AddEquity(symbol, Resolution.Daily)
            self.rsi[symbol] = self.RSI(equity.Symbol, 10)
    def OnData(self, data):
        if not self.rsi["SPXL"].IsReady:
            return
        if self.rsi["SPXL"].Current.Value > 80:
            if self.uvxy_holdings == 0:
                self.uvxy_holdings += 0.30
                self.SetHoldings("UVXY", self.uvxy_holdings)
        elif self.rsi["SPXL"].Current.Value < 30:
            if self.sso_holdings == 0:
                self.sso_holdings += 0.30
                self.SetHoldings("SSO", self.sso_holdings)
        else:
            if self.uvxy_holdings > 0:
                self.Liquidate("UVXY")
                self.uvxy_holdings = 0
            if self.sso_holdings > 0:
                self.Liquidate("SSO")
                self.sso_holdings = 0
            self.bil_holdings += 0.30
            self.SetHoldings("BIL", self.bil_holdings)
        if not self.rsi["TQQQ"].IsReady:
            return
        if self.rsi["TQQQ"].Current.Value > 80:
            if self.uvxy_holdings == 0:
                self.uvxy_holdings += 0.30
                self.SetHoldings("UVXY", self.uvxy_holdings)
        elif self.rsi["TQQQ"].Current.Value < 30:
            if self.qld_holdings == 0:
                self.qld_holdings += 0.30
                self.SetHoldings("QLD", self.qld_holdings )
        else:
            if self.uvxy_holdings > 0:
                self.Liquidate("UVXY")
                self.uvxy_holdings = 0
            if self.qld_holdings > 0:
                self.Liquidate("QLD")
                self.qld_holdings = 0
            self.bil_holdings += 0.30
            self.SetHoldings("BIL", self.bil_holdings)
        if not self.rsi["SOXL"].IsReady:
            return
        if self.rsi["SOXL"].Current.Value < 30:
            if self.usd_holdings == 0:
                self.usd_holdings += 0.30
                self.SetHoldings("USD", self.usd_holdings)
        else:
            if self.usd_holdings > 0:
                self.Liquidate("USD")
                self.usd_holdings = 0
            self.bil_holdings += 0.30
            self.SetHoldings("BIL", self.bil_holdings)