Can anyone tell me which part of this algorithm needs to be added into an existing algorithm in order to cancel out the transaction fees?

 

using QuantConnect.Orders.Fees; namespace QuantConnect { /* * QuantConnect University: Zero Fee Transaction Model * * Transaction model with zero fees. */ public class OverrideTransactionModelsAlgorithm : QCAlgorithm { string _symbol = "IBM"; bool _boughtToday = false; /// <summary> /// Initialize your algorithm configuration (cash, dates, securities) /// </summary> public override void Initialize() { //Set the start and end dates for backtest: SetStartDate(2013, 06, 01); SetEndDate(DateTime.Now.Date.AddDays(-1)); //Set algorithm cash: SetCash(200000); //Add all the securities you'd like: AddSecurity(SecurityType.Equity, _symbol, Resolution.Minute); //Set your own fee model: Securities is the collection of company objects Securities[_symbol].FeeModel = new ConstantFeeModel(0); } /// <summary> /// TradeBars Data Event Handler - all IBM data passed into the data object: data["IBM"].Close /// </summary> public void OnData(TradeBars data) { //Meaningless algorithm which buys on the 15th day of the month: // Using this we can test our $5,000 order fee :) if (Time.Day % 15 == 0 && _boughtToday == false) { Order(_symbol, 5); Debug("Sent order for " + _symbol + " on " + Time.ToShortDateString()); _boughtToday = true; } else if (Time.Day % 15 != 0) { _boughtToday = false; } } } }

Author