Yes, you're right, it eventually finishes the report. I'm looking back about 3 
years right now, which is 670 trades, and it has taken it over 5 minutes, but 
it finishes.

This is exactly what I've been looking for, so again,I really appreciate the 
help. 
--- In [email protected], "ta" <tagro...@...> wrote:
>
> I think it has to do with number traders/signals that your system generate.
> I have tested it over ten years with a system that generates about 2000
> trades. It takes about 3 minutes. I don't think that AA is unresponsive. I
> think it is processing the signals. Let go I am sure it will finish.
> 
>  
> 
> From: [email protected] [mailto:[email protected]] On Behalf
> Of woodshedder_blogspot
> Sent: Sunday, September 27, 2009 9:52 PM
> To: [email protected]
> Subject: [amibroker] Re: Help Limiting number of positions added per day
> 
>  
> 
>   
> 
> Yes, that code is working. Thanks TA!
> 
> Is it normal though for it cause the AA window to go non-responsive when
> backtesting a range of more than 1 year?
> 
> I can test over 9 months and it works-with about a minute delay between the
> backtest finishing and the report being generated.
> 
> If I test over much more than 9 months, it never generates the report-
> instead it just seems to keep processing something.
> 
> Thanks!
> 
> --- In [email protected] <mailto:amibroker%40yahoogroups.com> , "ta"
> <tagroups@> wrote:
> >
> > Since you have not posted your code I can not debug it for you but the
> > following code works for me:
> > 
> > 
> > 
> > MaxBuys = 5; 
> > SetBacktestMode( backtestRegularRaw2 ); 
> > SetCustomBacktestProc(""); 
> > if ( Status( "action" ) == actionPortfolio ) 
> > { 
> > bo = GetBacktesterObject(); 
> > bo.PreProcess(); 
> > for ( i = 0; i < BarCount; i++ ) 
> > { 
> > cntBuys = 0; 
> > for ( sig = bo.GetFirstSignal( i ); sig; sig = bo.GetNextSignal( i ) )
> > 
> > { 
> > if ( sig.IsEntry() ) 
> > { 
> > // this handles limiting of number of order per day 
> > CanEnter = False; 
> > if ( CntBuys <= MaxBuys ) 
> > { 
> > bo.EnterTrade( i, sig.Symbol, True, sig.Price, sig.PosSize,
> > sig.PosScore, RoundLotSize = 1); 
> > CanEnter = True; 
> > CntBuys++; 
> > } 
> > if ( ! CanEnter ) sig.Price = -1; 
> > } 
> > } 
> > bo.ProcessTradeSignals( i ); 
> > } 
> > bo.PostProcess(); 
> > }
> > 
> > 
> > 
> > From: [email protected] <mailto:amibroker%40yahoogroups.com>
> [mailto:[email protected] <mailto:amibroker%40yahoogroups.com> ] On
> Behalf
> > Of woodshedder_blogspot
> > Sent: Saturday, September 26, 2009 3:52 PM
> > To: [email protected] <mailto:amibroker%40yahoogroups.com> 
> > Subject: [amibroker] Re: Help Limiting number of positions added per day
> > 
> > 
> > 
> > 
> > 
> > TA, thanks for the help.
> > I'm having a problem with this line:
> > bo.PostProcess();
> > 
> > This is the error I'm getting: "Error 18 COM object variable is not
> > initialized or has invalid type (valid COM object handle required)
> > 
> > Wood
> > 
> > --- In [email protected] <mailto:amibroker%40yahoogroups.com>
> <mailto:amibroker%40yahoogroups.com> , "ta"
> > <tagroups@> wrote:
> > >
> > > You need to use Custom Backtester as follows:
> > > 
> > > 
> > > 
> > > MaxBuys = 5;
> > > 
> > > SetBacktestMode( backtestRegularRaw2 );
> > > 
> > > SetCustomBacktestProc("");
> > > 
> > > if ( Status( "action" ) == actionPortfolio )
> > > 
> > > {
> > > 
> > > bo = GetBacktesterObject();
> > > 
> > > bo.PreProcess();
> > > 
> > > 
> > > 
> > > for ( sig = bo.GetFirstSignal( i ); sig; sig =
> > > bo.GetNextSignal( i ) )
> > > 
> > > {
> > > 
> > > if ( sig.IsEntry() )
> > > 
> > > {
> > > 
> > > // this handles limiting of number of order
> > > per day
> > > 
> > > CanEnter = False;
> > > 
> > > if ( CntBuys <= MaxBuys )
> > > 
> > > {
> > > 
> > > 
> > > bo.EnterTrade( i, sig.Symbol, True, sig.Price, sig.PosSize,
> sig.PosScore,
> > > RoundLotSize = 1);
> > > 
> > > CanEnter =
> > > True;
> > > 
> > > CntBuys++;
> > > 
> > > }
> > > 
> > > 
> > > 
> > > if ( ! CanEnter )
> > > 
> > > sig.Price =
> > > -1;
> > > 
> > > }
> > > 
> > > }
> > > 
> > > bo.ProcessTradeSignals( i );
> > > 
> > > }
> > > 
> > > bo.PostProcess();
> > > 
> > > }
> > > 
> > > 
> > > 
> > > From: [email protected] <mailto:amibroker%40yahoogroups.com>
> <mailto:amibroker%40yahoogroups.com>
> > [mailto:[email protected] <mailto:amibroker%40yahoogroups.com>
> <mailto:amibroker%40yahoogroups.com> ] On
> > Behalf
> > > Of woodshedder_blogspot
> > > Sent: Thursday, September 24, 2009 8:25 PM
> > > To: [email protected] <mailto:amibroker%40yahoogroups.com>
> <mailto:amibroker%40yahoogroups.com> 
> > > Subject: [amibroker] Help Limiting number of positions added per day
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Greetings group.
> > > 
> > > I want to limit the number of positions a system will take on any given
> > day.
> > > 
> > > 
> > > For example, if a system can handle 20 max positions, I would like it to
> > > only take on 5 new positions a day (assuming there are more than 5 valid
> > > signals per day) until it arrives at 20 positions, rather than taking on
> > all
> > > available positions on day 1.
> > > 
> > > Thanks for your help.
> > >
> >
>


Reply via email to