[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] One Pass Statistical Reporting



PureBytes Links

Trading Reference Links

Hi Phsst,

This caught my eye because, coincidentally, I am now helping a colleague in
my local options group test a system based on >5% GapUps closing or not!!
(Are you a secret member of sfbayoptions? :) )

So your code example is as appealing to me as the one-pass principle you are
illustrating with that code.

I am hoping to use it to get gap-close statistics on the gap-up candidates
we get each day. (I want to find out if a particular candidate's UpGaps
typically close(or not) by the next day, week, and/or month. If we get
candidates with a high enough number of UpGaps that close, we will consider
entering Bear Call Credit spreads on them.)

So I ran an Explore with your code using as a Watch List the 3 optionable
stocks(ARIA, GTRC, and IDBE) that gapped up Friday 12/5/03. And I used
'12/5/03' as my Range To and Range From. (Note: IDBE had a Low that day that
took out the previous day's High, closing its initial gap)

It may be a number of bars discrepancy, but I don't understand my results.

When I select IDBE as my current stock, I get:

   # Gaps Up > 5%     GapsClosed on Same Day     Percent Closed
   5                  1                          20.00

When I select ARIA, I get:

   # Gaps Up > 5%     GapsClosed on Same Day     Percent Closed
   48                 20                         41.67

And for GTRC:

   # Gaps Up > 5%     GapsClosed on Same Day     Percent Closed
   41                 15                         36.59

Questions:
    a)Are these results what I should expect?
    b)How can I eliminate the 'subscript out of range' errors I get when I
try to use:

        GapsClosed21 = GapsClosed21 + IIf( O[j] > H[j-1] * 1.05 AND L[j+21]
<= H[j-1], 1, 0);

      in order to see if the gaps have closed in the 21 trading days(~1
month) following the gap?

thanks

-john

----- Original Message ----- 
From: "Phsst" <phsst@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, December 06, 2003 9:18 PM
Subject: [amibroker] One Pass Statistical Reporting


> Awhile back, I suggested that Tomasz add a new 'persistant' variable
> class that would allow users to accumulate one-pass statistics during
> an explore.
>
> Well, thanks to the many posts and ideas that are freely shared by our
> friends on this board, I finally got my head 'wrapped around' a simple
> solution.
>
> The problem was that User Defined Variables are reset with each new
> ticker that AB processes... but now we can *Fool* AB by using looping
> techniques against watchlists.
>
> When we control our *own* looping through watchlists, and tell AB to
> *Apply* the Explore to the 'current stock'... AB thinks it is only
> processing one stock, and therefore preserves any user defined variables.
>
> The following example examines all quotes against all tickers in a
> specified watchlist to count the number of Gaps Up @ Open which exceed
> 5%, and then reports on how many of those GapsUp are *covered* on the
> same day. Since AB thinks it is only looking at the *current stock*,
> it preserves the user specified values that are accumulated during the
> loop, and therefore allows an accumulated statistical display in the
> Filter/AddColumn portion of the code.
>
> The same techniques in this example can be applied to accumulating
> indicator values, price and volume array values, etc. All you need to
> do is increment or decrement *your* specified variables with C[j] or
> V[j-1] or whatever subscript (+- j) rather than using native O,H,L,C,V
> references to these array variables.
>
> Try it and enjoy.
>
> One *caveat*... *Check* and *test* your code against a very small
> WatchList. If you use a large WatchList when you click on the *Check*
> button, apparently AB executes the AFL against the entire specified
> array, which could trick you into thinking that AB is locked up.
>
> ------------------------------------------------------
>
> // One Pass Stats Explore
>
> // Since internal loop controls WatchList iterations:
> //     Apply to Current Stock ONLY
> //     Range n last days = 1
>
> //WLNbr = 1; // Small Watchlist for Check button
> WLNbr = 6; // Real Watchlist
>
> list = GetCategorySymbols( categoryWatchlist, WLNbr );
>
> GapsUp = 0;    // Count of Gap Ups that exceed 5%
> GapsClosed = 0;  // Count of those Gaps which are closed on same day
>
> for(i=0; ( ticker = StrExtract( List, i ) ) != ""; i++)
> {
>   SetForeign(ticker);
>   for( j = 1; j < BarCount; j++)
>   {
>      GapsUp = GapsUp + IIf( O[j] > H[j-1] * 1.05, 1, 0);
>      GapsClosed = GapsClosed + IIf( O[j] > H[j-1] * 1.05 AND L[j] <=
> H[j-1], 1, 0);
>   }
> }
>
> SetOption("NoDefaultColumns",1);
> Filter=1;
> AddColumn(GapsUp, "# Gaps Up > 5%", 1.0);
> AddColumn(GapsClosed,"GapsClosed on Same Day", 1.0);
> AddColumn(GapsClosed / GapsUp * 100,"Percent Closed",1.2);
>
>
>
>
> 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/
>
>
>



------------------------ 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/