What about something like:
Phigh = ( H > Ref (H, 1) AND H > Ref (H, -1) );
PhighPrice = ValueWhen(Phigh, H, 1);
Buy = Cross(H, PhighPrice) OR ...
Note that your Phigh calculation is looking into the future. So,
you'll need to adjust for that before taking the buy. Also, I don't
have AmiBroker in front of me right now, so you'll have to
validate whether the above is correct or not.
Mike
--- In amibroker@xxxxxxxxx ps.com, James <jamesmemphis@ ...> wrote:
>
> How do I reference only the last condition? In this case, say I
want to buy when price crosses above the last pivot high or below the
last pivot low. I define pivot high as:
> Phigh = ( H > Ref (H, 1) AND H > Ref (H, -1) );
> I want to buy if price crosses the last occurence of
this and not
an occurence 20 bars ago that could be at a lower price. So Phigh is
only the last Phigh. Hope this makes sense.
> Thanks in advance,
> James
>
>
>
____________ _________ _________ _________ _________ _________ _
____________ __
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now.
http://mobile. yahoo.com/ ;_ylt=Ahu06i62sR 8HDtDypao8Wcj9tA cJ
>