Overall Statistics |
Total Trades 120 Average Win 0.18% Average Loss -0.04% Compounding Annual Return 6.262% Drawdown 8.700% Expectancy 2.301 Net Profit 35.548% Sharpe Ratio 0.841 Probabilistic Sharpe Ratio 31.147% Loss Rate 44% Win Rate 56% Profit-Loss Ratio 4.87 Alpha 0.045 Beta -0.003 Annual Standard Deviation 0.053 Annual Variance 0.003 Information Ratio -0.509 Tracking Error 0.165 Treynor Ratio -13.904 Total Fees $0.00 Estimated Strategy Capacity $1900000.00 Lowest Capacity Asset USDTRY 8G |
using System.Linq; using NodaTime; namespace QuantConnect { public class BootCampTask : QCAlgorithm { Dictionary<Symbol, string> symbols = new Dictionary<Symbol, string>(); string[] rateSymbols; public override void Initialize() { SetStartDate(2016, 6, 1); SetEndDate(2021, 6, 1); SetCash(100000); string[] tickers = {"USDEUR", "USDZAR", "USDAUD", "USDJPY", "USDTRY", "USDINR", "USDCNY", "USDMXN", "USDCAD"}; rateSymbols = new string[9] {"BCB/17900", // Euro Area "BCB/17906", // South Africa "BCB/17880", // Australia "BCB/17903", // Japan "BCB/17907", // Turkey "BCB/17901", // India "BCB/17899", // China "BCB/17904", // Mexico "BCB/17881"}; // Canada for (int i = 0; i < tickers.Length; i++) { Symbol symbol = AddForex(tickers[i], Resolution.Daily, Market.Oanda).Symbol; AddData<QuandlRate>(rateSymbols[i], Resolution.Daily, DateTimeZone.Utc, true); symbols.Add(symbol, rateSymbols[i]); } Schedule.On(DateRules.MonthStart("USDEUR"), TimeRules.AfterMarketOpen("USDEUR"), Rebalance); } public void Rebalance() { List<Symbol> sortedSymbols = symbols.Keys.OrderBy(x => Securities[symbols[x]].Price).ToList(); if (Securities[sortedSymbols.First()].Price != 0 && Securities[sortedSymbols.Last()].Price != 0) { SetHoldings(sortedSymbols.First(), -0.5); SetHoldings(sortedSymbols.Last(), 0.5); } } public override void OnData(Slice data) { } public class QuandlRate : Quandl { public QuandlRate() : base(valueColumnName: "Value") { } } } }