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

Re: Resetting variables



PureBytes Links

Trading Reference Links

Bonjour,

start=Cross(C,MA(C,20));
Plot( Sum(V>100000,BarsSince(start)) ,"",7,1);

> That would work if I wanted to count all the bars since the Buy. I 
only want to count the ones that meet a condition. See my message 
that was posted a few minutes earlier for an example.
> 
> Maybe this is a much more complicated issue than I thought. 
> 
> ----- Original Message ----- 
> From: Anthony Faragasso 
> To: amibroker@xxxx 
> Sent: Friday, October 25, 2002 10:40 PM
> Subject: Re: [amibroker] Resetting variables
> 
> 
> Hello,
> 
> How about this;
> 
> Buy=C>MA(C,28);
> Sell=C < MA(C,28);
> 
> x=BarsSince(Buy) ;
> y=BarsSince(Sell);
> 
> Filter=1;
> AddColumn(x,"x");AddColumn(y,"Y");
> 
> 
> Esteban wrote:
> 
> > Say I am incrementing a variable that counts the number of 
trades of
> > volume > 10000 using the cum function.count = cum(v > 
10000) ;But I
> > don't want a count from the beginning of the data set. I want 
the
> > count from an event. I've thought of several ways to 
accomplish this
> > in principle, but I always run up against the same issue no 
matter
> > what scheme I devise. The reset doesn't stick, it's only good 
while
> > the condition that causes it is true. Here 's an example. 
Reset the
> > value of the variable and start the count again after each 
buy, like
> > in vb.
> >
> > count = iif(buy, 0, count) ; The problem I run into here 
is
> > that I can't reference the the variable count in the 
formula
> > if it hasn't already been assigned. Therefore with the
> > formula above count = 0 only on the bar that buy is true.
> > The next bar it reverts to whatever it was previously
> > assigned. This doesn't give the effect of resetting.
> >
> > I've given this a lot of thought and tried to work around it a 
number
> > of ways. I'm stumped. Any help is greatly appreciated.
> >
> > Esteban
> >
> >
> >
> > Yahoo! Groups Sponsor
> ADVERTISEMENT
> 
> 
> >
> > Post AmiQuote-related messages ONLY to: amiquote@xxxx
> > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> >
> > Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.
> 
> 
> 
> Yahoo! Groups Sponsor 
> ADVERTISEMENT
> 
> 
> 
> 
> Post AmiQuote-related messages ONLY to: amiquote@xxxx 
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> 
> Check group FAQ at: 
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.