Title: Re: [amibroker] Re: How to use AddCustomMetric() to add external values
Thanks Mike, yes that helps, a little... I will try your suggestion tomorrow (watching the US elections now) but things are not clear yet.
I am running single Backtests (from OLE) on a Watchlist in the AA and want to add custom columns to the each Backtest report. This would seems a simple everyday requirement...
First of all, I guess I should use Status("Action") = actionBacktester;
Right?
I would assume that in this case Foreign(Name()) would access the proper price arrays...
herman
Tuesday, November 4, 2008, 4:58:46 PM, you wrote:
> 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/
__._,_.___
**** 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
*********************************
__,_._,___
|