Overall Statistics |
Total Orders 6 Average Win 0% Average Loss -0.01% Compounding Annual Return -0.282% Drawdown 0.000% Expectancy -1 Start Equity 100000 End Equity 99993.29 Net Profit -0.007% Sharpe Ratio -7.731 Sortino Ratio -9.976 Probabilistic Sharpe Ratio 26.252% Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.005 Beta 0.003 Annual Standard Deviation 0.001 Annual Variance 0 Information Ratio -4.942 Tracking Error 0.092 Treynor Ratio -1.212 Total Fees $5.00 Estimated Strategy Capacity $2800000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X Portfolio Turnover 0.24% |
# region imports from AlgorithmImports import * # endregion class TrailingStopOrderAlgorithm(QCAlgorithm): trailing_amount = 0.01 def initialize(self): self.set_start_date(2021, 7, 1) self.set_end_date(2021, 7, 9) self.set_cash(100000) self.symbol = self.add_equity("SPY", data_normalization_mode = DataNormalizationMode.RAW).symbol def on_data(self, data): if not self.portfolio.invested: quantity = 1 if self.time.day % 2 == 0 else -1 self.market_order(self.symbol, quantity) self.trailing_stop_order(self.symbol, -quantity, self.trailing_amount, True)