Overall Statistics |
Total Orders 523 Average Win 3.46% Average Loss -1.64% Compounding Annual Return 15.952% Drawdown 25.500% Expectancy 0.516 Start Equity 100000.00 End Equity 198914.87 Net Profit 98.915% Sharpe Ratio 0.622 Sortino Ratio 0.683 Probabilistic Sharpe Ratio 24.876% Loss Rate 51% Win Rate 49% Profit-Loss Ratio 2.10 Alpha 0.03 Beta 0.738 Annual Standard Deviation 0.155 Annual Variance 0.024 Information Ratio 0.065 Tracking Error 0.094 Treynor Ratio 0.13 Total Fees $314.53 Estimated Strategy Capacity $150000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X Portfolio Turnover 9.92% |
# region imports from AlgorithmImports import * # endregion class BitcoinAsALeadingIndicatorAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2020, 1, 1) self.set_cash(100000) self.settings.automatic_indicator_warm_up = True self._equity = self.add_equity('SPY') self._btc = self.add_crypto('BTCUSD') self._btc.bb = self.bb(self._btc.symbol, 30*24, 2, resolution=Resolution.HOUR) self._btc.bb.updated += self._trade self.plot_indicator("BB", self._btc.bb.upper_band, self._btc.bb.lower_band, self._btc.bb) def _trade(self, indicator, indicator_data_point): below_band = self._btc.price < self._btc.bb.lower_band.current.value if below_band and self.portfolio.invested: self.liquidate() elif not below_band and not self.portfolio.invested: self.set_holdings(self._equity.symbol, 1)