Overall Statistics
Total Trades
248
Average Win
0.86%
Average Loss
-0.40%
Compounding Annual Return
7.340%
Drawdown
11.500%
Expectancy
0.259
Net Profit
15.282%
Sharpe Ratio
0.472
Probabilistic Sharpe Ratio
17.219%
Loss Rate
60%
Win Rate
40%
Profit-Loss Ratio
2.16
Alpha
0.066
Beta
-0.006
Annual Standard Deviation
0.123
Annual Variance
0.015
Information Ratio
-2.245
Tracking Error
0.572
Treynor Ratio
-10.178
Total Fees
$0.00
Estimated Strategy Capacity
$100000.00
Lowest Capacity Asset
XLMUSD E3
class CreativeRedHornet(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2021, 1, 1)
        self.SetCash(100000)
        
        self.Settings.FreePortfolioValuePercentage = 0.05
        self.positionSizeUSD = 5000
        self.rsiEntryThreshold = 70 # enter position if rsi rises above this threshold
        self.rsiExitThreshold = 60 # exit position if rsi drops below this threshold
        self.minimumVolume = 1000000 # filters out symbols with 30 day avg daily dollar volume less than this 
        
        # add data for all tickers
        universe = ['BTCUSD', 'LTCUSD', 'ETHUSD', 'ETCUSD', 'RRTUSD', 'ZECUSD', 'XMRUSD', 'XRPUSD', 'EOSUSD', 'SANUSD', 'OMGUSD', 'NEOUSD', 'ETPUSD', 'BTGUSD', 'SNTUSD', 'BATUSD', 'FUNUSD', 'ZRXUSD', 'TRXUSD', 'REQUSD', 'LRCUSD', 'WAXUSD', 'DAIUSD', 'BFTUSD', 'ODEUSD', 'ANTUSD', 'XLMUSD', 'XVGUSD', 'MKRUSD', 'KNCUSD', 'LYMUSD', 'UTKUSD', 'VEEUSD', 'ESSUSD', 'IQXUSD', 'ZILUSD', 'BNTUSD', 'XRAUSD', 'VETUSD', 'GOTUSD', 'XTZUSD', 'MLNUSD', 'PNKUSD', 'DGBUSD', 'BSVUSD', 'ENJUSD', 'PAXUSD']
        self.pairs = [ Pair(self, ticker, self.minimumVolume) for ticker in universe ]
        self.SetBenchmark("BTCUSD") 
        self.SetWarmup(30)
 
    def OnData(self, data):
        
        for pair in self.pairs: 
            if not pair.rsi.IsReady:
                return
            
            symbol = pair.symbol
            rsi = pair.rsi.Current.Value 
            
            if self.Portfolio[symbol].Invested:
                if not pair.Investable():
                    self.Liquidate(symbol, "Not enough volume")
                elif rsi < self.rsiExitThreshold:
                    self.Liquidate(symbol, "RSI below threshold")
                continue
            
            if not pair.Investable():
                continue
            
            if rsi > self.rsiEntryThreshold and self.Portfolio.MarginRemaining > self.positionSizeUSD:
                self.Buy(symbol, self.positionSizeUSD / self.Securities[symbol].Price)

class Pair:
    def __init__(self, algorithm, ticker, minimumVolume): 
        self.symbol = algorithm.AddCrypto(ticker, Resolution.Daily, Market.Bitfinex).Symbol
        self.rsi    = algorithm.RSI(self.symbol, 14,  MovingAverageType.Simple, Resolution.Daily)
        self.volume = IndicatorExtensions.Times(algorithm.SMA(self.symbol, 30, Resolution.Daily, Field.Volume), 
                                                algorithm.SMA(self.symbol, 30, Resolution.Daily, Field.Close))
        self.minimumVolume = minimumVolume
    
    def Investable(self):
        return (self.volume.Current.Value > self.minimumVolume)