Hello,

If you send your post with all UPPER CASE in the *subject* line
it means that you are shouting. It is considered offensive (not merely a 
question).

Also do not truncate responses from the thread, otherwise
it is hard to keep track of the history.

To the matter:

You could use static variable (see code below) BUT this is not the point....
you still do not understand that there are *two* passes.
First pass executes formula once for every symbol under test,
then second pass executes once for portfolio equity.
If you use the code below you will get the value for last symbol under test.
Please re-read what I wrote in previous response. 

You would need to move the logic you are trying to implement
INSIDE custom backtest procedure and openpos.Symbol to
know which symbol is used for given trade.

Anyway: you should describe *final goal* you want to achieve,
not tiny coding bits because beginners often choose wrong path.

Last but not least: you should send it to tech support instead.

Best regards,
Tomasz Janeczko
amibroker.com



SetCustomBacktestProc(""); 
if( Status("action") == actionPortfolio ) 
{ 
   bo = GetBacktesterObject(); 

   bo.Backtest();

  bo.AddCustomMetric("commission", StaticVarGet("mystaticvar")); 
}
else
{
 brokercom = IIf(StrFind(Name(),"GBP.USD"),20,5);
 StaticVarSet("mystaticvar", brokercom );
}
Buy=1;
Sell=1;
Short =1;
Cover=1;

----- Original Message ----- 
From: "dralexchambers" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, May 30, 2007 4:06 PM
Subject: [amibroker] Re: IS THIS A BUG: Strange things with Backtester


> There was NO judgement intended - merely a question - I am not an 
> experienced programmer.
> 
> Thanks for the link.
> 
> Is there a way that I can set my "brokercom" variable correctly for 
> GBP.USD in the custom backtest? AFL code would be really helpful.
> 
> Alex
> 
> 
> 
> Please note that this group is for discussion between users only.

Reply via email to