| Overall Statistics |
|
Total Trades 70 Average Win 1.27% Average Loss -0.04% Compounding Annual Return 13.990% Drawdown 48.000% Expectancy 30.194 Net Profit 14.022% Sharpe Ratio 0.493 Probabilistic Sharpe Ratio 25.019% Loss Rate 6% Win Rate 94% Profit-Loss Ratio 32.14 Alpha -0.014 Beta 1.409 Annual Standard Deviation 0.535 Annual Variance 0.286 Information Ratio 0.129 Tracking Error 0.515 Treynor Ratio 0.187 Total Fees $0.00 Estimated Strategy Capacity $3300000.00 Lowest Capacity Asset BTCUSD XJ |
class CalmYellowGreenFox(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2021, 1, 1) # Set Start Date
self.SetEndDate(2021,12,31)
self.SetCash(100000) # Set Strategy Cash
self.btc = self.AddCrypto("BTCUSD", Resolution.Daily).Symbol
self.takeProfit = None
self.stopLoss = None
def OnData(self, data):
price = data[self.btc].Close
if not(self.Portfolio.Invested and not self.Transactions.GetOpenOrders):
self.order = self.MarketOrder(self.btc,1)
self.takeProfit = self.LimitOrder(self.btc,-1,price*1.03)
self.stopLoss = self.StopMarketOrder(self.btc,-1,price*0.97)
elif(price > self.previousPrice):
self.stopLoss.UpdateStopPrice(price*0.97)
self.previousPrice = price
def OnOrderEvent(self, orderEvent):
order = self.Transactions.GetOrderById(orderEvent.OrderId)
if orderEvent.Status != OrderStatus.Filled:
return
if self.takeProfit == None or self.stopLoss == None:
return
if(order.Id == self.takeProfit.OrderId):
self.stopLoss.Cancel()
return
if(order.Id == self.stopLoss.OrderId):
self.takeProfit.Cancel()
return