Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 80.790% Drawdown 1.000% Expectancy 0 Net Profit 0% Sharpe Ratio 11.004 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.086 Beta -0.181 Annual Standard Deviation 0.025 Annual Variance 0.001 Information Ratio 8.054 Tracking Error 0.162 Treynor Ratio -1.511 Total Fees $0.00 |
using System; using System.Globalization; using QuantConnect.Data; namespace QuantConnect.Algorithm.CSharp { public class EminiAlgorithm : QCAlgorithm { public override void Initialize() { SetStartDate(2016, 01, 04); SetEndDate(2016, 01, 05); //Set the cash for the strategy: SetCash(100000); //Define the symbol and "type" of our generic data: AddData<Emini>("ES"); } public void OnData(Emini data) { if (data.Time.TimeOfDay < new TimeSpan(9, 30, 00) || data.Time.TimeOfDay > new TimeSpan(12, 00, 00)) { return; } else { if (!Portfolio.Invested) { int quantity = (int)Math.Floor(Portfolio.Cash / data.Close); Order("ES", quantity); Debug("Buying " + quantity + " contracts at " + data.Close); } } } } public class Emini : BaseData { public decimal Open = 0; public decimal High = 0; public decimal Low = 0; public decimal Close = 0; public long Volume = 0; public Emini() { Symbol = "ES"; } public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode) { return new SubscriptionDataSource("https://www.dropbox.com/s/jni2cm5r9d22a60/ES%202016-01-04%20-%202016-12-19.csv?dl=1 ", SubscriptionTransportMedium.RemoteFile); } public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode) { Emini index = new Emini(); try { var data = line.Split(','); index.Time = DateTime.ParseExact(data[0] + data[1], "yyyyMMddhhmmss", CultureInfo.InvariantCulture); index.Open = Convert.ToDecimal(data[2], CultureInfo.InvariantCulture); index.High = Convert.ToDecimal(data[3], CultureInfo.InvariantCulture); index.Low = Convert.ToDecimal(data[4], CultureInfo.InvariantCulture); index.Close = Convert.ToDecimal(data[5], CultureInfo.InvariantCulture); index.Volume = Convert.ToInt32(data[6], CultureInfo.InvariantCulture); index.Symbol = "ES"; index.Value = index.Close; } catch { /* Do nothing, skip first title row */ } return index; } } }