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

Re: [amibroker] programming 101A



PureBytes Links

Trading Reference Links

Sid,

I think that I answered your question already.

Two choices:

1. no loops:

Counter = Cum( Cond ) - ValueWhen( Cond2, Cum( Cond ) );

2. with loops:

Counter = 0;

for( i = 0; i < BarCount; i++ )
{
  if( Cond[ i ] ) 
    Counter++;

  if( Cond2[ i ] )
    Counter = 0;
}

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Sidney Kaiser" <s9kaiser@xxxxxxxxxxx>
To: <AmiBroker@xxxxxxxxxxxxxxx>
Sent: Saturday, May 17, 2003 11:19 PM
Subject: [amibroker] programming 101A


> (4) Still trying to count the number of occurrences of some 
> condition.  Cond = 1 or 0.  Cum(cond) does not do the job because it is 
> counting the number of bars from the start of the data to cond.  What I 
> need to do is count is the # of times cond happened and then when cond2 
> occurs, reset  that cond counter back to zero.
> 
> TIA
> Sid
> 
> 
> Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> (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 http://docs.yahoo.com/info/terms/ 
> 
> 


--------------------------------------------------------------------------------


> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.481 / Virus Database: 277 - Release Date: 5/13/2003
> 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/uetFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(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 http://docs.yahoo.com/info/terms/