/// <summary> /// Run the strategy associated with this algorithm /// </summary> /// <param name="data">TradeBars - the data received by the OnData event</param> private OrderSignal Strategy(TradeBars data) { #region "Strategy Execution" for (int i = 0; i < signals.Length; i++) { signals[i] = OrderSignal.doNothing; } // do not run the srategy after getting flat at the end of day if (SellOutEndOfDay(data)) { int tradesize = Convert.ToInt32(GetBetSize(symbol)); #region iTrendStrategy iTrendStrategy.Barcount = barcount; // for debugging // If we are holding stock, set the entry price for the strategy // the entry price is made absolute in the strategy to compare the the trigger if (Portfolio[symbol].HoldStock) { iTrendStrategy.nEntryPrice = Portfolio[symbol].HoldingsCost / Portfolio[symbol].AbsoluteQuantity; } // Run the strategy only to check the signal iTrendStrategy.maketrade = true; iTrendStrategy.SetTradesize(tradesize); signals[0] = iTrendStrategy.CheckSignal(data, trend.Current, out comment); #endregion // Execute only the selected strategy with it's signal //if(signals[LiveSignalIndex] != OrderSignal.doNothing) // ExecuteStrategy(symbol, signals[LiveSignalIndex], data); #region lists #endregion } #endregion return(signals[LiveSignalIndex]); }