{"id":479,"date":"2007-06-26T17:59:15","date_gmt":"2007-06-26T17:59:15","guid":{"rendered":"http:\/\/www.amibroker.org\/userkb\/2007\/06\/26\/data-holes-in-real-time-trading\/"},"modified":"2007-07-10T23:35:44","modified_gmt":"2007-07-10T23:35:44","slug":"data-holes-in-real-time-trading","status":"publish","type":"post","link":"http:\/\/www.amibroker.org\/editable_userkb\/2007\/06\/26\/data-holes-in-real-time-trading\/","title":{"rendered":"Data Holes in Real-Time Trading"},"content":{"rendered":"

When AmiBroker doesn?t receive data during regular trading hours, the missing period or bar is referred to as a Hole <\/em>in the data array. Holes can occur when a ticker isn?t trading or when the data feed is interrupted. They can last for any length of time and can occur in any timeframe.<\/p>\n

When a bar has no data, the bar is not added to the database. The database record simply skips to the next bar-period. Holes may be filled in during backfill or when the data provider transmits data corrections. When this happens, the database is updated.<\/p>\n

When plotting Indicators based on the selected current symbol, holes are skipped to create continuous looking charts. Because of this you cannot visually detect any holes. However, as will be explained below, this is not the case when plotting foreign data.<\/p>\n

While AmiBroker never modifies the data it collects and stores in your database, it may fill in and fix holes during operations that require a common time base. Such operations would include several AA functions, the creation of composites, and chart overlays. The process of fixing and padding data to allow these operations is called data alignment<\/em>.<\/p>\n

Data Alignment in the AA<\/strong><\/p>\n

In Automatic Analyzer (AA) operations, data Alignment can be turned On\/Off and the Reference<\/em> Symbol to be used for alignment can be specified. This is explained in the AFL Function Reference quoted below:<\/p>\n

?Pad and align to reference symbol<\/em><\/p>\n

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.?<\/p>\n

Data alignment in Indicators<\/strong><\/p>\n

Foreign data used in Indicator formulas are aligned to the current <\/em>symbol and not, as is the case in the AA, to the Reference<\/em> symbol specified in the AA Settings. Depending on the value of the fixup<\/em> parameter of the Foreign() function, data holes can be handled in any of three ways. This is explained in the AFL Function Reference as follows:<\/p>\n

?The last parameter – fixup – accepts following values<\/h3>\n