Overall Statistics |
Total Orders 523 Average Win 3.46% Average Loss -1.64% Compounding Annual Return 15.200% Drawdown 25.500% Expectancy 0.516 Start Equity 100000.00 End Equity 192318.97 Net Profit 92.319% Sharpe Ratio 0.59 Sortino Ratio 0.648 Probabilistic Sharpe Ratio 22.549% Loss Rate 51% Win Rate 49% Profit-Loss Ratio 2.10 Alpha 0.028 Beta 0.738 Annual Standard Deviation 0.155 Annual Variance 0.024 Information Ratio 0.064 Tracking Error 0.094 Treynor Ratio 0.124 Total Fees $314.53 Estimated Strategy Capacity $140000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X Portfolio Turnover 9.97% |
# 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', Resolution.HOUR) self._btc.bb = self.bb(self._btc.symbol, 30*24, 2) 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)