PureBytes Links
Trading Reference Links
|
Herman,
To use Foreign, you need to know exactly which symbol you want to
reference. Because the custom backtest is run only once, and does not
have a current symbol, your function would only be called once and
would be called only with the symbol provided in the call.
As such, you would probably want to alter the function definition to
receive the array directly. This way, any array can be passed in
without having a hard coded Foreign statement within the function
itself.
e.g.
function Test(values) {
return LastValue(values);
}
You would then code your custom backtest as follows:
if (Status("action") == actionPortfolio) {
...
T = Test(Foreign("ORCL", "O")); // Single foreign symbol.
...
}
If you are trying to have your function called for each symbol in your
watchlist, you would have to add looping code to iterate through your
watchlist and call Test for each symbol, using Foreign with each new
symbol name as folllows:
if (Status("action") == actionPortfolio) {
...
listnum = ... // Your watchlist
list = CategoryGetSymbols(categoryWatchlist, listnum);
for (i = 0; (sym = StrExtract(list, i )) != ""; i++) {
T = Test(Foreign(sym, "O");
}
...
}
Does that help?
Mike
------------------------------------
**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
*********************************
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|