Thanks Graham.  One thing I love about AFL is that many of the functions can
be written in AFL itself.  While not usually the smartest thing to do, it
sure provides a lot of flexibility whenever one wants a function to operate
a little differently.  :-)

 

Regards,

 

David

 

  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Graham
Sent: 02/19/2007 4:23 PM
To: [email protected]
Subject: Re: [amibroker] Keeping a counter

 

you could always use the straightforward way

cntr = cum(sell);


-- 
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://www.aflwriti <http://www.aflwriting.com> ng.com 



On 20/02/07, dbw451 <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> net> wrote:

Alex,

 

This works exactly the same way in AFL:

 

Cntr = 0;

for (i=0; i< BarCount; i++) { 

       if (Sell[i])

              Cntr = Cntr + 1;

}

 

Regards,

 

David

 

  _____  

From: [EMAIL PROTECTED] <mailto:[email protected]> ps.com [mailto:
<mailto:[email protected]>  [EMAIL PROTECTED] On Behalf Of
dralexchambers
Sent: 02/19/2007 3:05 PM
To: [EMAIL PROTECTED] <mailto:[email protected]> ps.com
Subject: [amibroker] Keeping a counter

 

How do you do this in AFL?

I want to keep a counter variable that adds 1 everytime a Sell=1. In 
VisualBasic it would be:

cntr = 0
for i = 0 to barcount
if Sell[i] = 1 then cntr = cntr + 1
next i

cntr then becomes the number of trades that have closed. For example, 
if there were two trades in the backtest, cntr would be 2.

Thanks - Alex

 
<http://geo.yahoo.com/serv?s=97359714/grpId=1010692/grpspId=1705632198/msgId
=106821/stime=1171920328/nc1=1/nc2=2/nc3=3> 
 

Reply via email to