PureBytes Links
Trading Reference Links
|
Not sure exactly what your question is... Are you asking "how
to detect that the MA had a valid value right at the start of
the range"? If yes, you can just check for the maval at the
start of the range and validate that it has a valid (> 0) value.
That should be false if the value is null at the start of the
range...
OTOH, if you're concerned that the MA will not have a value
for first 50 bars, then yes, it won't, by definition. No way
around it if you do indeed want the 50 day MA.
Jitu
--- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx>
wrote:
> thanks jitu, that's exactly along the lines I was thinking. kind of
> surprising there isn't a simpler way.
>
> one other thing: to make it easier to explain, I used price alone
as the
> criteria. what I'm really looking for is a price filter and a
liquidity
> filter. the important difference is that the liquidity measure I
want to use
> is an MA, like this:
> MA(c * v, 50)
>
> the tricky part seems to be that if a stock's data begins after the
start of
> the AA range, the first 50 bars of that expression are always null,
because
> the MA needs to get started. that's true even if price * volume was
always
> high enough to qualify.
>
> any straight ahead ideas on how to handle that?
>
> thanks again,
>
> dave
>
> As far as lowest in the range is concerned, try following -
>
> bi = BarIndex();
> start = LastValue(ValueWhen(Status("firstbarinrange"), bi));
> end = LastValue(ValueWhen(Status("lastbarinrange"), bi));
> numBars = end - start;
> llvNumBars = LLV(L, numBars);
> llvAtEndOfRange = LastValue(ValueWhen(Status("lastbarinrange"),
> llvNumBars));
>
> // Filter = llvAtEndOfRange > 10;
> Filter = True;
> AddColumn(L, "L");
> AddColumn(llvAtEndOfRange, "llvAtEndOfRange");
>
> Jitu
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx>
> wrote:
> > say I'd like to find stocks whose price has stayed above $1
within
> the AA
> > date range. any ideas how to do that?
> >
> > I thought I'd first find the lowest price within that date
range,
> but I'm
> > not sure how. the method needs to handle stocks whose quotes
start
> after the
> > beginning of the range, or end before the end of it, finding
them
> if the
> > quotes that do exist meet the criteria.
> >
> > I think the following gets you the lowest price since the start
of
> the test
> > range, but keeps looking past the end of the test range to the
end
> of all
> > quotes:
> > LastValue(LowestSince(Status("FirstBarInTest"), c))
> >
> > it seems like there should be a clean and simple way to do this,
> but I'm not
> > seeing it.
> >
> > thanks in advance for any ideas.
> >
> > dave
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|