/// <summary> /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. /// </summary> /// <seealso cref="QCAlgorithm.SetStartDate(System.DateTime)"/> /// <seealso cref="QCAlgorithm.SetEndDate(System.DateTime)"/> /// <seealso cref="QCAlgorithm.SetCash(decimal)"/> public override void Initialize() { #region logging var algoname = this.GetType().Name; mylog.Debug(algoname); mylog.Debug(ondataheader); dailylog.Debug(algoname); dailylog.Debug(dailyheader); _transactions = new List <OrderTransaction>(); string filepath = AssemblyLocator.ExecutingDirectory() + "transactions.csv"; if (File.Exists(filepath)) { File.Delete(filepath); } #endregion //Initialize dates SetStartDate(_startDate); SetEndDate(_endDate); SetCash(_portfolioAmount); //Add as many securities as you like. All the data will be passed into the event handler: AddSecurity(SecurityType.Equity, symbol, Resolution.Minute); // Indicators Price = new RollingWindow <IndicatorDataPoint>(14); // The price history // ITrend trend = new InstantaneousTrend(7); trendHistory = new RollingWindow <IndicatorDataPoint>(14); // The ITrendStrategy iTrendStrategy = new InstantTrendStrategyOriginal(symbol, 14, this); iTrendStrategy.ShouldSellOutAtEod = shouldSellOutAtEod; #region lists #endregion var security = Securities[symbol]; security.TransactionModel = new ConstantFeeTransactionModel(1.0m); }
/// <summary> /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. /// </summary> /// <seealso cref="QCAlgorithm.SetStartDate(System.DateTime)"/> /// <seealso cref="QCAlgorithm.SetEndDate(System.DateTime)"/> /// <seealso cref="QCAlgorithm.SetCash(decimal)"/> public override void Initialize() { #region logging var algoname = this.GetType().Name; mylog.Debug(algoname); mylog.Debug(ondataheader); dailylog.Debug(algoname); dailylog.Debug(dailyheader); _transactions = new List<OrderTransaction>(); string filepath = AssemblyLocator.ExecutingDirectory() + "transactions.csv"; if (File.Exists(filepath)) File.Delete(filepath); #endregion //Initialize dates SetStartDate(_startDate); SetEndDate(_endDate); SetCash(_portfolioAmount); //Add as many securities as you like. All the data will be passed into the event handler: AddSecurity(SecurityType.Equity, symbol, Resolution.Minute); // Indicators Price = new RollingWindow<IndicatorDataPoint>(14); // The price history // ITrend trend = new InstantaneousTrend(7); trendHistory = new RollingWindow<IndicatorDataPoint>(14); // The ITrendStrategy iTrendStrategy = new InstantTrendStrategyOriginal(symbol, 14, this); iTrendStrategy.ShouldSellOutAtEod = shouldSellOutAtEod; #region lists #endregion var security = Securities[symbol]; security.TransactionModel = new ConstantFeeTransactionModel(1.0m); }