void run() {
set(PRELOAD|LOGFILE);
BarPeriod = 1440;
BarZone = ET;
BarOffset = 15*60;
StartDate = 20130101;
EndDate = 20151231;
PlotWidth = 1000;
PlotHeight1 = 400;
Multiplier = 100;
assetList("Assets");
if(is(FIRSTINITRUN)) {
asset("SPY");
dataLoad(1,"SPY_Options.t8",9);
asset("YHOO");
dataLoad(2,"YHOO_OptionsSim.t8",9);
}
string assetName;
while (assetName = loop(Assets)) {
asset(assetName);
if (assetName == "SPY") contractUpdate(assetName,1,CALL|PUT);
else if (assetName == "YHOO") contractUpdate(assetName,2,CALL|PUT);
var CurrentPrice = ifelse(is(TRADEMODE),priceClose(),Contracts->fUnl); // the current underlying price (unadjusted)
CONTRACT* c = contract(PUT|ONLYW3,30,CurrentPrice);
if(contractDays(c) == 31 /*&& assetName == "YHOO"*/) enterShort();
}
}