Overall Statistics |
Total Trades 5146 Average Win 0.74% Average Loss -0.45% Compounding Annual Return 1.951% Drawdown 40.100% Expectancy 0.013 Net Profit 10.154% Sharpe Ratio 0.051 Sortino Ratio 0.056 Probabilistic Sharpe Ratio 1.249% Loss Rate 62% Win Rate 38% Profit-Loss Ratio 1.63 Alpha 0.008 Beta 0.013 Annual Standard Deviation 0.179 Annual Variance 0.032 Information Ratio -0.261 Tracking Error 0.25 Treynor Ratio 0.712 Total Fees $0.00 Estimated Strategy Capacity $29000000.00 Lowest Capacity Asset QQQ RIWIV7K5Z9LX Portfolio Turnover 423.55% |
# region imports from AlgorithmImports import * from QuantConnect.Data import Slice # endregion class VwapTrend(QCAlgorithm): def Initialize(self): self.SetStartDate(2018, 11, 10) self.SetEndDate(2023, 11, 11) self.SetCash(25000) self.Settings.MinimumOrderMarginPortfolioPercentage = 0.01 self.SetWarmUp(390) self.asset = self.AddEquity("QQQ", Resolution.Minute) self.asset.SetDataNormalizationMode(DataNormalizationMode.Raw) self.asset.vwap = self.VWAP(self.asset.Symbol) self.asset.SetFeeModel(ConstantFeeModel(0)) self.minimum_percent_difference = self.GetParameter("minimum_percent_difference", 0.01) # Flat before market close self.Schedule.On(self.DateRules.EveryDay(self.asset.Symbol), self.TimeRules.BeforeMarketClose(self.asset.Symbol, 1), self.Liquidate) def OnData(self, slice: Slice) -> None: if not self.asset.vwap.IsReady or not self.asset.Exchange.ExchangeOpen: return absolute_difference = self.asset.Close - self.asset.vwap.Current.Value filter_difference = self.asset.Close * self.minimum_percent_difference if absolute_difference > filter_difference and self.asset.Holdings.Quantity <= 0: self.SetHoldings(self.asset.Symbol, 1) if absolute_difference < -filter_difference and self.asset.Holdings.Quantity >= 0: self.SetHoldings(self.asset.Symbol, -1)