Short tutorial (YouTube) explaining the pad/align feature in Amibroker. The speaker (Adrian Reid) defines padding as filling missing stock bars by copying the last good bar so index-based indicators and index filters calculate correctly during backtests, preventing distortion when stocks don’t trade every market day.
Chapters
In amibroker, there's a function called pad and line. And if you've ever wondered how and when you should use padding in your trading systems for backtesting, stick around and watch this video. I'll explain exactly what it does and when you should use it. But before we go any further, make sure you hit the subscribe button and give this video a thumbs up so that you get notified of all of my future videos, because I've got new trading content coming out all the time and I don't want you to miss a thing.
So padding, it's basically filling in the blanks, the blank bars where a stock didn't trade. So the index will have data every single day that the market is open. But a stock may not trade every single day. Maybe it trades here, here, here, Mrs. This day, and then here and here and here. So it could be on trading halt. Maybe there's just no buyers and sellers if it's a very illiquid stock.
So a stock doesn't necessarily have a price bar every day.
So the reason we use padding is to make sure, let's say that there's four bars in a stock and one of them is missing. And we have a trading system, and the trading system uses an index filter. And the index filter has data for all four bars, including the missing one. Make sense so far? Yeah.
In order to get the correct signal from the index filter as to when to turn the system on, when to turn the system off, what you do is you pad the data and you add an artificial bar here, which is basically a copy of the last good bar.
So that way the index indicators calculate correctly. Because if there was no bar here, when the, the back tester runs, the back tester on this stock will ignore this bar on the index.
Make sense? Because there's no stock bar, so there's no calculation of the index on that bar. So it just, if the stock has gaps, it distorts the index filter.