public override void Initialize() { SetStartDate(2013, 10, 07); SetEndDate(2013, 10, 11); // even though we're using a framework algorithm, we can still add our securities // using the AddEquity/Forex/Crypto/ect methods and then pass them into a manual // universe selection model using Securities.Keys AddEquity("SPY"); AddEquity("IBM"); AddEquity("BAC"); AddEquity("AIG"); // define a manual universe of all the securities we manually registered UniverseSelection = new ManualUniverseSelectionModel(Securities.Keys); // define alpha model as a composite of the rsi and ema cross models Alpha = new CompositeAlphaModel( new RsiAlphaModel(), new EmaCrossAlphaModel() ); // default models for the rest PortfolioConstruction = new EqualWeightingPortfolioConstructionModel(); Execution = new ImmediateExecutionModel(); RiskManagement = new NullRiskManagementModel(); }
public override void Initialize() { // Set requested data resolution UniverseSettings.Resolution = Resolution.Minute; SetStartDate(2013, 10, 07); //Set Start Date SetEndDate(2013, 10, 11); //Set End Date SetCash(100000); //Set Strategy Cash PortfolioSelection = new CustomFundamentalPortfolioSelectionModel(); Alpha = new MacdAlphaModel(TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(30), 0.01m); PortfolioConstruction = new EqualWeightingPortfolioConstructionModel(); }
public override void Initialize() { SetStartDate(2013, 10, 07); SetEndDate(2013, 10, 11); var bac = AddEquity("BAC"); var aig = AddEquity("AIG"); UniverseSelection = new ManualUniverseSelectionModel(Securities.Keys); Alpha = new PairsTradingAlphaModel(bac.Symbol, aig.Symbol); PortfolioConstruction = new EqualWeightingPortfolioConstructionModel(); Execution = new ImmediateExecutionModel(); RiskManagement = new NullRiskManagementModel(); }
public override void Initialize() { // Set requested data resolution UniverseSettings.Resolution = Resolution.Daily; SetStartDate(2014, 03, 24); SetEndDate(2014, 04, 07); SetCash(100000); UniverseSelection = new FineFundamentalUniverseSelectionModel(SelectCoarse, SelectFine); Alpha = new ConstantAlphaModel(InsightType.Price, InsightDirection.Up, QuantConnect.Time.OneDay); PortfolioConstruction = new EqualWeightingPortfolioConstructionModel(); RiskManagement = new MaximumSectorExposureRiskManagementModel(); }
public override void Initialize() { // Set requested data resolution UniverseSettings.Resolution = Resolution.Minute; SetStartDate(2013, 10, 07); //Set Start Date SetEndDate(2013, 10, 11); //Set End Date SetCash(100000); //Set Strategy Cash UniverseSelection = new CustomFundamentalUniverseSelectionModel(); Alpha = new MacdAlphaModel( fastPeriod: 10, slowPeriod: 30, signalPeriod: 12, movingAverageType: MovingAverageType.Simple ); PortfolioConstruction = new EqualWeightingPortfolioConstructionModel(); }
public override void Initialize() { UniverseSettings.Resolution = Resolution.Minute; SetStartDate(2013, 10, 07); SetEndDate(2013, 10, 11); SetCash(1000000); UniverseSelection = new ManualUniverseSelectionModel( QuantConnect.Symbol.Create("AIG", SecurityType.Equity, Market.USA), QuantConnect.Symbol.Create("BAC", SecurityType.Equity, Market.USA), QuantConnect.Symbol.Create("IBM", SecurityType.Equity, Market.USA), QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA) ); // using hourly rsi to generate more insights Alpha = new RsiAlphaModel(14, Resolution.Hour); PortfolioConstruction = new EqualWeightingPortfolioConstructionModel(); Execution = new StandardDeviationExecutionModel(); }
/// <summary> /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. /// </summary> public override void Initialize() { // Set requested data resolution UniverseSettings.Resolution = Resolution.Minute; SetStartDate(2013, 10, 07); //Set Start Date SetEndDate(2013, 10, 11); //Set End Date SetCash(100000); //Set Strategy Cash // Find more symbols here: http://quantconnect.com/data // Forex, CFD, Equities Resolutions: Tick, Second, Minute, Hour, Daily. // Futures Resolution: Tick, Second, Minute // Options Resolution: Minute Only. // set algorithm framework models PortfolioSelection = new ManualPortfolioSelectionModel(QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA)); Alpha = new ConstantAlphaModel(InsightType.Price, InsightDirection.Up, TimeSpan.FromMinutes(20), 0.025, null); PortfolioConstruction = new EqualWeightingPortfolioConstructionModel(); Execution = new ImmediateExecutionModel(); RiskManagement = new Algorithm.Framework.Risk.NullRiskManagementModel(); }
public override void Initialize() { UniverseSettings.Resolution = Resolution.Minute; SetStartDate(2013, 10, 07); SetEndDate(2013, 10, 11); SetCash(1000000); UniverseSelection = new ManualUniverseSelectionModel( QuantConnect.Symbol.Create("AIG", SecurityType.Equity, Market.USA), QuantConnect.Symbol.Create("BAC", SecurityType.Equity, Market.USA), QuantConnect.Symbol.Create("IBM", SecurityType.Equity, Market.USA), QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA) ); // using hourly rsi to generate more insights Alpha = new RsiAlphaModel(14, Resolution.Hour); PortfolioConstruction = new EqualWeightingPortfolioConstructionModel(); Execution = new VolumeWeightedAveragePriceExecutionModel(); InsightsGenerated += (algorithm, data) => Log($"{Time}: {string.Join(" | ", data.Insights)}"); }