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

Re: [amibroker] Counting without AddToComposite



PureBytes Links

Trading Reference Links

Hi quchi,
here is a similar task realized using the ABtool plugin.
You can find ABtool in the file and 3rd party areas.
UM

/*------------------------------------------------------------
xxCountStocks.afl

   Counting stocks during an Exploration run
   using functions in ABtool v0.9.3.7+

   Here, an environemnt variable is used to save a
   counter number during an exploration run

   Written 030512Mo by Uenal Mutlu
------------------------------------------------------------*/

   xxABtoolInit();
   MyEnvName = "MySavedCounter";   // give it a name

   if (status("stocknum") == 0)
     { // this is executed only for the very first ticker scanned

       // save the counter as 0 in the environment variable
       xxEnvSet(MyEnvName + "=" + 0);    

       // to verify that this is executed only once 
    // xxMsgBox("The first stock scanned is: " + Name(), "Info");
     }

   // your Buy/Sell/Short/Cover formulas goes here
   // ...

   // Filter condition
   if (1)
     Filter = C > 1.25 and C < 35;            // for test 
   else 
     Filter = Buy or Sell or Cover or Short;  // for real life   

   // if stock is in Filter then increment the counter and save it:
   counter = xxToNumber(xxEnvGetValOnly(MyEnvName));  // get the current value of counter
   if (LastValue(Filter))
     { // increment and save the counter
       counter++;  
       xxEnvSet(MyEnvName + "=" + counter); 
     }

   // print the current value of counter in a column of the results tab
   // as usual: only those in Filter get printed
   AddColumn(counter, "counter", 1);

//------------------------------------------------------------


----- Original Message ----- 
From: "quchi" <adrian@xxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, May 12, 2003 5:05 AM
Subject: [amibroker] Counting without AddToComposite


> Hi
> 
> Is it possible to do an Explore on all stocks and display (addColumn)
> how many times cond1 and cond2 occurs?
> For example I have
> gd=GapDown();
> gu=GapUp() ;
> I'd like to display in AA without using AddToComposite how many 
> stocks are gapping up and how many are gapping down.
> I thought that is gonna be easy/possible with the new 
> for/while etc but I'm kind of lost.
> Am I on a wrong track? :)
> Any suggestions will be very helpful
> thx



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs from home.
Over 14,500 titles. Free Shipping
& No Late Fees. Try Netflix for FREE!
http://us.click.yahoo.com/BVVfoB/hP.FAA/uetFAA/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/