Overall Statistics |
Total Trades 836 Average Win 1.81% Average Loss -1.60% Compounding Annual Return 19.145% Drawdown 29.000% Expectancy 0.089 Net Profit 59.642% Sharpe Ratio 0.649 Loss Rate 49% Win Rate 51% Profit-Loss Ratio 1.13 Alpha 0.176 Beta -1.733 Annual Standard Deviation 0.276 Annual Variance 0.076 Information Ratio 0.544 Tracking Error 0.333 Treynor Ratio -0.104 Total Fees $0.00 |
using System; using System.Collections.Generic; using System.Linq; using NodaTime; using QuantConnect.Brokerages; namespace QuantConnect.Algorithm.CSharp.DateTimeEffectAlgo { public class DateTimeEffectAlgo : QCAlgorithm { /* +-------------------------------------------------+ * |Algorithm Control Panel | * +-------------------------------------------------+*/ private readonly string[] _pairs = {"EURUSD", "USDJPY"}; private readonly decimal _leverage = 10m; private readonly decimal _exposure = 0.8m; /* +-------------------------------------------------+*/ private decimal _shareByPair; private readonly List<Symbol> _symbols = new List<Symbol>(); public override void Initialize() { SetStartDate(year: 2015, month: 01, day: 01); //Set Start Date SetEndDate(year: 2017, month: 09, day: 01); //Set End Date SetCash(startingCash: 25000); //Set Strategy Cash SetBrokerageModel(BrokerageName.OandaBrokerage); _shareByPair = (_leverage *_exposure ) / _pairs.Length; // Find more symbols here: http://quantconnect.com/data foreach (var pair in _pairs) { _symbols.Add(AddForex(pair, Resolution.Minute, "OANDA", leverage: _leverage).Symbol); if (pair == "EURUSD") { SetBenchmark(_symbols.Last()); } } Schedule.On(DateRules.Every(DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday), TimeRules.At(hour: 9, minute: 15, timeZone: DateTimeZone.Utc), () => { SetHoldings("EURUSD", -6); }); Schedule.On(DateRules.EveryDay(), TimeRules.At(14, 15, DateTimeZone.Utc), () => { Liquidate("EURUSD"); }); Schedule.On(DateRules.Every(DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday), TimeRules.At(hour: 0, minute: 15, timeZone: DateTimeZone.Utc), () => { SetHoldings("UDSJPY", -4); }); Schedule.On(DateRules.EveryDay(), TimeRules.At(5, 15, DateTimeZone.Utc), () => { Liquidate("USDJPY"); }); } } }