That was the first thing that I did but is seems as if it starts 
countng from the time the signal was issued not from the time the 
position was entered.

Thanks for trying to help.

--- In [email protected], "Gordon Sutherland" <[EMAIL PROTECTED]> 
wrote:
>
> Probably an obvious question but have you checked-out the AFL 
function:
> 
> SetOption("HoldMinBars", 30 );
> 
> This does not require low level CBI.
> 
> Regards,
> Gordon Sutherland
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] 
On Behalf
> Of tipequity
> Sent: Tuesday, 25 September 2007 11:50 a.m.
> To: [email protected]
> Subject: [amibroker] Re: Min Holding Period Conundrum
> 
> Further research showed me that the value of SellNow is not carried 
> outside CustomBackTest object to the Sell line. Does anybody see 
how 
> I can achieve my objective without having to use low level CBI and 
> ExitTrade?
> 
> --- In [email protected], "tipequity" <l3456@> wrote:
> >
> > To solve this problem I decided to use CBI, however I am not 
> getting 
> > the results that I was expecting. Any help would be appreciated.
> > 
> > SetBacktestMode( backtestRegularRaw ); 
> > SetCustomBacktestProc(""); 
> > 
> > MinHoldingPer = 2;
> > 
> > if( Status("action") == actionPortfolio )
> > { 
> >   bo = GetBacktesterObject(); 
> >   bo.PreProcess(); 
> >   for( i = 0; i < BarCount; i++ ) 
> >   { 
> >    for( OP = bo.GetFirstOpenPos(); OP; OP = bo.GetNextOpenPos() )
> >    { 
> >    if ( OP.BarsInTrade >= MinHoldingPer)
> >     Sellnow = 1;
> >    } 
> >    bo.ProcessTradeSignals( i ); 
> >   } 
> >   bo.PostProcess(); 
> > }
> > 
> > Sell  =  ExitLong OR SellNow == 1;
> > 
> > 
> > 
> > --- In [email protected], "tipequity" <l3456@> wrote:
> > >
> > > How can I limit the minimum holding period from the time a 
> position 
> > is 
> > > opened not from time the buy signal was issued? The situation 
> that 
> > I 
> > > facing is that I get two buy signals, I buy after the first buy 
> > signal 
> > > and I want to hold for at least two bars (including the entry 
> bar).
> > > If I use Buy = ExRem(Buy, Sell);
> > > then if I use Sell  =  (ExitLong AND BarsSince(Buy)>=2);
> > > works fine. However then when I backtest and I have two 
> consecutive 
> > buy 
> > > signals and on the first buy siganl I don't have enough cash to 
> buy 
> > but 
> > > on the second buy siganl I have enough cash, it would not buy 
> > because 
> > > the second signal is removed.
> > > Any suggestions are appreciated.
> > > 
> > > TIA
> > >
> >
> 
> 
> 
> 
> 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
>


Reply via email to