| Overall Statistics |
|
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 6.376% Drawdown 5.900% Expectancy 0 Net Profit 9.700% Sharpe Ratio 0.931 Probabilistic Sharpe Ratio 44.839% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.005 Beta 0.375 Annual Standard Deviation 0.047 Annual Variance 0.002 Information Ratio -1.117 Tracking Error 0.079 Treynor Ratio 0.117 Total Fees $1.00 Estimated Strategy Capacity $260000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X |
class CryingFluorescentOrangeOwlet(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 9, 9) # Set Start Date
self.SetCash(100000) # Set Strategy Cash
self.AddEquity("SPY", Resolution.Minute)
self.entryTicket = None
self.profitTicket = None
def OnOrderEvent(self, orderEvent):
if orderEvent.Status != OrderStatus.Filled:
return
if self.entryTicket != None and self.entryTicket.OrderId == orderEvent.OrderId:
self.profitTicket = self.LimitOrder("SPY",-100,self.takeProfit)
if self.profitTicket != None and self.profitTicket.OrderId == orderEvent.OrderId:
self.entryTicket = None
self.stopLoss = None
self.profitTicket = None
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
'''
if not self.Portfolio.Invested:
self.entryTicket = self.MarketOrder("SPY",100)
self.takeProfit = data["SPY"].Close+1
self.stopLoss = data["SPY"].Close-5
else:
if self.profitTicket != None and data["SPY"].Close<=self.stopLoss and OrderStatus.Filled!=self.profitTicke.Status:
self.Liquidate()
self.profitTicket.Cancel()
self.profitTicket = None
self.entryTicket = None
self.stopLoss = None