Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 13.232% Drawdown 19.900% Expectancy 0 Net Profit 246.696% Sharpe Ratio 0.986 Probabilistic Sharpe Ratio 40.318% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.002 Beta 0.997 Annual Standard Deviation 0.147 Annual Variance 0.022 Information Ratio -0.424 Tracking Error 0.005 Treynor Ratio 0.145 Total Fees $5.54 Estimated Strategy Capacity $6700000.00 Lowest Capacity Asset SPY R735QTJ8XC9X |
namespace QuantConnect.Algorithm.CSharp { public class UpgradedAsparagusParrot : QCAlgorithm { private SimpleMovingAverage _sma; public override void Initialize() { SetStartDate(2010,1,1); SetEndDate(2020,1,1); SetCash(100000); var spy = AddEquity("SPY", Resolution.Minute).Symbol; _sma = new SimpleMovingAverage(100); bool selectUserDefinedConsolidator = true; if (selectUserDefinedConsolidator) { var consolidator = new TradeBarConsolidator(TimeSpan.FromMinutes(1)); consolidator.DataConsolidated += OnDataConsolidated; SubscriptionManager.AddConsolidator(spy, consolidator); } else { RegisterIndicator(spy, _sma, Resolution.Minute); } } private void OnDataConsolidated(object sender, TradeBar bar) { _sma.Update(bar.EndTime, bar.Close); } public override void OnData(Slice data) { if (!Portfolio.Invested && _sma.IsReady) { SetHoldings("SPY", 1); } } } }