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.aflwriting.com


On 20/02/07, dbw451 <[EMAIL PROTECTED]> 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] *On
Behalf Of *dralexchambers
*Sent:* 02/19/2007 3:05 PM
*To:* [email protected]
*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



Reply via email to