Overall Statistics
Total Trades
1662
Average Win
0.82%
Average Loss
-0.70%
Compounding Annual Return
-26.383%
Drawdown
87.000%
Expectancy
-0.236
Net Profit
-78.432%
Sharpe Ratio
-0.654
Probabilistic Sharpe Ratio
0.000%
Loss Rate
65%
Win Rate
35%
Profit-Loss Ratio
1.18
Alpha
-0.165
Beta
-0.226
Annual Standard Deviation
0.257
Annual Variance
0.066
Information Ratio
-0.677
Tracking Error
0.267
Treynor Ratio
0.745
Total Fees
$0.00
Estimated Strategy Capacity
$1700000.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);
				}
			}
        }
    }
}