Overall Statistics |
Total Trades 11 Average Win 8.29% Average Loss 0% Compounding Annual Return 7.585% Drawdown 13.700% Expectancy 0 Net Profit 48.548% Sharpe Ratio 0.822 Loss Rate 0% Win Rate 100% Profit-Loss Ratio 0 Alpha 0.082 Beta -0.208 Annual Standard Deviation 0.094 Annual Variance 0.009 Information Ratio 0.61 Tracking Error 0.094 Treynor Ratio -0.372 Total Fees $31.95 |
namespace QuantConnect { /// <summary> /// Basic template algorithm simply initializes the date range and cash. This is a skeleton /// framework you can use for designing an algorithm. /// </summary> public class BasicTemplateAlgorithm : QCAlgorithm { string symbol = "SPY"; int quantity= 0; public override void Initialize() { SetStartDate(2013, 5, 07); //Set Start Date SetEndDate(DateTime.Now.AddDays(-1));//Set End Date SetCash(100000); //Set Strategy Cash AddSecurity(SecurityType.Equity, symbol, Resolution.Minute); SetRunMode(RunMode.Series); } public override void OnData(Slice data) { if (Time.ToString("MMM") == "May"){ if(Portfolio.HoldStock){ Order(symbol, -Portfolio[symbol].Quantity); } } else if (Time.ToString("MMM") == "Oct"){ if (!Portfolio.HoldStock){ //Buy Maximum Shares quantity = (int)(Portfolio.Cash / data[symbol].Close); Order(symbol, quantity); } } } } }