| Overall Statistics |
|
Total Trades 15 Average Win 0.10% Average Loss -0.18% Compounding Annual Return 0.509% Drawdown 0.500% Expectancy 0.135 Net Profit 0.086% Sharpe Ratio 0.314 Probabilistic Sharpe Ratio 37.096% Loss Rate 29% Win Rate 71% Profit-Loss Ratio 0.59 Alpha 0.004 Beta 0 Annual Standard Deviation 0.011 Annual Variance 0 Information Ratio 0.86 Tracking Error 0.496 Treynor Ratio 7.171 Total Fees $38.71 Estimated Strategy Capacity $1100000.00 Lowest Capacity Asset ADAUSD E3 |
class SimpleEMACrossover(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2021, 3, 20)
self.SetEndDate(2021, 5, 20)
self.SetCash(100000)
self.SetTimeZone("UTC")
self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin)
security = self.AddCrypto('ADAUSD', Resolution.Daily)
security.BuyingPowerModel = SecurityMarginModel(3.3)
self.symbol = security.Symbol
self.defaultQuantity = 1000
self.periodFast = 2
self.periodSlow = 8
self.emaFast = self.EMA(self.symbol, self.periodFast, Resolution.Daily)
self.emaSlow = self.EMA(self.symbol, self.periodSlow, Resolution.Daily)
self.RegisterIndicator(self.symbol, self.emaFast, Resolution.Daily)
self.RegisterIndicator(self.symbol, self.emaSlow, Resolution.Daily)
self.SetWarmUp(2, Resolution.Daily)
def OnData(self, data):
self.Plot("Data Chart", "Asset Price", self.Securities["ADAUSD"].Close)
self.Plot("EMA", "Slow", self.emaSlow.Current.Value)
self.Plot("EMA", "Fast", self.emaFast.Current.Value)
if not self.emaSlow.IsReady:
return
if self.Portfolio[self.symbol].IsLong:
if self.emaFast.Current.Value < self.emaSlow.Current.Value:
self.Liquidate(self.symbol)
self.MarketOrder(self.symbol, -self.defaultQuantity)
elif self.Portfolio[self.symbol].IsShort:
if self.emaFast.Current.Value > self.emaSlow.Current.Value:
self.Liquidate(self.symbol)
self.MarketOrder(self.symbol, self.defaultQuantity)
else:
if self.emaFast.Current.Value > self.emaSlow.Current.Value:
self.MarketOrder(self.symbol, self.defaultQuantity)
if self.emaFast.Current.Value < self.emaSlow.Current.Value:
self.MarketOrder(self.symbol, -self.defaultQuantity)