Overall Statistics |
Total Trades 5 Average Win 1.11% Average Loss 0% Compounding Annual Return 904.023% Drawdown 1.500% Expectancy 0 Net Profit 2.560% Sharpe Ratio 16.069 Probabilistic Sharpe Ratio 100.000% Loss Rate 0% Win Rate 100% Profit-Loss Ratio 0 Alpha 1.645 Beta -1.187 Annual Standard Deviation 0.08 Annual Variance 0.006 Information Ratio 9.479 Tracking Error 0.103 Treynor Ratio -1.078 Total Fees $0.30 |
import numpy as np import decimal as d from datetime import timedelta, datetime class FirstProject(QCAlgorithm): def Initialize(self): self.SetCash(100) self.SetStartDate(2019, 12, 23) self.equity = 'AMD' self.AddEquity(self.equity, Resolution.Minute).Symbol self.SetWarmUp(timedelta(minutes=1)) self.Securities[self.equity].FeeModel = ConstantFeeModel(.06) self.EMAFAST = self.EMA(self.equity, 20, Resolution.Minute) self.EMASLOW = self.EMA(self.equity, 200, Resolution.Minute) #Consolidate Heiken Ashi fiveMinuteConsolidator = TradeBarConsolidator(timedelta(minutes=5)) fiveMinuteConsolidator.DataConsolidated += self.OnDataConsolidated self.SubscriptionManager.AddConsolidator(self.equity, fiveMinuteConsolidator) self.RegisterIndicator(self.equity,self.EMAFAST, fiveMinuteConsolidator) self.RegisterIndicator(self.equity,self.EMASLOW, fiveMinuteConsolidator) def OnData(self, data): holdings = self.Portfolio[self.equity].Quantity if self.Portfolio[self.equity].Quantity == 0 and self.EMASLOW.Current.Value < self.EMAFAST.Current.Value : #### self.Debug(str(self.EMASLOW.Current.Value)+", "+str(self.EMAFAST.Current.Value)) self.MarketOrder(self.equity, 2) if self.Portfolio[self.equity].Quantity > 0 and self.EMAFAST.Current.Value < self.EMASLOW.Current.Value : #### self.Debug("SELL:"+str(self.EMAFAST.Current.Value)+", "+str(self.EMASLOW.Current.Value)) self.MarketOrder(self.equity, -2) ## def OnDataConsolidated(self, sender, data): return #####