Overall Statistics |
Total Trades 1 Average Win 32.56% Average Loss 0.00% Compounding Annual Return 19.241% Drawdown 8.200% Expectancy 0.000 Net Profit 32.562% Sharpe Ratio 1.445 Loss Rate 0% Win Rate 100% Profit-Loss Ratio 0 Alpha 0.08 Beta 0.485 Annual Standard Deviation 0.127 Annual Variance 0.016 Information Ratio -0.238 Tracking Error 0.128 Treynor Ratio 0.379 |
using System; using System.Collections; using System.Collections.Generic; using QuantConnect.Securities; using QuantConnect.Models; namespace QuantConnect { public class BasicTemplateAlgorithm : QCAlgorithm { private int count = 0; //Initialize the data and resolution you require for your strategy: public override void Initialize() { //Initialize the start, end dates for simulation; cash and data required. SetStartDate(2013, 1, 1); SetEndDate(DateTime.Now.Date.AddDays(-1)); SetCash(100000); //Starting Cash in USD. AddSecurity(SecurityType.Equity, "MSFT", Resolution.Minute); //Minute,Second - Tick SetRunMode(RunMode.Series); //Series or Parallel for intraday strategies. } //Handle TradeBar Events: a TradeBar occurs on every time-interval public override void OnTradeBar(Dictionary<string, TradeBar> data) { /* if (!Portfolio.HoldStock) { Order("MSFT", (int)Math.Floor(Portfolio.Cash / data["MSFT"].Close) ); Debug("Debug Purchased MSFT"); } */ if (count == 0) { Debug("Cash: " + Portfolio.Cash); SetHoldings("MSFT", 0.5, true); } if (count == 1) { Debug("Cash: " + Portfolio.Cash); SetHoldings("MSFT", 1.0, true); } count++; } } }