Intercept Friday Daily Close

Posted By: tradingest

Intercept Friday Daily Close - 12/12/18 20:40

Hi guys,

I use the code below for the Close and Open of the previous day.
Monday I have a problem to identify correctly the close on friday.
The code below consider the close on sunday. Why?
How Can I make intercept the right close on friday without consider sunday?

Code:
function run()
{
	
	var open; var close; 
	StartDate = 20181101;
	EndDate = 20181130;
	#define H24 (1440/BarPeriod)
	#define H4 (240/BarPeriod)
	#define H1 (60/BarPeriod)
	
	StartWeek = 10000;
	EndWeek = 52300;

	BarPeriod = 60; // 1 hour (60 minutes) bars

	// create a 4-hour price series ///////////////////////////////////
	TimeFrame = H4;
	vars PriceH4 = series(priceClose());
	 
	// create a 24-hour price series /////////////////////////////////
	TimeFrame = frameSync(H24);
	vars CloseH24 = series(priceClose());
	vars OpenH24  = series(priceOpen());

	close=CloseH24[0];
	open=OpenH24[0];
}



thanks
Posted By: Dalla

Re: Intercept Friday Daily Close - 12/14/18 15:41

Check out startweek and endweek
https://zorro-project.com/manual/en/date.htm

Default startweek is Sunday 23 utc
Posted By: tradingest

Re: Intercept Friday Daily Close - 12/17/18 21:42

Originally Posted By: Dalla
Check out startweek and endweek
https://zorro-project.com/manual/en/date.htm

Default startweek is Sunday 23 utc


Hi Dalla,

I try it but I can't recover the friday close.
Posted By: OptimusPrime

Re: Intercept Friday Daily Close - 12/18/18 18:25

Hi TradingEst:

Did you take a look at the Weekend variable specifically? "Weekend affects the sampling of price data and thus must be set before any asset calls."
© 2024 lite-C Forums