Pad and Align works as documented, was: Fill Weird

Hi all, I am dealing with US stock market data with 15s bars. The data feed I am using is DTN IQfeed. As you probably can imagine, the data do have lots of holes and I hope to fill those holes when I am doing analysis with prior bar values and with zero volume. Therefore, I check the "pad and align option" with the reference symbol being SPY.
image

The following is my code to explore 200 symbols' data at 9.15.15am:

tn = TimeNum();
newTradeDay = DateNum() != Ref(DateNum(), -1);
sum_vol_intra = SumSince( newTradeDay, V) + ValueWhen( newTradeDay, V );
Filter= tn == 91515;

AddTextColumn(FullName(), "Symbol Name");
AddColumn(O,"Open");
AddColumn(H,"High");
AddColumn(L,"Low");
AddColumn(C,"Close");
AddColumn(V,"Volume",1.0);
AddColumn(sum_vol_intra,"Volume Today",1.0);

Without Pad and Align the result is:
image
It makes perfect sense since it only shows bars with data at that time.

However, with Pad and Align on the result is:
image
Not only are there much more symbols with a non-zero volume (which they shouldn't as at that point there is no trading volume), when you look closer into the symbol itself, like "ZOM" and "NAK" the original volume now changed!

My question is: Am I missing anything here? What logic inside "Pad and Align" would cause this issue? Most importantly, if I wish to fill empty bars with previous values but with a zero volume while doing analysis/portfolio backtesting, what is the best approach?

I really look forward to any help!!! Thank you so much for reading my post!

Instead of making (incorrect) assumptions why don't you JUST READ THE MANUAL?

Quote from manual:

https://www.amibroker.com/guide/w_settings.html

Pad and align to reference symbol

When this is turned on, all symbols' quotes are padded and aligned to reference symbol. Note: by default this setting is OFF. Use responsibly. It may slow down backtest/exploration/scan and introduce some slight changes to indicator values when your data has holes and holes are filled with previous bar data.
The feature is intended to be used when your system uses general market timing (generates global signals based on data and/or indicators calculated using Foreign from 'reference' symbol) or when you are creating composites out of unaligned data. Note: if reference symbol does not exist, data won't be padded.

There is NOTHING weird. Everything works as documented. Holes are filled with PREVIOUS BAR DATA. All fields are treated the same way.

Don't assume. Just read the docs. The documentation specifies PRECISELY how features work. Zero is not used for volume because zeros tend to hugely distort many indicators, even simplest ones as moving averages. The way how it works is precisely and purposely selected to minimize impact of padding on values of indicators.

2 Likes

Hi Tomasz, I really appreciate the very prompt reply. Sorry for the wrong wording in my original post. I understand things should work and problems are likely on my side.

The thing that confuses me most is how the original volume data gets changed as well. For example, "NAK" is originally non-empty and has a volume of 41867, after padding it becomes 25183.

One possible reason I could think of is that SPY itself is not a perfect symbol that has absolutely no holes. (Though, it has full data around 9.15.15am that day) Do you think that's the case?

I hope to make it clear that I love Amibroker so far very much as after having tried many platforms this is the one I chose. It's just that I wish to understand how that volume data changed after turning "Pad and Align" on.

Thank you so much for the attention and the help.

Use Tools->Database Purify to find data errors in the database. It will report all kind of misalignment.