[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Synthetic weekly bars



PureBytes Links

Trading Reference Links


Arrays:	
	aWeekOpen[10]		(0),
	aWeekHigh[10]		(0),
	aWeekLow[10]		(0),
	aWeekClose[10]		(0);

Variables:
	nMaxSize			(10),
	nWeekCount			(0),
	nCounter			(0),
	bStart				(FALSE);


	{ *** Build weekly bar from daily bars *** }

	{ *** first bar of the week *** }
	if( DayOfWeek(Date[0]) < DayOfWeek(Date[1]) ) then begin
		if( bStart ) then begin
			for nCounter = nMaxSize DownTo 1  begin  
				aWeekOpen[nCounter] = aWeekOpen[nCounter -
1];
				aWeekHigh[nCounter] = aWeekHigh[nCounter -
1];
				aWeekLow[nCounter] = aWeekLow[nCounter - 1];
				aWeekClose[nCounter] = aWeekClose[nCounter -
1];
			end; 

			nWeekCount = nWeekCount + 1;
		end; { if bStart, at least one complete week }
	
		aWeekOpen[0] = Open;
		aWeekHigh[0] = High;
		aWeekLow[0] = Low;
		aWeekClose[0] = Close;

		if( bStart = FALSE ) then begin
			bStart = TRUE;
		end;
	end; 

	if( High > aWeekHigh[0] ) then begin
		aWeekHigh[0] = High;
	end;
	if( Low < aWeekLow[0] ) then begin
		aWeekLow[0] = Low;
	end;
	aWeekClose[0] = Close;

	{ *************** End of build weekly bar from daily bars
**************}


If someone has the EL code for generating the synthetic weekly  from daily
bars ( where a week can start on any day of the week), I would appreciate
very much if you could share a copy.

Thank you.

Barry