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

RE: [amibroker] Keeping a counter



PureBytes Links

Trading Reference Links

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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Graham
Sent: 02/19/2007 4:23 PM
To: amibroker@xxxxxxxxxxxxxxx
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 <dbw451@xxxxxxxx <mailto:dbw451@xxxxxxxxxxx> 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: amibroker@xxxxxxxxx <mailto:amibroker@xxxxxxxxxxxxxxx> ps.com [mailto:
<mailto:amibroker@xxxxxxxxxxxxxxx>  amibroker@xxxxxxxxxxxxxxx] On Behalf Of
dralexchambers
Sent: 02/19/2007 3:05 PM
To: amibroker@xxxxxxxxx <mailto:amibroker@xxxxxxxxxxxxxxx> 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> 
 


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.3/693 - Release Date: 2/19/2007 5:01 PM