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

Re: [amibroker] CBT Perfomance?



PureBytes Links

Trading Reference Links

Hello,

"Very slow", "awful" are qualitive not quantitative statement. 
In fact it does not say anything.

Quantitative statement would be that it is four times slower or ten times slower.

You don't provide that, so it is hard to help you, if we don't know
what you mean. Of course LOW-level CBI by nature would be slower
than mid-level CBI, which in turn will be slower than high-level CBI
which is slower than built-in backtest routines.

The differences however are not "awful". They are perfectly adequate.
High-level CBI is just few percent slower. Mid-level can be 50% slower than
built-in (I am speaking about core overhead). 

First answer yourself a question:
WHY do you use custom backtester for EMA crossover?
Using hammer to kill a fly?

Second thing is that you are using LOW-LEVEL backtester mode
which is the slowest.

90% of systems can be written without custom backtester at all.
99% of systems can be written WITHOUT using low-level custom backtester.

> want to use for position sizing based on % equity in the past. 
% Equity ? 
Why dont you use SetPositionSize  function with spsPercentOfEquity mode instead?
 http://www.amibroker.com/f?setpositionsize

It does not require custom backtester at all.

And you definitely don't need LOW-level CBI to use equity-feedback.
Medium level is perfect for ALL equity-feedback scenarios.
http://www.amibroker.com/guide/a_custombacktest.html
And it is way faster.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "ifrmd" <ifrmd@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, January 28, 2008 10:09 PM
Subject: [amibroker] CBT Perfomance?


> For about 2 week's i was styding Custom BackTester Interface. 
> Everything is perfect, and i got only problem: it is very slow on my 
> notebook. I have spent hours looking for error in my code, but even 
> with simpliest EMA Crossover system, perfomance of CBI is awful. 
> 
> For backtest i've used currencies, 1Minute data, about 200 days. Or: 
> 200*1440 = 288000 bars. 
> 
> There is 2 custom backtest procedures next, both are very slow:
> 
> SetCustomBacktestProc("");
> if (Status("action") == actionPortfolio)
> {
>    bo = GetBacktesterObject();//  Get backtester object
>    bo.PreProcess();//  Do pre-processing
>    for (i = 0; i < BarCount; i++)//  Loop through all bars
>    {
>        for (sig = bo.GetFirstSignal(i); sig; sig = 
> bo.GetNextSignal(i))
>        {//  Loop through all signals at this bar
>        }//  End of for loop over signals at this ba
>        bo.HandleStops(i);//  Handle programmed stops at this bar
>        bo.UpdateStats(i, 1);//  Update MAE/MFE stats for bar
>        bo.UpdateStats(i, 2);//  Update stats at bar's end
>    }//  End of for loop over bars
>    bo.PostProcess();//  Do post-processing
> }
> 
> This was an a template, which do nothing. And it work's slow. 
> 
> SetCustomBacktestProc("");
> if(Status("action") == actionPortfolio)
> {
> bo = GetBacktesterObject();
> bo.Backtest(True);
> SumProfits = bo.InitialEquity;
>   dt = DateTime();
> for(bar = 1; bar < BarCount; bar++)
> {
> SumProfits[bar] = SumProfits[bar - 1];
> for(trade = bo.GetFirstTrade(bar); 
> trade; trade = bo.GetNextTrade(bar))
> {
> ExitDate = trade.ExitDateTime;
> if(ExitDate==dt[bar]) 
> { 
> 
> SumProfits[bar] = SumProfits[bar] + trade.GetProfit(); 
> }
> }
> if(bar == BarCount-1)
> {
> for(trade = bo.getFirstOpenPos(); 
> trade; trade = bo.getNextOpenPos())
> {
> SumProfits[bar] = SumProfits[bar] + 
> trade.GetProfit();
> }
> }
> }
> bo.ListTrades();
> AddToComposite(SumProfits,"~ClosedEquity","X", 
> atcFlagEnableInPortfolio|atcFlagEnableInBacktest|
> atcFlagEnableInExplore|atcFlagDefaults);
> }
> 
> This one plots an a equity curve (availible during backtest) which i 
> want to use for position sizing based on % equity in the past. 
> 
> btw: notebook is IBM R52 (Intel P M 750 (1,86ghz, 2m L2 Cashe), 512 
> ram and ide hard disk)
> 
> Without CBT it work's very very fast. But as soon as i begin to work 
> with CBT perfomance falls down. 
> 
> Somebody has any ideas on the thing? 
> 
> 
> 
> 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
> 
> 
> 


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/