Overall Statistics
Total Trades
2
Average Win
2.15%
Average Loss
0%
Compounding Annual Return
4.320%
Drawdown
0.700%
Expectancy
0
Net Profit
2.154%
Sharpe Ratio
1.599
Probabilistic Sharpe Ratio
69.080%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
0.036
Beta
-0.001
Annual Standard Deviation
0.022
Annual Variance
0.001
Information Ratio
0.037
Tracking Error
0.414
Treynor Ratio
-39.99
Total Fees
$3.10
class DynamicHorizontalAutosequencers(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 12, 30)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash

        self.SetExecution(ImmediateExecutionModel())

        self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel(lambda time: None))

        symbols = [ Symbol.Create("SPY", SecurityType.Equity, Market.USA) ]
        self.SetUniverseSelection( ManualUniverseSelectionModel(symbols) )
        self.UniverseSettings.Resolution = Resolution.Daily
        
        self.AddAlpha(MyAlphaModel(symbols[0]))


class MyAlphaModel(AlphaModel):
    def __init__(self, symbol):
        self.symbol = symbol
        self.calls = 0
        
    def Update(self, algorithm, slice):
        if not slice.ContainsKey("SPY"):
            return []
            
        self.calls += 1
            
        if self.calls == 1:
            return [Insight.Price("SPY", timedelta(days=30), InsightDirection.Up)]
        
        if self.calls == 10:
            #algorithm.Liquidate(self.symbol)
            return [Insight.Price("SPY", timedelta(days=30), InsightDirection.Flat)]
        
        return []