Referencing other symbol data
|SYNTAX||SetForeign( ticker, fixup = True, tradeprices = False )|
|FUNCTION|| The SetForeign function replaces current price/volume arrays with those of foreign security, returns True (1) if ticker exists, False (0) otherwise.
If ticker does not exist (and function returns false) price arrays are not changed at all.
fixup parameter controls if data holes are filled with previous bar data or not.
tradeprices parameter controls if trade price arrays should be replaced too. If it is set to TRUE, then not only OHLC, V, OI, Avg arrays are set to foreign symbol values, but also BuyPrice, SellPrice, ShortPrice, CoverPrice, PointValue, TickSize, RoundLotSize, MarginDeposit variables are set to correspond to foreign security. This allows Equity() to work well with SetForeign.
Single SetForeign( "ticker" ) call is equivalent to the following sequence:
but 6x faster (SetForeign takes about the same time as single foreign). To restore original prices call RestorePriceArrays()
|SEE ALSO||FOREIGN() function , RestorePriceArrays() function|
The SetForeign function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.