Overall Statistics |
Total Trades 3244 Average Win 0.05% Average Loss -0.07% Compounding Annual Return -0.442% Drawdown 11.800% Expectancy -0.063 Net Profit -1.881% Sharpe Ratio -0.046 Loss Rate 46% Win Rate 54% Profit-Loss Ratio 0.72 Alpha -0.016 Beta 0.098 Annual Standard Deviation 0.059 Annual Variance 0.003 Information Ratio -1.131 Tracking Error 0.126 Treynor Ratio -0.027 Total Fees $3244.00 |
namespace QuantConnect { /* * QuantConnect University: How do I use a rolling window of data? * * Our indicator library is a powerful collection of tools. Included in this collection is * the rolling window indicator for giving you easy access to a fixed length window of data. */ public class QCURollingWindow : QCAlgorithm { RollingWindow<TradeBar> _window = new RollingWindow<TradeBar>(3600); public override void Initialize() { SetStartDate(2013, 1, 1); SetEndDate(DateTime.Now.Date.AddDays(-1)); SetCash(25000); AddSecurity(SecurityType.Equity, "SPY", Resolution.Minute); } public void OnData(TradeBars data) { //Inject data into the rolling window. _window.Add(data["SPY"]); if (!_window.IsReady) return; if (_window[0].Close > _window[3599].Close) { SetHoldings("SPY", -0.5); } else { SetHoldings("SPY", 0.5); } } } }