I'm trying to evaluate the code below to see if it follows the rules at the top as they are currently defined.  Assistance in evaluating this is greatly appreciated.

 

namespace QuantConnect { // Open with 100 shares of AAL, SRPT, GT at the mark price at open. // Exit at the 10/30 EMA cross when the 10 period had crossed below the 30 period. public class TedAlgorithm:QCAlgorithm,IAlgorithm { public string[] Symbols = { "AAL","SRPT","GT" } ; ExponentialMovingAverage smaShort; ExponentialMovingAverage smaLong; DateTime Today = DateTime.Now; decimal valueFX; public override void Initialize(){ SetCash(25000); SetStartDate(DateTime.Now.Date.AddDays(-2)); SetEndDate(DateTime.Now.Date.AddDays(-1)); foreach(string sym in Symbols) { AddSecurity(SecurityType.Equity, sym, Resolution.Minute); smaShort = EMA(sym, 10, Resolution.Minute); smaLong = EMA(sym, 30, Resolution.Minute); } } public void OnData(TradeBars data) { foreach(string sym in Symbols) { valueFX = data[sym].Close; int holdings = Portfolio[sym].Quantity; //Debug("Portfolio[sym].Quantity before assiging any value : " + Portfolio[sym].Quantity); if(holdings == 0 || holdings < 0) { if(smaShort > smaLong) { MarketOrder(sym, (Math.Abs(holdings) + 100)); Debug("Purchased "+ sym +" on " + Time.ToShortDateString() + " " + holdings+ "|smaLong :"+smaLong + "|smaShort :"+smaShort+ "Portfolio[sym].Quantity after Purchased : " + Portfolio[sym].Quantity); } } else if(holdings == 0 || holdings > 0) { if(smaLong > smaShort){ MarketOrder(sym, -(100 + holdings)); Debug("Sold "+sym+" on " + Time.ToShortDateString() + "holdings : " + holdings + "|smaLong :"+smaLong + "|smaShort :"+smaShort+ "Portfolio[sym].Quantity after sold: " + Portfolio[sym].Quantity); } } } } } }

 

Author