| Overall Statistics |
|
Total Trades 33 Average Win 5.22% Average Loss -5.56% Compounding Annual Return 32.172% Drawdown 11.200% Expectancy 0.575 Net Profit 65.685% Sharpe Ratio 1.688 Probabilistic Sharpe Ratio 79.063% Loss Rate 19% Win Rate 81% Profit-Loss Ratio 0.94 Alpha 0 Beta 0.997 Annual Standard Deviation 0.134 Annual Variance 0.018 Information Ratio -0.03 Tracking Error 0.006 Treynor Ratio 0.227 Total Fees $59.76 Estimated Strategy Capacity $170000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X |
class MultidimensionalDynamicComputer(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 4, 20) # Set Start Date
self.SetCash(100000) # Set Strategy Cash
self.AddEquity("SPY", Resolution.Hour)
self.BuyIn = 0.0
def OnData(self, data):
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
Arguments:
data: Slice object keyed by symbol containing the stock data
'''
CurrentPrice = self.Securities["SPY"].Price
if not self.Portfolio.Invested:
self.BuyIn = CurrentPrice
self.SetHoldings("SPY", 1) # A market buy
return
if CurrentPrice > self.BuyIn*(1+0.05) or CurrentPrice < self.BuyIn*(1-0.05): # Sell/buy if +/- 5 pct from buy
self.SetHoldings("SPY", 0) # A market sell
return # Will repurchase upon next "OnData"