PureBytes Links
Trading Reference Links
|
At 1:00 AM +0000 4/14/01, kjh129@xxxxxxxxxx wrote:
>Here asking for help. Would like to create a indicator that has two
>plots. I would like to count the number of new highs in the last "N"
>number of bars, which would be plot 1, and plot 2 would be the number
>of new lows for last "N" number of bars. Would anyone know how to do
>this? Not sure how to code a "counter" in EL. I would really
>appreciate anyone's help trying to code this.
I can think of a couple of methods off hand. You do not say how you
ever reset the new-high level. You probably do not want it to just
keep getting higher forever...
The following illustrates a couple of ideas. (These are not tested.)
See the comments for a description. These do not ever reset the new
high level so you will need to decide when you would like to do that.
Bob Fulks
----
{Method 1}
Input: N(14);
Vars: HHigh(-99999), NHigh(0), HCount(0)
if High > HHigh then begin
HHigh = High; {Save new high level}
NHigh = 1; {Save location of new high}
end else NHigh = 0;
HCount = Summation(NHigh, N); {Count number over past N bars}
if ??? then HHigh = ???;
-------
{Method 2}
if High > HHigh then begin
HHigh = High; {Save new high level}
HCount = HCount + 1 - HCount[N]; {Calculate number over past N bars}
end;
if ??? then HHigh = ???;
|