Overall Statistics
Total Trades
10
Average Win
10.16%
Average Loss
-4.73%
Compounding Annual Return
-17.836%
Drawdown
28.900%
Expectancy
-0.371
Net Profit
-9.329%
Sharpe Ratio
-0.362
Probabilistic Sharpe Ratio
11.935%
Loss Rate
80%
Win Rate
20%
Profit-Loss Ratio
2.15
Alpha
-0.042
Beta
0.548
Annual Standard Deviation
0.265
Annual Variance
0.07
Information Ratio
0.011
Tracking Error
0.258
Treynor Ratio
-0.175
Total Fees
$52.37
Estimated Strategy Capacity
$11000000.00
Lowest Capacity Asset
BGU U7EC123NWZTX
# region imports
from AlgorithmImports import *
# endregion

class DeterminedApricotSalmon(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2022, 3, 3)
        self.SetEndDate(2022, 8, 31) 
        self.SetCash(100000)  # Set Strategy Cash
        self.spxl = self.AddEquity("SPXL", Resolution.Daily)
        self.AddEquity("SPY", Resolution.Daily)
        self.AddEquity("UVXY", Resolution.Daily)
        self.sma = self.SMA("SPY", 200, Resolution.Daily, Field.Close)
        overlayPlot = Chart("Overlay Plot")
        overlayPlot.AddSeries(Series("SPY", SeriesType.Line, 0))
        overlayPlot.AddSeries(Series("SMA", SeriesType.Line, 0))
        
        self.AddChart(overlayPlot)

    def OnEndOfDay(self, symbol):
        mavg = self.sma.Current.Value
        if not self.Portfolio.Invested:
            if (self.Securities["SPY"].Close > mavg):
                #self.Liquidate("SPY")
                self.SetHoldings("SPXL", 1.0)
                #self.SetHoldings("UVXY", .2)

        elif self.Portfolio.Invested:
            if (self.Securities["SPY"].Close <= mavg):
                #self.SetHoldings("SPY", 1.0)
                self.SetHoldings("SPXL", 0)
                #self.Liquidate("UVXY")
        self.Plot("Overlay Plot", "SPY", self.Securities["SPY"].Close)
        self.Plot("Overlay Plot", "SMA", mavg)