Mun Wai,
Your code works but your last bar does not get calculated
because of
your use of valuewhen in the b variable.
Do this.
Display your code as an indicator on a chart. What you will find is
that the last bar is blank or has a value of N/A...unable to
calculate.
You can also try this as your last line of
code
Ref(Cross(H,ValueWhen(1,b,b)),-1)
Problem now is
that you will be a day off with your signals which is
not what you
want.
Looks like you will need to rethink your code.
Preston
--- In equismetastock@yahoogroups.com,
wai <mwtang@xxx> wrote:
>
> I'm working to write an explorer
code that do this :
> The market have made a new low and RSI(14) <
33. It then rebounce
forming a peak with RSI(14) > 60. Buy signal : if
today high is
greater then the peak. The code is as below :
>
> a:= If(H>Ref(H,-1) AND Ref(H,1) < H AND RSI(14) >
60,H,0);{ high
peak}
>
> a1:= If(L < Ref(L,-1) AND
Ref(L,1) > L AND RSI(14) < 33 ,L,0);{ low
trough}
>
>
b:= If( ValueWhen(1,a,a) > ValueWhen(2,a1,a1) AND ValueWhen(1,
a,MDI
(13)) < ValueWhen(2,a1,MDI(13)),a,0);
>
>
Cross(H,ValueWhen(1,b,b))
>
> It works in Expert but not in
Explorer. Can anyone help. Thank you !
>
> mun
wai.
>