Altering Workshop script for shorter time frame

Posted By: TimExcellent

Altering Workshop script for shorter time frame - 12/09/21 18:42

Hi,

I'm trying to alter presumably quite an old script that is also in the Blackbook for options trading and also trying to figure out how to change this simple script to trade a much shorter time frame using some 1 minute options data I have. How should the identifier/pointer for the SPX history be formatted in this case and error in the script? My simple thinking was that Zorro should be able to see "*.t8" files and then the Asset pointer being SPX it should see the files (hopefully should also see the screenshot attached):


Code
// Workshop 8: Simple Option system //////////////////////////////////////////
#include <contract.c>

#define PREMIUM	3.00


void run() 
{
	StartDate = 20210104;
	EndDate = 20210110;
	BarPeriod = 1;
	set(PLOTNOW,LOGFILE);

	History = "*.t8"; // options data for price history
	assetList("AssetsTS");
	asset("SPX");
	Multiplier = 100;

// load today's contract chain
	if(!contractUpdate(Asset,0,CALL|PUT)) return;

// Enter new positions
	if(!NumOpenShort && !is(LOOKBACK)) { 
		if(combo(
			contractFind(CALL,2,PREMIUM,2),1, 
			contractFind(PUT,2,PREMIUM,2),1,
			0,0,0,0)) 
		{
			MarginCost = comboMargin(-1,3);
			enterShort(comboLeg(1));
			enterShort(comboLeg(2));
		}
	}
}


Attached picture Zorro Screenshot 2021-12-09 133041.png
Posted By: AndrewAMD

Re: Altering Workshop script for shorter time frame - 12/09/21 19:54

Zorro only supports the t8 file format ASSETNAME_YYYY.t8 for intraday history t8 files. For your filename convention, you need to manually load t8 datasets and feed it into the contract functions.
© 2024 lite-C Forums