Overall Statistics |
Total Trades 641 Average Win 0.35% Average Loss -0.24% Compounding Annual Return 5.149% Drawdown 4.100% Expectancy 0.437 Net Profit 37.284% Sharpe Ratio 0.89 Probabilistic Sharpe Ratio 35.039% Loss Rate 42% Win Rate 58% Profit-Loss Ratio 1.50 Alpha 0.037 Beta 0 Annual Standard Deviation 0.041 Annual Variance 0.002 Information Ratio -1.755 Tracking Error 0.621 Treynor Ratio -93.307 Total Fees $5680.41 Estimated Strategy Capacity $14000000.00 |
class RegressionChannelModel(QCAlgorithm): def Initialize(self): self.SetStartDate(2015, 1, 1) self.SetCash(100000) self.SetPortfolioConstruction(InsightWeightingPortfolioConstructionModel()) self.SetExecution(ImmediateExecutionModel()) self.SetBrokerageModel(BitfinexBrokerageModel()) self.UniverseSettings.Resolution = Resolution.Daily data = self.AddCrypto('ETHUSD', Resolution.Daily, Market.Bitfinex) self.symbol = data.Symbol self.RegressionChannel = self.RC(self.symbol, 20, Resolution.Daily) def OnData(self, data): if not self.symbol in data: return price = data[self.symbol].Value if price == 0: return count = 0 rc = self.RegressionChannel delta = (((rc.LinearRegression.Current.Value - price) / rc.LinearRegression.Current.Value) * 100) if rc.IsReady: if rc.LinearRegression.Current.Value > price and rc.Slope.Current.Value > 0 and delta > 0.5: count += 1 #self.Debug(f'Price: {price}, Regression: {rc.LinearRegression.Current.Value}, Delta: {delta}, Slope: {rc.Slope.Current.Value}') else: self.Liquidate() self.EmitInsights(Insight.Price(self.symbol, timedelta(days = 1), InsightDirection.Flat, None, None, None, 1)) return weight = (0.1 * count) self.EmitInsights(Insight.Price(self.symbol, timedelta(days = 1), InsightDirection.Up, None, None, None, weight))