Overall Statistics
Total Trades
820
Average Win
0.07%
Average Loss
-1.82%
Compounding Annual Return
0%
Drawdown
458.400%
Expectancy
-0.866
Net Profit
-458.443%
Sharpe Ratio
-0.092
Probabilistic Sharpe Ratio
0.029%
Loss Rate
87%
Win Rate
13%
Profit-Loss Ratio
0.04
Alpha
-3.77
Beta
6.907
Annual Standard Deviation
10.82
Annual Variance
117.082
Information Ratio
-0.13
Tracking Error
10.818
Treynor Ratio
-0.145
Total Fees
$820.00
Estimated Strategy Capacity
$350000.00
Lowest Capacity Asset
SNDE VOAMLVK3W485
class FocusedGreenDonkey(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 10, 12)
        self.SetCash(100000) 
        
        self.AddUniverse(self.MyCoarseFilterFunction)
        self.symbolDataBySymbol = {}
    def MyCoarseFilterFunction(self,coarse):
        StocksUnder10 = [c for c in coarse if c.Price<10]
        symbols = [c.Symbol for c in StocksUnder10 if c.Symbol not in self.symbolDataBySymbol]
        history = self.History(symbols, 252, Resolution.Daily)
        
        if not history.empty:
            history = history.close.unstack(0)
            for symbol in symbols:
                if str(symbol) not in history:
                    continue

                df = history[symbol].dropna()
                if not df.empty:
                    self.symbolDataBySymbol[symbol] = SymbolData(self, symbol, df)
        
        
        for x in coarse:
            symbol = x.Symbol
            if symbol in self.symbolDataBySymbol:
                self.symbolDataBySymbol[symbol].Update(x.EndTime, x.AdjustedPrice)
        selectedSymbols = [symbol for symbol, symbolData in self.symbolDataBySymbol.items() if symbolData.HasNewMax and symbolData.rsi.Current.Value>80]
        return selectedSymbols
    def OnData(self, data):
        pass
    
    
    def OnSecuritiesChanged(self, changes):
        
        for security in changes.AddedSecurities:
            symbol = security.Symbol
            self.MarketOrder(symbol, 100)
            
        for security in changes.RemovedSecurities:
            symbol = security.Symbol
            self.Liquidate(symbol)
class SymbolData:
    
    def __init__(self, algorithm, symbol, history):
        self.symbol = symbol
        
        self.max = Maximum(252)
        self.rsi = RelativeStrengthIndex(10, MovingAverageType.Simple)
        self.maxWindow = RollingWindow[IndicatorDataPoint](2)
        
        self.max.Updated += self.OnMax
        
        for time, close in history.iteritems():
            self.Update(time, close)

        
    def OnMax(self, sender, updated):
        if self.max.IsReady:
            self.maxWindow.Add(updated)
            
    def Update(self, time, close):
        self.max.Update(time, close)
        self.rsi.Update(time,close)
        
    @property
    def HasNewMax(self):
        if self.maxWindow.IsReady:
            return self.maxWindow[0] > self.maxWindow[1]
        else:
            return False