Overall Statistics |
Total Trades 387 Average Win 0.45% Average Loss -0.42% Compounding Annual Return 49.533% Drawdown 15.900% Expectancy 0.052 Net Profit 20.871% Sharpe Ratio 1.463 Loss Rate 49% Win Rate 51% Profit-Loss Ratio 1.07 Alpha -0.149 Beta 2.081 Annual Standard Deviation 0.298 Annual Variance 0.089 Information Ratio 0.689 Tracking Error 0.224 Treynor Ratio 0.209 Total Fees $571.65 |
namespace QuantConnect { public partial class BootCampTask : QCAlgorithm { private IEnumerable<Symbol> filteredByPrice; private SecurityChanges _changes = SecurityChanges.None; public override void Initialize() { SetStartDate(2019, 1, 11); SetEndDate(2019, 7, 1); SetCash(100000); AddUniverse(CoarseSelectionFilter); UniverseSettings.Resolution = Resolution.Daily; //1. Set the leverage to 2 UniverseSettings.Leverage = 2.0m; } public IEnumerable<Symbol> CoarseSelectionFilter(IEnumerable<CoarseFundamental> coarse) { var sortedByDollarVolume = coarse.OrderByDescending(x => x.DollarVolume); filteredByPrice = sortedByDollarVolume.Where(x => x.Price > 10).Select(x => x.Symbol); filteredByPrice = filteredByPrice.Take(10); return filteredByPrice; } public override void OnSecuritiesChanged(SecurityChanges changes) { _changes = changes; Log($"OnSecuritiesChanged({UtcTime}):: {changes}"); foreach (var security in changes.RemovedSecurities) { if (security.Invested) { Liquidate(security.Symbol); } } //2. Now that we have more leverage, set the allocation to set the allocation to 18% each instead of 10% foreach (var security in changes.AddedSecurities) { SetHoldings(security.Symbol, 0.18m); } } } }