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

RE: [amibroker] AFL to count Number of Trues within a period



PureBytes Links

Trading Reference Links

Would this help?

//AFL to count the number of trues within a period. For instance a
//variable A toggles between 1 AND 0. I want to count the number of
//times it toggles within 21 bars.

//Watch out for line wraps!

BarCount = Cum(1); // you could use dates as well
Start = 100; // or this could be something like Start =
ValueWhen(Buy,Barcount);
Stop = 200; // or this could be something like stop = Start + 21;
Event = ROC(C,1) > 2; //Event = A: You use your own "A" criteria (True)
here
EnableCount = (BarCount >= Start) AND (BarCount <= Stop);
CountEvents = Cum(EnableCount AND Event);
Plot(CountEvents,"CountEvents",1,1);
GraphXSpace = 5;

Good luck,
Herman.

-----Original Message-----
From: miked33 [mailto:miked@x...]
Sent: Saturday, July 20, 2002 3:53 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] AFL to count Number of Trues within a period


Can someone help me to write:

AFL to count the number of trues within a period. For instance a
variable A toggles between 1 and 0. I want to count the number of
times it toggles within 21 bars.

thanks





Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/