Have a look at DaysSince1900.

Mike

--- In [email protected], "bistrader" <bistra...@...> wrote:
>
> I tried the ref approach but it uses market days and I need 30 calendar days.
> 
> As for subsequent buy signal, the clock would not start again as the security 
> is still on a buy. I should have been clearer.
> 
> Thanks.  I'll continue to try to get calendar days out of this.
> 
> --- In [email protected], "Mike" <sfclimbers@> wrote:
> >
> > Hi,
> > 
> > You are not clear enough in your description.
> > 
> > Using your example; A subsequent Buy came up before the 30 days were over. 
> > So, do you start counting to 30 again from that Buy before selling?
> > 
> > If no Sell signal came over the course of 30 days since a Buy, would you 
> > still Sell?
> > 
> > You will probably need to use ExRemSpan.
> > 
> > For the case of hold exactly 30 bars then sell, regardless of redundant 
> > Buys and regardless of whether or not a Sell occurred, you would do the 
> > following:
> > 
> > Buy = ...;
> > Sell = Ref(ExRemSpan(Buy, 30), -30);
> > 
> > Mike
> > 
> > --- In [email protected], "bistrader" <bistrader@> wrote:
> > >
> > > Hello,
> > > 
> > > I have a regular backtest with Buy and Sell statements.  Is there a way 
> > > to force the buy ONLY to stay on a buy for 30 days?
> > > 
> > > Example:
> > > Buy = true 20 calendar days ago;
> > > Sell = true 8 calendar days ago;
> > > Buy - true yesterday; 
> > > 
> > > Want to force Buy to stay on buy for total of 30 days and then want to 
> > > sell but only if another Buy signal did not come along.  In this case, 
> > > system would go on buy 20 days ago and stay on buy today since had 
> > > another buy signal before 31 days was up, even though sell was true 8 
> > > days ago.
> > >
> >
>


Reply via email to