I am getting REALLY strange things happening with this code.

- Brokercom = 20 for my current symbol (Name = "GBP.USD")

When I drag and drop the indicator onto a blank chart, "brokercom" 
variable plots in violet as being 20 - which is correct for the 
symbol name.

However, when I press BackTest, "brokercom" is shown in the custom 
backtest report as being 5 - when it should be 20!!!

Can anyone advise as this is strange!


PS: I have removed my trading rules for simplicity and made 
Buy,Sell,Cover,Short = 1. This makes the code short to see if you can 
replicate the error.

The symbol selected is correct (GBP.USD) and "Apply to: current 
symbol" is selected on the backtester window.


Thanks,
Alex

===================================================

brokercom = IIf(StrFind(Name(),"GBP.USD"),20,5);
Plot(brokercom,"brokercom",colorViolet);


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

   bo.Backtest();

         bo.AddCustomMetric("commission", brokercom); 
}

Buy=1;
Sell=1;
Short =1;
Cover=1;

Reply via email to