Overall Statistics |
Total Trades 0 Average Win 0.00% Average Loss 0.00% Annual Return 0.000% Drawdown 0% Expectancy 0.000 Net Profit 0.000% Sharpe Ratio 0 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Trade Frequency Daily trades |
using System; using System.Collections; using System.Collections.Generic; namespace QuantConnect { using QuantConnect.Securities; using QuantConnect.Models; //Sell in May Algorithm Example: public partial class QCUSellInMay : QCAlgorithm, IAlgorithm { //Algorithm Variables //int quantity = 400; private string symbol = "SPY"; private decimal cash = 25000; //Initialize the Strategy public override void Initialize() { SetCash(cash); SetStartDate(1998, 01, 01); SetEndDate(2013, 06, 28); SetRunMode(RunMode.Series); AddSecurity(SecurityType.Equity, symbol, Resolution.Minute); } //Handle the data events: public override void OnTradeBar(Dictionary<string, TradeBar> data) { if (Time.ToShortTimeString() == "06:30") { Debug("6:30!"); /* if (Portfolio.HoldStock) { Order(symbol, -Portfolio[symbol].Quantity); Debug("QCU Sell In May: Flat " + Time.ToString("Y")); } } else { if (!Portfolio.HoldStock && Time.ToString("MMM") == "Nov") { Order(symbol, quantity); Debug("QCU Sell In May: Long " + Time.ToString("Y")); } */ } } } }