Overall Statistics |
Total Trades 6 Average Win 1.32% Average Loss 0% Compounding Annual Return 3.846% Drawdown 0.900% Expectancy 0 Net Profit 4.007% Sharpe Ratio 1.178 Probabilistic Sharpe Ratio 63.124% Loss Rate 0% Win Rate 100% Profit-Loss Ratio 0 Alpha 0.02 Beta 0.042 Annual Standard Deviation 0.027 Annual Variance 0.001 Information Ratio -2.11 Tracking Error 0.11 Treynor Ratio 0.749 Total Fees $6.00 |
using System.Drawing; namespace QuantConnect.Algorithm.CSharp { public class MultidimensionalUncoupledEngine: QCAlgorithm { public override void Initialize() { SetStartDate(2019, 1, 1); //Set Start Date SetEndDate(2020, 1, 15); //Set Start Date SetCash(1000); //Set Strategy Cash UniverseSettings.Resolution = Resolution.Minute; SetAlpha(new QuadTunnelAlphaModel()); AddUniverseSelection(new LiquidValueUniverseSelectionModel()); SetPortfolioConstruction( new EqualWeightingPortfolioConstructionModel() ); SetRiskManagement(new TrailingStopRiskManagementModel()); SetExecution(new ImmediateExecutionModel()); } } }
namespace QuantConnect { public class LiquidValueUniverseSelectionModel : FundamentalUniverseSelectionModel { public LiquidValueUniverseSelectionModel() : base(true, null, null) { } public override IEnumerable<Symbol> SelectCoarse(QCAlgorithm algorithm, IEnumerable<CoarseFundamental> coarse) { IEnumerable<Symbol> ret= new [] { QuantConnect.Symbol.Create("JPM", SecurityType.Equity, Market.USA) }; algorithm.Debug("selectCoarse"); return ret; } public override IEnumerable<Symbol> SelectFine(QCAlgorithm algorithm, IEnumerable<FineFundamental> fine) { IEnumerable<Symbol> ret= fine.Select(f => f.Symbol); algorithm.Debug("SelectFine"); return ret; } } }
namespace QuantConnect { class QuadTunnelAlphaModel : IAlphaModel, INotifiedSecurityChanges { public int periods = 60; public IEnumerable<Insight> Update(QCAlgorithm algorithm, Slice data) { List<Insight> ret = new List<Insight>(); foreach(var d in data.Values){//base data = https://www.quantconnect.com/lean/documentation/topic8710.html var symbol=d.Symbol.Value; algorithm.Debug(algorithm.Time.ToString("o") +" symbol: "+symbol+" price = "+d.Price); if(d.Price <92){ var insight = Insight.Price(d.Symbol, TimeSpan.FromMinutes(20), InsightDirection.Up); ret.Add(insight); algorithm.Debug(algorithm.Time.ToString("o") +" added insight"); } } return ret; } public void OnSecuritiesChanged(QCAlgorithm algorithm, SecurityChanges changes) { if (changes.AddedSecurities.Count > 0) { algorithm.Debug(algorithm.Time.ToString("o") + " Securities added: " + string.Join(",", changes.AddedSecurities.Select(x => x.Symbol.Value))); } if (changes.RemovedSecurities.Count > 0) { algorithm.Debug(algorithm.Time.ToString("o") +" Securities removed: " + string.Join(",", changes.RemovedSecurities.Select(x => x.Symbol.Value))); } } } }