[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

Hello,

Try This:
Set n last quotations and n=1, set apply to: (all stocks, current stock,
use filter), In the example , I am exploring and counting MorningStars
between the dates 5/01/02 and 7/19/02. The ( Buy= ) is there to place
an arrow at the occurrence of the MorningStars, just double click in the
results grid to see the arrows.

Example:

MorningStar=Ref(C,-2)<=Ref(O,-2)*.99 AND Ref(O,-1)<=Ref(C,-2)AND C >
Ref(C,-2)AND C> O*1.01;

Your_condition_Here=Cum(MorningStar AND DateNum() >= 1020501 AND
DateNum() <= 1020719 );

Buy=MorningStar;
Sell=0;

Filter=Your_condition_here ;
AddColumn(your_condition_here,"Count");

Hope this helps
Anthony

miked33 wrote:

> 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
>
>
> Yahoo! Groups Sponsor
ADVERTISEMENT

>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.