Try something like this:
Buy = ...;
Sell = ...;
Indices = BarIndex();
LastBuyBar = LastValue(ValueWhen(Buy, Indices));
LastSellBar = LastValue(ValueWhen(Sell, Indices));
Filter = (Buy AND Indices == LastBuyBar AND LastBuyBar > LastSellBar) OR
(Sell AND Indices == LastSellBar AND LastSellBar > LastBuyBar);
AddColumn(IIf(Buy, Asc("B"), Asc("S")), "Signal", formatChar);
AddColumn(Close, "Close");
AddColumn(Volume, "Volume");
Mike
--- In [email protected], "kgirish_in"
<girish.krishnamur...@...> wrote:
>
> Hi all,
>
> This is my first post on this forum. I'm relatively newbie to
Amibroker.
> However, I have managed to code a few AFL's successfully and use them
> for my trading as well. I also have an explorer that throws signals
for
> my trades.
>
> Currently, all the (BUY/SELL) signals are shown in the explorer for a
> defined period of days. However, what I'm trying to find out/do with
my
> AFL is to display ONLY the last open signal for a list of stocks -
>
> Example - My table currently looks something like -
>
> ABC 3-May SELL <<Closing price>> <<Vol>>
> ABC 30-Apr BUY <<Closing price>> <<Vol>>
> ABC 28-Apr SELL <<Closing price>> <<Vol>>
> DEF 27-Apr BUY <<Closing price>> <<Vol>>
> ABC 26-Apr BUY <<Closing price>> <<Vol>>
> XYZ 25-Apr SELL <<Closing price>> <<Vol>>
> DEF 25-Apr SELL <<Closing price>> <<Vol>>
>
>
> What I need is the following -
>
> ABC 3-May SELL <<Closing price>> <<Vol>>
> DEF 27-Apr BUY <<Closing price>> <<Vol>>
> XYZ 25-Apr SELL <<Closing price>> <<Vol>>.
>
> Any pointers/suggestion on how I can do in this Ami will be really
> helpful. Thanks in advance.
>
> Cheers,
> Girish
>