Does Pad and Align assume an End of Day (23:59:59) time for daily symbols?

Hi everyone,

I'm trying to better understand how Pad and Align works. I have a 1-minute data base, which I populated with many actual quotes for forex symbols, and then I added the following:

  • 1 minute fake reference symbol, which has quotes for all trading days, with a granularity of 1 minute. So, I have quotes for 00:00, 00:01, 00:02, ..., 23:59, then for the next trading day 00:00, ... and so on
  • daily bars for SP500

I do have "Allow mixed EOD/Intraday data" checked, and had it enabled before importing daily SP500.

Now, given the code below, the backtest produces different behaviors with and without Pad and Align.

I assume AmiBroker assigns a timestamp of 23:59:59 for daily quote, which is a fair choice, because only at the end of the day one would have the Close price, and 23:59:59 is indeed the end of a day.

I would like to have someone confirm that assumption, or explain how else I get the with/without behavior shown in the picture below. With that assumption in place, it's clear that when trading happens at 00:00:00, there is no quote for that day (yet), so the one from the previous day is used.

Here is the code:

SetOption( "FuturesMode"			, False	);
SetOption( "SettlementDelay"		, 0		);
SetOption( "ActivateStopsImmediately", True	);
SetOption( "AllowSameBarExit"		, True	);
SetOption( "ReverseSignalForcesExit", False );

SetOption( "PortfolioReportMode"	, 0		);
SetOption( "PriceBoundChecking"		, False );

RoundLotSize = 0;
PointValue   = 1;

SetOption( "InitialEquity"			, 100000);
SetOption( "AccountMargin"			, 100	);
SetOption( "MaxOpenPositions"		, 200	);
SetOption( "AllowPositionShrinking"	, False	);
SetOption( "MinShares"				, 0.01	);
SetOption( "MinPosValue"			, 0.01	);

SetOption( "CommissionMode"			, 3		); // $ per share or contract
SetOption( "CommissionAmount"		, 0		); // $ commission (per side)
SetOption( "InterestRate"			, 0		);

SetPositionSize( 1, spsShares );


// very simple test rules
Buy   = DayOfWeek() == 1;
Sell  = DayOfWeek() == 5;
Short = Cover = 0;

BuyPrice   = O;
SellPrice  = C;

without%20and%20with%20PadAndAlign

Thank you!

Generally EOD records are SPECIAL. They are not 23:59:59. EOD record is internally marked in a special way (documented in ADK) and it is displayed "without time" part and it goes AFTER 23:59:59 in the sequence of records.
I don't know what version you are running (probably some old) but all modern versions in the Quotations Editor have "IsEOD" column and shown EOD records clearly.

In the absence of EOD record for given day, AmiBroker would compress intraday data to create daily bar, see this: http://www.amibroker.com/kb/2006/03/19/how-does-the-daily-time-compression-work/ for detailed explanation.

1 Like

Thank you, Tomasz!

The "AFTER 23:59:59" is the information that explains, for me, the behavior when using Pad & Align.

I'm running the most recent 64-bit version (6.35.1), and it does, indeed, indicate EOD for this symbol (but the column is way to the right, so not visible on the screen, without scrolling). What I wanted was to understand how the alignment works, and now it's clear. Thanks!