Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
-0.012%
Drawdown
0.000%
Expectancy
0
Net Profit
-0.001%
Sharpe Ratio
-0.332
Probabilistic Sharpe Ratio
33.884%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0
Beta
-0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-0.503
Tracking Error
0.154
Treynor Ratio
3.494
Total Fees
$1.00
Estimated Strategy Capacity
$200000000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
class TradierEquitiesStochAlpha(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 1, 1)
        self.SetEndDate(2021, 2, 1)
        self.SetCash(100000)
        self.AddEquity("SPY", Resolution.Daily, Market.USA)
       # self.SetBrokerageModel(BrokerageName.TradierBrokerage) 
        self.sto = self.STO("SPY", 14)
        
        self.sell_price = None
    '''
    update things to standard value (liquidate,HasInvested)
    '''
    def OnData(self, data):
        
        if not self.sto.IsReady: 
            return
        self.Debug(str(self.sto.Current.Value)+" "+str(self.Time))
        price = self.Securities["SPY"].Close
        if not self.Portfolio["SPY"].Invested  :
            if self.sto.Current.Value < 30 :
              self.Debug("Daily SPY STO is < 30")
              self.MarketOrder("SPY",1)
              self.Debug(f"Market order was placed for 95% of protfolio in SPY")
              self.sell_price = (1 + 0.05) * price
            
   
  
        
        if self.sell_price is not None and price >= self.sell_price  and self.Portfolio["SPY"].Invested :
            self.Debug("SPY sold at a 5% gain or more")
           # self.MarketOrder("SPY", -self.Portfolio.CashBook["SPY"].Amount)
            self.MarketOrder("SPY",-1)
            self.sell_price = None
            
        #if self.sell_price is not None and price <= self.sell_price * .95:
            #self.Debug("Price dropped 5%")
            #self.MarketOrder(self.symbol, -self.Portfolio.CashBook["ETH"].Amount)
            #self.sell_price = None