Foreign
|
Referencing other symbol data |
SYNTAX | foreign( TICKER, DATAFIELD, fixup = 1) |
RETURNS | ARRAY |
FUNCTION |
Allows referencing other (than current) tickers in the AFL formulas.
TICKER is a string that holds the symbol of the stock. DATAFIELD defines
which array is referenced. Allowable data fields: "O" (open), "H" (high), "L" (low),
"C" (close), "V" (volume), "I" (open Interest), and for v5.29 and above: "1" (aux1), "2" (aux2) The last parameter - fixup - accepts following values
|
EXAMPLE | // EXAMPLE 1: // EXAMPLE 2: symbol, styleLine ); |
SEE ALSO | PLOTFOREIGN() function , SetForeign() function |
Tomasz Janeczko tj --at-- amibroker.com 2003-08-07 20:28:41 | Foreign function synchronizes the data file you are referencing with the currently selected symbol. Synchronization makes sure that EACH bar of FOREIGN data matches exactly with each bar of currently selected symbol. So if DateNum() function returns 990503 for given bar then Close array represents the CLOSE of currently selected symbol at May 3, 1999 and Foreign("SYMBOL", "C") represents close of foreign symbol at May 3, 1999 TOO. This is absolutely necessary because otherwise you won't be able to do ANY meaningful operations involving both selected symbol and foreign symbol. This also needed for the display so when you mark the quote with vertical line it will always match the date displayed regardless if you use Foreign or not. Please note that if you have data holes in currently selected symbol then in order to synchronize bars Foreign function will remove bars that exist in Foreign symbol but do not exist in currently selected symbol. |
The Foreign function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.