<It is a good idea, but already implemented, at least if you can live
with the StaticVarSet and Get notation combined with testing
Status("StockNum") == 0, which is obscure at best.>
Dan,
I got the above OK. And yes, after years of working with AB, my brain
got tangled up on the arrays when I tried to combine them with scalers.
Thank you for the 'eye opening' LastValue(Cum(CondGap)) comment...
that did the trick.
I'll post the code that worked as a one-pass statistics calculator at
the end of this message. But onto your other comment:
<I'd rather see some kind of qualifier on variable declarations to
indicate the lifetime of the variable, and I'd rather be able to store
arrays or single values using the same notation rather than using two
very different obscure notations. But I am not complaining either :)>
You just said the same thing I was trying to say, perhaps wording it
better.
Thanks for your comments & critique.
Here is the sample 'one-pass' code for calculating statistics or
ratios on an entire watchlist or other defined group of issues: (It
does give a 'running' report with each issue that is processed).
//GapStats one pass Sample Code
// Initialize pseudo-RUN variables that will persist ONLY for life of
each Exploration execution
if( Status("StockNum") == 0 ) StaticVarSet("GapsUp2Pct", 0 );
if( Status("StockNum") == 0 ) StaticVarSet("GapsFilled", 0 );
if( Status("StockNum") == 0 ) StaticVarSet("ClosedLower", 0 );
CondGap = O >= Ref(H, -1) * 1.02; // Opening Gap up 2% or more
StaticVarSet("GapsUp2Pct", LastValue(Cum(CondGap)) +
StaticVarGet("GapsUp2Pct") );
CondGapFilled = CondGap AND L <= Ref(H, -1); // Gap filled same day
StaticVarSet("GapsFilled", LastValue(Cum(CondGapFilled)) +
StaticVarGet("GapsFilled") );
CondClosedLower = CondGap AND C < O;
StaticVarSet("ClosedLower", LastValue(Cum(CondClosedLower)) +
StaticVarGet("ClosedLower") );
PctFilled = StaticVarGet("GapsFilled") / StaticVarGet("GapsUp2Pct") * 100;
PctLower = StaticVarGet("ClosedLower") / StaticVarGet("GapsUp2Pct") * 100;
lastbar = BarIndex() == BarCount - 1;
SetOption("NoDefaultColumns",1);
Filter = lastbar;
AddColumn(Status("StockNum") + 1,"ListCount",1.0); // StockNum is zero
based
AddColumn(StaticVarGet("GapsUp2Pct"),"# 2% UpGaps", 1.0);
AddColumn(StaticVarGet("GapsFilled"),"# Filled",1.0);
AddColumn(PctFilled,"% Filled", 1.2);
AddColumn(StaticVarGet("ClosedLower"),"# Lower",1.0);
AddColumn(PctLower,"% Lower", 1.2);
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
Investment management software | Real estate investment software | Investment property software |
Software support | Real estate investment analysis software | Investment software |
YAHOO! GROUPS LINKS
- Visit your group "amibroker" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.