[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Calling CBT from more than 1 place



PureBytes Links

Trading Reference Links

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...
__._,_.___

Please note that this group is for discussion between users only.

To get 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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___