Overall Statistics |
Total Trades 10 Average Win 0% Average Loss 0.00% Compounding Annual Return -0.719% Drawdown 0.000% Expectancy -1 Net Profit -0.009% Sharpe Ratio -24.531 Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.005 Beta 0.001 Annual Standard Deviation 0 Annual Variance 0 Information Ratio -4.431 Tracking Error 0.193 Treynor Ratio -5.049 Total Fees $10.00 |
using QuantConnect.Data; namespace QuantConnect.Algorithm.CSharp { public class BasicTemplateAlgorithm : QCAlgorithm { private bool _canTrade; private Symbol _spy = QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA); public override void Initialize() { SetStartDate(2013, 10, 07); //Set Start Date SetEndDate(2013, 10, 11); //Set End Date SetCash(100000); //Set Strategy Cash // Find more symbols here: http://quantconnect.com/data AddEquity(_spy, Resolution.Minute); // schedule an event to fire every trading day for a security // the time rule here tells it to fire 0 minutes after SPY's market open Schedule.On(DateRules.EveryDay(_spy), TimeRules.AfterMarketOpen(_spy, 0), () => { _canTrade = true; }); // schedule an event to fire every trading day for a security // the time rule here tells it to fire 10 minutes before SPY's market close Schedule.On(DateRules.EveryDay(_spy), TimeRules.BeforeMarketClose(_spy, 10), () => { _canTrade = false; Liquidate(); Debug(Time + " -> Liquidate"); }); } public override void OnData(Slice data) { if (_canTrade && !Portfolio.Invested) { Buy(_spy,1); Debug(Time + " -> BUY"); } } } }