Hi TJ - I have an AFL that uses params to call ( or not call ) the CBT from 2
different places in the code so I can add up to 2 different sets of stats to
the opt report. When they are both turned on, it changes all the values of the
*standard* metrics to bad values. I have isolated the problem to the fact that
the line
bo.backtest();
is executed in 2 different places. I have apparently fixed it by changing the
2nd call to
IF( 1st CBT code is shut off in params so "bo.backtest()" is not already
executed )
bo.backtest;
Could you please briefly explain what is the best way to handle the "standard"
CBT lines like the following when calling CBT from more than 1 place?...
SetCustomBacktestProc( "" );
bo = GtBacktesterObject();
bo.Backtest();
etc...
Thanks very much for any info, I have included more detailed pseudo-code below
in case you find it useful.
Steve
--------------------------------------------------------------------------------------------
Stats are not dependant on any numbers inside the backtester, they are
calculated independently and I am simply adding them to the opt report using
the way you showed me earlier...
// first call
IF( ParamToggle1 == 1 )
{
IF( Status( "action" != actionPortfolio )
{
calculate stats...
save stats to static vars...
}
SetCustomBacktestProc( "" );
IF( Status( "action" == actionPortfolio )
{
bo = GtBacktesterObject();
bo.Backtest();
retrieve static vars...
add custom metrics...
}
}
Same code is repeated later in the AFL ( adding different metrics ) for
ParamToggle2...