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

[amibroker] Re: Custom Backtest doubles opt time?



PureBytes Links

Trading Reference Links

Steve, have you already tried VarSet to define your array within AFL 
(1st pass), and then recall it via VarGet in CBT (2nd pass)?

Example:

In AFL:
MyArray = RSI();
VarSet(Name()+_"MyArray", MyArray);
. . . .

In CBT:
for( pos = bo.GetFirstOpenPos(); pos; pos = bo.GetNextOpenPos() )
. . . . 
Naam = pos.Symbol;

CBTVar = VarGet(Naam+"_MyArray");

Should work.

PS
--- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@xxx> wrote:
>
> Hmm...that does not seem to work for me either...I can retrieve the 
static variable from my regular AFL just fine, but when I move the 
StaticVarGet statement inside the CBT code,  my new column still 
shows all zeros. Sorry TJ, I don't want to keep bothering you on this 
list so I will open a support ticket in the morning after rereading 
the help files. Thanks very much for trying to help.
> 
> Steve
>   ----- Original Message ----- 
>   From: Tomasz Janeczko 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Thursday, February 14, 2008 3:34 PM
>   Subject: Re: [amibroker] Custom Backtest doubles opt time?
> 
> 
>   Hello,
> 
>   I explained it on -at list I think. Custom backtest phase (i.e. 2 
nd phase) operates not on your symbol(s), but on the portfolio equity 
ticker.
>   What you see on the chart displays symbol-derived data. This is 
different if you apply   calculation of portfolio equity ~~~EQUITY.
>   If you want to pass variables from 1-st pass to  2-nd pass you 
need to use STATIC variables, store in 1st pass and read in 2nd pass 
(CBT)
> 
>   Best regards,
>   Tomasz Janeczko
>   amibroker.com
>     ----- Original Message ----- 
>     From: Steve Dugas 
>     To: amibroker@xxxxxxxxxxxxxxx 
>     Sent: Thursday, February 14, 2008 9:16 PM
>     Subject: Re: [amibroker] Custom Backtest doubles opt time?
> 
> 
>     OK, thanks a lot TJ.  I guess I have a bigger problem anyway if 
you or anyone else knows the answer...
>     I am already calculating a stat in regular AFL that I display 
on my chart, and I am just trying to add this stat to the 
optimization report so I can sort on it.  Using bo.AddCustomMetric, 
If I define MyStat like this it works fine
> 
>     MyStat = LastValue( Cum( 1 ) );
> 
>     But if I change it to this, my new column always shows zero
> 
>     MyStat = LastValue( Cum( MyBooleanArray ) ); // array 
definitely contains some 1's and some 0's
> 
>     Any idea what could be wrong? Thanks very much for any help!
> 
>     Steve
> 
>     ----- Original Message ----- 
>       From: Tomasz Janeczko 
>       To: amibroker@xxxxxxxxxxxxxxx 
>       Sent: Thursday, February 14, 2008 5:08 AM
>       Subject: Re: [amibroker] Custom Backtest doubles opt time?
> 
> 
>       Hello,
> 
>       If you run on SINGLE ticker and actual system formula is very 
very basic (few lines), then adding CBT will have significant impact. 
>       But if you run on any larger list of symbols then it won't be 
significant at all (there is only one execution of CBT (2nd phase of 
backtest) regardless of symbol count, 
>       while there are (number of symbols) executions of 1st 
phase).  
> 
>       Bottom line: in all cases except most trivial ones, it does 
not add more than 10%.
> 
>       Best regards,
>       Tomasz Janeczko
>       amibroker.com
>         ----- Original Message ----- 
>         From: Steve Dugas 
>         To: amibroker@xxxxxxxxxxxxxxx 
>         Sent: Thursday, February 14, 2008 4:08 AM
>         Subject: Re: [amibroker] Custom Backtest doubles opt time?
> 
> 
>         Hi Graham - That run was done on current ticker only   8 - )
>         There is a lot of charting code, parameters, etc in there, 
I guess I could comment it out or create a shorter version to reduce 
the opt time...thanks!
> 
>         Just wondering though, in your experience, does accessing 
the CBI add 100% to the opt time? Does the length of the non-CBI code 
affect whether it adds 10% or 100% ?  Thanks for the advice!
> 
> 
>         Steve
>           ----- Original Message ----- 
>           From: Graham 
>           To: amibroker@xxxxxxxxxxxxxxx 
>           Sent: Wednesday, February 13, 2008 9:35 PM
>           Subject: Re: [amibroker] Custom Backtest doubles opt time?
> 
> 
>           Suggest you see if you can reduce your basic code to be 
as efficient as possible
>           Can you reduce the number of symbols used in the backtest 
by including only those you are likely to trade?
> 
> 
>           -- 
>           Cheers
>           Graham Kav
>           AFL Writing Service
>           http://www.aflwriting.com 
> 
> 
> 
>           On 14/02/2008, Steve Dugas <sjdugas@xxx> wrote: 
>             Hi All - I want to use the custom backtester interface 
for the first time, to add a custom metric. Without accessing the 
CBI, my AFL is 1,900 lines of code and takes 38 minutes to run 42,000 
opt steps. Even adding the tiny test code below doubles the opt time 
to 1 hour and 12 minutes. Just wanted to ask any of the more 
experienced CBI users if this sounds normal - I am wondering if maybe 
there is something I should change...  Thanks very much!
> 
>             Steve
> 
>             SetCustomBacktestProc
> 
>             ( "" ); 
>             if
> 
>             ( Status( "action" ) == actionPortfolio ) 
>             {
> 
>             bo = 
> 
>             GetBacktesterObject(); 
>             bo.Backtest();
> 
>             TotalModeRevs = 
> 
>             5; 
>             bo.AddCustomMetric( 
> 
>             "Total Mode Reversals", TotalModeRevs ); 
>             }
>




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
 
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/