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

[amibroker] Re: One Pass Statistical Reporting



PureBytes Links

Trading Reference Links

This process is of course what PT uses.  Initially as an Explore and 
then later in back test mode.

--- In amibroker@xxxxxxxxxxxxxxx, "Phsst" <phsst@xxxx> wrote:
> 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);


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