function run()
{
set(LOGFILE|PLOTNOW);
setf(PlotMode,PL_ALL);
BarPeriod = 1440;
LookBack = 201;
StartDate = 20161225;
//asset("DIA");
while(asset(loop("DIA", "GLD", "IWM", "QQQ", "SPY")))
{
vars Close = series(priceClose());
vars MA1 = series(SMA(Close,200));
Lots = 100;
if (Close[0] > MA1[0] && NumOpenLong == 0) {
enterLong();
}
if (NumOpenLong > 0 && Close[0] < MA1[0]) {
exitLong();
}
//plots individual charts of equity for each asset
char name[40]; // string of maximal 39 characters
strcpy(name,Asset);
var equity = EquityShort+EquityLong;
plot(name,equity,NEW|AVG,BLUE);
}
}