Overall Statistics
Total Trades
74
Average Win
0.43%
Average Loss
-0.45%
Compounding Annual Return
14.709%
Drawdown
3.500%
Expectancy
0.221
Net Profit
3.686%
Sharpe Ratio
1.498
Probabilistic Sharpe Ratio
60.808%
Loss Rate
38%
Win Rate
62%
Profit-Loss Ratio
0.96
Alpha
0.079
Beta
0.356
Annual Standard Deviation
0.055
Annual Variance
0.003
Information Ratio
0.973
Tracking Error
0.075
Treynor Ratio
0.231
Total Fees
$85.67
Estimated Strategy Capacity
$57000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
# Enter if price > yest close exit EOD


class EmotionalFluorescentPinkSalmon(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 7, 1)
        self.SetEndDate(2021, 10, 5)
        self.SetCash(100000)
        self.stock = self.AddEquity("SPY", Resolution.Minute).Symbol
        self.SetWarmUp(1, Resolution.Daily)
        self.yest_close = self.SMA(self.stock, 1, Resolution.Daily, Field.Close)
        

    def OnData(self, data):
        
        if self.IsWarmingUp or not self.yest_close.IsReady or not len(data.Bars) > 0: return 
     
        if self.Time.hour == 9 and self.Time.minute == 45:
            price = self.Securities[self.stock].Price
            yest_close = self.yest_close.Current.Value
            
            self.Plot("Indicator", "yest close", yest_close)
            self.Plot("Indicator", "price", price)
            
            if price > yest_close and not self.Portfolio.Invested:
                self.SetHoldings(self.stock, 1)
        
        if self.Time.hour == 15 and self.Time.minute == 45:
            self.Liquidate(self.stock)