#include <contract.c>
#define PREMIUM 2.00 // $200 per contract
#define DAYS 6*7 // 6 weeks to expiration
void run()
{
set(PLOTNOW,LOGFILE);
BarPeriod = 1440;
StartDate = 20120101;
EndDate = 20190101;
History = ".t8"; // use options for price history
assetList("AssetsIB");
asset("SPY");
Multiplier = 100;
// load today's contract chain
if(!contractUpdate(Asset,0,CALL|PUT)) return;
if(!NumOpenShort) {
// find contracts with 6 weeks expiration and $2 premium
if(combo(
contractFind(CALL,DAYS,PREMIUM,2),1,
contractFind(PUT,DAYS,PREMIUM,2),1,
0,0,0,0))
{ // sell a Strangle
MarginCost = comboMargin(-1,3);
enterShort(comboLeg(1));
enterShort(comboLeg(2));
}
}
}