You’ve
got a problem with your bracketing. There’s one missing from the second ‘ref’
and an extra one where you don’t need it. Try this…
I:=RSI(9);
ValueWhen(1
,I>Ref(I,1) AND I>Ref(I,2) AND
I>Ref(I,-1)
AND I>Ref(I,-2),I)
If you’re
trying to plot a peak in the indicator, the following might do the job better
without introducing invalid bars at the right hand end of the chart from
forward-referencing. The plot is delayed/lagged by 2 bars, but then so is the
method.
I:=RSI(c,9);
{bars either
side of peak}
X:=2;
{indicator
peak flag}
Y:=HHVBars(I,X*2+1)=X;
{indicator
peak values}
ValueWhen(1,Y,Ref(I,-X))
From:
equismetastock@xxxxxxxxxxxxxxx
[mailto:equismetastock@xxxxxxxxxxxxxxx]
On Behalf Of t_r_a_d_e_r2001
Sent: Tuesday, May 24, 2005 6:24
PM
To: equismetastock@xxxxxxxxxxxxxxx
Subject: [EquisMetaStock Group]
Re: RSI Fractal coding question
I should clarify that I was trying to code for the value of a high
made by the RSI which had been preceded and
followed by 2 lower
highs of the RSI. I still can't see why the code I
gave is not valid.
--- In equismetastock@xxxxxxxxxxxxxxx,
pumrysh <no_reply@xxxx> wrote:
> Bill,
>
> When you code, set it up like this:
>
> {ValueWhen(Nth, Expression, Data Array)}
> ValueWhen(1 ,
> RSI(9)>Ref(RSI(9),-1) AND
> RSI(9)>Ref(RSI(9),-2),
> RSI(9))
>
> Dusant has already explained the forward
reference.
> The code above works. It says this is the
value of the RSI(9)
> when it is above yesterday and the day
before.
>
> Preston
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx,
"t_r_a_d_e_r2001"
> <priest_bill@xxxx> wrote:
> > Hi,
> >
> > Can anyone see a problem with this code
? Metastock states
that "this
> > variable or expression must contain only
constant data". Thanks
in
> > advance.
> >
> >
> > ValueWhen(1 ,(RSI(9)>Ref(RSI(9),1)
AND RSI(9)>Ref(RSI(9,2) AND
RSI(9)
> > >Ref(RSI(9),-1) AND
RSI(9)>Ref(RSI(9),-2),RSI(9))
Yahoo! Groups Links