Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 2.107% Drawdown 21.800% Expectancy 0 Net Profit 0% Sharpe Ratio 0.24 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.02 Beta 0.005 Annual Standard Deviation 0.085 Annual Variance 0.007 Information Ratio -0.586 Tracking Error 0.164 Treynor Ratio 4.117 Total Fees $2.00 |
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using QuantConnect.Data; using QuantConnect.Data.Market; using QuantConnect.Data.Consolidators; namespace QuantConnect.Algorithm.Examples { /// <summary> /// Algorithm that plots data in the past /// </summary> public class PastPlottingAlgorithm : QCAlgorithm { //Series pastData1; //Series pastData2; //Series pastData3; //Series pastData4; //Series pastData5; /// <summary> /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. /// </summary> public override void Initialize() { SetStartDate(2010, 05, 03); SetEndDate(2015, 04, 30); AddSecurity(SecurityType.Equity, "MSFT", Resolution.Minute); AddSecurity(SecurityType.Forex, "AUDUSD", Resolution.Minute); //AddSecurity(SecurityType.Equity, "SPY", Resolution.Minute); //AddSecurity(SecurityType.Forex, "EURGBP", Resolution.Minute); //AddSecurity(SecurityType.Equity, "AAPL", Resolution.Minute); //var chart1 = new Chart("AUDUSD"); //pastData1 = new Series("past-data"); //chart1.AddSeries(pastData1); //AddChart(chart1); //var chart2 = new Chart("MSFT"); //pastData2 = new Series("past-data"); //chart2.AddSeries(pastData2); //AddChart(chart2); //var chart3 = new Chart("SPY"); //pastData3 = new Series("past-data"); //chart3.AddSeries(pastData3); //AddChart(chart3); //var chart4 = new Chart("EURGBP"); //pastData4 = new Series("past-data"); //chart4.AddSeries(pastData4); //AddChart(chart4); //var chart5 = new Chart("AAPL"); //pastData5 = new Series("past-data"); //chart5.AddSeries(pastData5); //AddChart(chart5); } /// <summary> /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. /// </summary> /// <param name="data">TradeBars IDictionary object with your stock data</param> public void OnData(TradeBars data) { if (!Portfolio.Invested) { SetHoldings("MSFT", 0.05m); SetHoldings("AUDUSD", -0.75m); //SetHoldings("SPY", 0.05m); //SetHoldings("EURGBP", -0.75m); //SetHoldings("AAPL", 0.05m); } // plot every morning at 930 //if (data.ContainsKey("AUDUSD") && data["AUDUSD"].Time.TimeOfDay.TotalHours == 9.5 && Time.Date > new DateTime(2010, 06, 01)) //{ // pastData1.AddPoint(Time.Subtract(TimeSpan.FromDays(15)), data["AUDUSD"].Price); //} //if (data.ContainsKey("MSFT") && data["MSFT"].Time.TimeOfDay.TotalHours == 9.5 && Time.Date > new DateTime(2010, 06, 01)) //{ // pastData2.AddPoint(Time.Subtract(TimeSpan.FromDays(15)), data["MSFT"].Price); //} //if (data.ContainsKey("SPY") && data["SPY"].Time.TimeOfDay.TotalHours == 9.5 && Time.Date > new DateTime(2010, 06, 01)) //{ // pastData3.AddPoint(Time.Subtract(TimeSpan.FromDays(15)), data["SPY"].Price); //} //if (data.ContainsKey("EURGBP") && data["EURGBP"].Time.TimeOfDay.TotalHours == 9.5 && Time.Date > new DateTime(2010, 06, 01)) //{ // pastData4.AddPoint(Time.Subtract(TimeSpan.FromDays(15)), data["EURGBP"].Price); //} //if (data.ContainsKey("AAPL") && data["AAPL"].Time.TimeOfDay.TotalHours == 9.5 && Time.Date > new DateTime(2010, 06, 01)) //{ // pastData5.AddPoint(Time.Subtract(TimeSpan.FromDays(15)), data["AAPL"].Price); //} } } }