| Overall Statistics |
|
Total Trades 37 Average Win 7.76% Average Loss -2.34% Compounding Annual Return -14.964% Drawdown 27.700% Expectancy -0.520 Net Profit -12.694% Sharpe Ratio -0.288 Probabilistic Sharpe Ratio 12.027% Loss Rate 89% Win Rate 11% Profit-Loss Ratio 3.32 Alpha -0.085 Beta 0.25 Annual Standard Deviation 0.344 Annual Variance 0.118 Information Ratio -0.107 Tracking Error 0.414 Treynor Ratio -0.395 Total Fees $671.49 |
class EmaSimple(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2019, 6, 1) # Set Start Date
self.SetEndDate(2020, 4, 1) #Set End Date
self.SetCash(100000) #Set Strategy Cash
# Find more symbols here: http://quantconnect.com/data
self.AddEquity("WORK", Resolution.Hour)
self.stock = self.Identity("WORK")
# self.spyStock = Identity("SPY")
self.__slow = self.EMA("WORK", 200, Resolution.Hour)
self.PlotIndicator("WORK", self.__slow, self.stock)
stockPlot = Chart("Trade Plot")
stockPlot.AddSeries(Series('Buy', SeriesType.Scatter, 0))
stockPlot.AddSeries(Series('Sell', SeriesType.Scatter, 0))
self.AddChart(stockPlot)
def OnData(self, data):
if not self.__slow.IsReady: return
self.slowEMA = self.__slow.Current.Value
self.closePrice = data["WORK"].Price
tolerance = 0.0025
holdings = self.Portfolio["WORK"].Quantity
signalDelta = self.closePrice - self.slowEMA
if holdings == 0 and self.closePrice > self.slowEMA:
self.SetHoldings("WORK", 1.0)
self.Plot("Trade Plot", 'Buy', self.closePrice)
elif holdings > 0 and self.closePrice < self.slowEMA:
self.Liquidate("WORK")
self.Debug("SEll")
self.Plot("Trade Plot", 'Sell', self.closePrice)