Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return -12.226% Drawdown 0.800% Expectancy 0 Net Profit 0% Sharpe Ratio -1.7 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.115 Beta 0.112 Annual Standard Deviation 0.044 Annual Variance 0.002 Information Ratio -2.502 Tracking Error 0.173 Treynor Ratio -0.662 Total Fees $0.00 |
namespace QuantConnect.Algorithm.CSharp { /// <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 { /// <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(2013, 10, 07); //Set Start Date SetEndDate(2013, 10, 11); //Set End Date SetCash(100000); //Set Strategy Cash // Find more symbols here: http://quantconnect.com/data // Forex, CFD, Equities Resolutions: Tick, Second, Minute, Hour, Daily. // Futures Resolution: Tick, Second, Minute // Options Resolution: Minute Only. var eurusd = AddForex("EURUSD", Resolution.Second); var timeRule = new TenSecondsAfterEveryMinuteDuringMarketHoursTimeRule(eurusd); Schedule.On(DateRules.EveryDay("EURUSD"), timeRule, () => { Log(Time + ":: Custom time rule fired!"); }); } /// <summary> /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. /// </summary> /// <param name="data">Slice object keyed by symbol containing the stock data</param> public override void OnData(Slice data) { if (!Portfolio.Invested) { SetHoldings("EURUSD", 1); } } } }
namespace QuantConnect { public class TenSecondsAfterEveryMinuteDuringMarketHoursTimeRule : ITimeRule { private readonly Security _security; public string Name { get; } public TenSecondsAfterEveryMinuteDuringMarketHoursTimeRule(Security security) { _security = security; Name = $"{security.Symbol}: TenSecondsAfterEveryMinuteDuringMarketHoursTimeRule-"; } public IEnumerable<DateTime> CreateUtcEventTimes(IEnumerable<DateTime> dates) { var minutesPerDay = Enumerable.Range(0, 1440); return from date in dates from minute in minutesPerDay let time = date.AddMinutes(minute).AddSeconds(10) where _security.Exchange.DateTimeIsOpen(time) select time; } } }