Lars --
Mike's suggestion is fine. However, he failed to point out two
significant programming errors which you made.
for Try 1: Filter = RSI(14) > 30 AND RSI(14) > HHV(RSI(14),1);,
RSI(14) > HHV(RSI(14),1) can never be true because HHV() includes value
of present bar.
for Try 2: Filter = RSI(14) > 30 AND RSI(14) > (RSI(14),1);,
RSI(14) > (RSI(14),1) is meaningless (and in editor's syntax check
should have caught it).
You probably meant RSI(14) > Ref(RSI(14),1)
I'm guessing that either try1 or 2 would work, if coded error free,
though much less efficient than Mike's suggestion.
-- Keith
Mike wrote:
See the Ref function:
http://www.amibroker.com/guide/afl/afl_view.php?name=ref
<http://www.amibroker.com/guide/afl/afl_view.php?name=ref>
Note that it is better to store the result of a function call and
reuse it, rather than repeatedly executing the same function call over
and over again. Try something like:
RSI14 = RSI(14);
Filter = RSI14 > 30 AND RSI14 > Ref(RSI14, -1);
Mike
--- In [email protected] <mailto:amibroker%40yahoogroups.com>,
"larssa11" <larss...@...> wrote:
>
> Hi,
>
> I'm quite new to using Amibroker and trying to learn by typing some
formulas.
>
> One thing I can't get to work as I want is to filter that a certain
value should be higher than a certain value and also higher then
yesterday.
>
> For instance:
> Filter that RSI (14) is higher then 30 and also higher then the day
before.
> I guess this is very simple but I just can't get it to work.
>
> The objective of the formula is to filter out that the RSI value is
pointing upward.
>
> I've tried the following:
>
> Try 1: Filter = RSI(14) > 30 AND RSI(14) > HHV(RSI(14),1);
> Try 2: Filter = RSI(14) > 30 AND RSI(14) > (RSI(14),1);
>
> But that doesn't work..
>
> Is there anyone who can have a quick look and tell me what's wrong ?
>
> Thanks, Lars
>