Chuck,
No apologies necessary for “bugging”
people. Sometimes it takes several tries to clarify a
question. (I’ve done it many times myself.)
Here is what I came up with that filters
on the buy and only looks for last day crosses:
Buy=LastValue(Cross(Close,MA(Close,50)));
Sell=0;
Filter=Buy;
AddColumn(ValueWhen(Buy,Close),"close");//gives
close on "buy" date
AddColumn(Close,"close");//close
The two key changes I made were to 1) add
“LastValue” to the first line and 2) filter on the Buy
condition. I didn’t test thoroughly, but… It returns
a list of tickers where either:
The current day Close is higher
than 50MA and the prior day Close is lower than the 50MA,
OR
The current day Close is lower than
50MA and the prior day Close is higher than the 50MA,
Note that I haven’t used “Cross”
before, but it appears that the Cross looks for Current Close versus prior day Close
in this context. I.e., it’s not concerned about current day Open versus
Close price.
I hope this helps.
Regards,
Dan.
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of chuckitall59
Sent: Saturday, November 05, 2005
8:50 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re:
Unbelievably Simple Question
Thanks to Anthony Faragasso,
Barry Scarborough & Graham for their
replys to my question. Unfortunately, I
didn't state my question
properly or I'm still missing something.
I want to run the Explore for say, the last 5 days
with Filter=Buy
(I'm just interested in stocks meeting the buy
criteria, thus no
filter=1 which picks up everything)
and then see the close price today for stocks that
might have been
selected 5 days ago.
As an example, if I use Anthony's code below (with
filter=buy) the
first selection it picks up is A (Agilent) which
triggered a buy on
10-31-05 Both of the close columns below
give a close of 32.01
which was correct for 10-31-05 but I'm really
looking for the close
on 11-4-05 (which was 32.8). So, how do I
use the filter=buy
statement and get the latest EOD close??? I'm
using AB 4.7 with QP2
EOD data, if it makes any difference.
Thanks again for any help-sorry to be bugging
everyone for what is
probably a super trivial question/solution.
chuck
--- In amibroker@xxxxxxxxxxxxxxx,
"Anthony Faragasso" <ajf1111@xxxx>
wrote:
>
> Buy=Cross(Close,MA(Close,50));
>
> Sell=0;
>
> Filter=1;
>
>
AddColumn(ValueWhen(Buy,Close),"close");//gives close on
"buy" date
>
> AddColumn(Close,"close");//close
>
> ----- Original Message -----
> From: chuckitall59
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Friday, November 04, 2005
10:13 PM
> Subject: [amibroker] Unbelievably
Simple Question
>
>
> I'm not a programmer nor new to
AB but this incredibly simple,
> fundamental problem has me
stumped. I'm just trying to get
todays
> close in Explore but I
continually get the close on the day the
Buy
> took place when running Explore
for several days back
(typically, n
> last days=5 or so). I've checked
Help and tried everything I can
> think of but it still gives me
the close on the buy date. How
do I
> get the following Explore code to
give me TODAYS close????
>
>
>
> Buy=Cross(Close,MA(Close,50));
>
> Sell=0;
>
> Filter=Buy;
>
>
AddColumn(Close,"close");//gives close on "buy" date
>
>
AddColumn(Ref(Close,0),"close");//still doesn't work
>
>
> Go easy on me gang-even I can't
believe I can't figure
> this out.
>
> Thanks in advance,
> Chuck
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Please note that this group is
for discussion between users only.
>
> To get support from AmiBroker
please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For other support material please
check also:
> http://www.amibroker.com/support.html
>
>
>
>
>
>
-------------------------------------------------------------------
-----------
> YAHOO! GROUPS LINKS
>
> a.. Visit your
group "amibroker" on the web.
>
> b.. To
unsubscribe from this group, send an email to:
>
amibroker-unsubscribe@xxxxxxxxxxxxxxx
>
> c.. Your use of
Yahoo! Groups is subject to the Yahoo! Terms
of Service.
>
>
> -------------------------------------------------------------------
-----------
>
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
YAHOO! GROUPS LINKS