Overall Statistics |
Total Trades 1831 Average Win 0.76% Average Loss -0.65% Compounding Annual Return -29.606% Drawdown 88.800% Expectancy -0.263 Net Profit -82.764% Sharpe Ratio -0.782 Probabilistic Sharpe Ratio 0.000% Loss Rate 66% Win Rate 34% Profit-Loss Ratio 1.17 Alpha -0.197 Beta -0.137 Annual Standard Deviation 0.278 Annual Variance 0.077 Information Ratio -1.094 Tracking Error 0.337 Treynor Ratio 1.582 Total Fees $0.00 Estimated Strategy Capacity $1300000.00 Lowest Capacity Asset AUDJPY 5O |
namespace QuantConnect { public class BootCampTask : QCAlgorithm { int period = 125; int totalPairsToHold = 6; //Must be an even number, half will be held long, half short. Dictionary<string, MomentumPercent> indicators = new Dictionary<string, MomentumPercent>(); decimal leverage = 5m; public override void Initialize() { SetStartDate(2016, 6, 1); SetEndDate(2021, 6, 1); SetCash(100000); string[] tickers = new string [18] { "USDCAD","EURJPY","EURUSD","EURCHF","USDCHF","EURGBP", "GBPUSD","AUDCAD","NZDUSD","GBPCHF","AUDUSD","GBPJPY", "USDJPY","CHFJPY","EURCAD","AUDJPY","EURAUD","AUDNZD" }; //SetBrokerageModel(BrokerageName.FxcmBrokerage); foreach (string ticker in tickers) { AddForex(ticker, Resolution.Daily, Market.FXCM); indicators.Add(ticker, MOMP(ticker, period, Resolution.Daily)); Securities[ticker].FeeModel = new ConstantFeeModel(0); } SetWarmup(period); } public override void OnData(Slice data) { if (IsWarmingUp) return; List<string> gainers = indicators.Keys.OrderByDescending(x => indicators[x]).Take(totalPairsToHold / 2).ToList(); List<string> losers = indicators.Keys.OrderBy(x => indicators[x]).Take(totalPairsToHold / 2).ToList(); foreach (string ticker in indicators.Keys) { if (!gainers.Contains(ticker) && !losers.Contains(ticker)) { if (Portfolio[ticker].Invested) { Liquidate(ticker); } } } foreach (string ticker in gainers) { if (!Portfolio[ticker].Invested) { SetHoldings(ticker, leverage / (decimal)totalPairsToHold); } } foreach (string ticker in losers) { if (!Portfolio[ticker].Invested) { SetHoldings(ticker, -leverage / (decimal)totalPairsToHold); } } } } }