Overall Statistics |
Total Trades 2 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $2.00 Estimated Strategy Capacity $60000000.00 Lowest Capacity Asset AAPL R735QTJ8XC9X |
namespace QuantConnect.Algorithm.CSharp { public class CalmGreenDogfish : QCAlgorithm { private Symbol _aapl; public override void Initialize() { SetStartDate(2014, 6, 5); //Set Start Date SetEndDate(2014, 6, 5); SetCash(100000); //Set Strategy Cash _aapl = QuantConnect.Symbol.Create("AAPL", SecurityType.Equity, Market.USA); AddEquity("AAPL", Resolution.Minute); //UniverseSettings.DataNormalizationMode = DataNormalizationMode.Raw; Securities["AAPL"].SetDataNormalizationMode(DataNormalizationMode.Raw); //QuantConnect.Orders.MarketOnCloseOrder.SubmissionTimeBuffer = TimeSpan.FromSeconds(1); } private TimeSpan _entryTime = new TimeSpan(9, 40, 0); private TimeSpan _justBeforeClose = new TimeSpan(15, 59, 0); private List<TimeSpan> _debugTimes = new List<TimeSpan> { new TimeSpan(9, 40, 0), new TimeSpan(9, 41, 0), //new TimeSpan(15, 58, 0), new TimeSpan(15, 59, 0), new TimeSpan(16, 0, 0), }; /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. /// Slice object keyed by symbol containing the stock data public override void OnData(Slice data) { var bar = data.Bars["AAPL"]; if (bar.EndTime.TimeOfDay == _entryTime) { MarketOrder(_aapl, 1); MarketOnCloseOrder(_aapl, -1); } //if (bar.EndTime.TimeOfDay == _justBeforeClose) { // MarketOnCloseOrder(_aapl, -1); //} if (_debugTimes.Contains(bar.EndTime.TimeOfDay)) { Debug($"Time={bar.EndTime:HH:mm:ss} Open={bar.Open} Close={bar.Close}"); } // if (!Portfolio.Invested) // { // SetHoldings("SPY", 1); // Debug("Purchased Stock"); //} } } }