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

Re: [amibroker] Resetting variables



PureBytes Links

Trading Reference Links



Hi Anthony,
 
I pasted your example into the Analysis 
window and the exploration results make a good example of the problem. Notehow 
the last column of the first set, representing Count1 only resets to 
zero for those bars where the buy condition is true, then picks up where it 
left off.  I want it to start over after each buy, like the second set 
which I've pasted below in blue.
 
Esteban<FONT 
face="MS Sans Serif" size=2>
 
Direct from Analysis Window
Nq3-0 9/4/2002 12:26:00 AM 0.00     
            Nq3-0 9/4/2002 
12:27:00 
AM 5178.00       Nq3-0 9/4/2002 
12:28:00 AM 5179.00   Nq3-0 9/4/2002 12:29:00 
AM 5180.00       Nq3-0 9/4/2002 
12:30:00 
AM 5180.00        Nq3-0 9/4/2002 
12:31:00 
AM 5180.00        Nq3-0 9/4/2002 
12:32:00 
AM 5181.00        Nq3-0 9/4/2002 
12:33:00 
AM 5182.00         Nq3-0 9/4/2002 
12:34:00 
AM 0.00                  Nq3-0 9/4/2002 
12:35:00 
AM 5183.00           Nq3-0 9/4/2002 
12:36:00 
AM 5184.00            Nq3-0 9/4/2002 
12:37:00 
AM 5184.00           Nq3-0 9/4/2002 
12:38:00 AM 0.00   
 
The same data as I want 
it   
 
Nq3-0 9/4/2002 12:26:00 
AM 0.00             
    Nq3-0 9/4/2002 12:27:00 
AM 1Nq3-0 9/4/2002 12:28:00 AM 2Nq3-0 9/4/2002 
12:29:00 AM 3Nq3-0 9/4/2002 12:30:00 
AM 3Nq3-0 9/4/2002 12:31:00 AM 3Nq3-0 9/4/2002 
12:32:00 AM 4Nq3-0 9/4/2002 12:33:00 
AM 5Nq3-0 9/4/2002 12:34:00 
AM 0.00                  Nq3-0 9/4/2002 
12:35:00 AM 1Nq3-0 9/4/2002 12:36:00 
AM 2Nq3-0 9/4/2002 12:37:00 AM 3Nq3-0 9/4/2002 
12:38:00 AM 0.00      
 
               
----- Original Message ----- 
<BLOCKQUOTE 
>
<DIV 
>From: 
Anthony Faragasso 

To: <A title=amibroker@xxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Friday, October 25, 2002 9:44 
PM
Subject: Re: [amibroker] Resetting 
variables
Hello,Not sure what you are looking to 
do.CondCount=Cum(V>10000);Buy=C>MA(C,28);Sell=C < 
MA(C,28);Count1=IIf(Buy,0,CondCount);Filter=1;AddColumn(Count1,"");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>      thatI 
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 ONLYto: 
amiquote@xxxxxxxxxxxxxxx> (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)>> 
Check group FAQ at:> <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html>> 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.Post 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service.