Hallo, I am trying to run a simple dip buying strategy backtest. The strategy buys the first stock out of the list, which price falls 2% below yesterday close and sell it at close. When I try to run with secod resolution, I alwas get error message: Memory Usage Maxed Out. Am I doing something wrong in the code?

/*

Strategy DipFast

buy intraday the first stock out of the list, which price drops below the yesterday Close * 0.98

*/

namespace QuantConnect

{

public class BasicTemplateAlgorithm : QCAlgorithm

{

string Dow30 = "MMM,APX,AAPL,BA,CAT,CVX,CSCO,KO,DIS,DD,XOM,GE,GS,HD,IBM,INTC,JNJ,JPM,MCD,MRK,MSFT,NKE,PFE,PG,TRV,UTX,UNH,VZ,V,WMT";

string symbols;

List Daily_Close;

List symbolList;

public override void Initialize()

{

SetStartDate(2008, 1, 1);

SetEndDate(DateTime.Now.Date.AddDays(-1));

SetEndDate(2015, 5, 27);

SetCash(10000);

symbols = Dow30;

symbolList = new List(symbols.Split(new char[] { ',' }));

Daily_Close = new List();

Daily_Close.Clear();

for (int n = 0; n < symbolList.Count; n++)

{

AddSecurity(SecurityType.Equity, symbolList[n], Resolution.Second);

Daily_Close.Add(SMA(symbolList[n], 1, Resolution.Daily));

}

}

public void OnData(TradeBars data)

{

for (int n=0; n

{

string symbol = symbolList[n];

if (!data.ContainsKey(symbol)) continue;

if ((!Portfolio.HoldStock) && (Time.TimeOfDay.TotalHours >= 9.54) && (Time.TimeOfDay.TotalHours < 15.75))

{

decimal buyLimit = Daily_Close[n] * 0.98m;

decimal price = data[symbol].Price;

if ( price < buyLimit)

{

int quantity = (int)Math.Floor(Portfolio.Cash * 0.99m / price);

Order(symbol, quantity);

break;

}

}

}

if (Portfolio.HoldStock)

{

if ((Time.Minute == 59) && (Time.Hour == 15))

{

Liquidate();

}

}

}

}

}

Author