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

Re: counting # bars since



PureBytes Links

Trading Reference Links

At 6:23 AM -0400 5/31/98, Carl Oberman wrote:
>lets say you have a formula that returns a value of "1" if true, "0" if
>false.  for this example lets say you are testing for an inside bar.  so if
>we have an inside bar, our formula gives us a "1."
>
>QUESTION:
>
>if i want to count the number of bars since an inside bar, is there a
>counter formula?  here are the results id like to see.
>
>
>BAR    INSIDE    COUNT
>
>1      Y         1
>2      N         2
>3      N         3
>4      N         4
>5      N         5
>6      N         6
>7      Y         1
>8      N         2
>9      N         3
>10     N         4
>11     Y         1
>12     N         2
>
>THANKS!


Try this:

----------

Vars:  InsideBar(FALSE), Count(0);
InsideBar = High < High[1] and Low > Low[1];
Count = IFF(InsideBar, 1, Count + 1);

---------

Bob Fulks