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

Re: Is this possible ?



PureBytes Links

Trading Reference Links

You should know the total population of your database.
If this number is t and let for ^NDX t=101, then 

t1=Foreign("_WHITECD","V");
t=101;/*put here the population of your database*/
p=100*t1/t;
graph0=p;

Dimitris Tsokakis

PS : In Nasdaq100 this number is 101. If you scan other
databases, the number may vary for various reasons.
In this case I use the following technique.
I run two complementary composites, (in your example
C>O and C<=O are two categories including all stocks)
Change the beginning of the code with
/*STOCKS WITH C<=O*/

values = C<=O;

EnableScript("vbscript");

days = Day();
months = Month();
years = Year();
initialize = Status("stocknum") == 0;

<%
Name = "_NOTWHITECD"

leaving the rest as it is in /*STOCKS WITH C>O*/
Now, after two runs, you know how many stocks have C>O and 
how many C<=O. in Ind builder you may have

t1=Foreign("_WHITECD","V");
t2=Foreign("_NOTWHITECD","V");
t=t1+t2;
p=100*t1/t;
graph0=p;

It looks strange but, we do not have a direct method to count in 
AFL world, although counting is the first thing we need.
Even when you scan or Explore, there is not any counter in the results
table.
So, counting is covered with such tricks.
Dimitris Tsokakis

--- In amibroker@xxxx, "ct1942" <ct1942@xxxx> wrote:
> Dimitris,
> Can you show me how graph this as a percent?
> 
> TIA,
> ct1942
> 
> --- In amibroker@xxxx, "dtsokakis" <TSOKAKIS@xxxx> wrote:
> > Hi,
> > In Automatic analysis paste the
> > 
> > /*STOCKS WITH C>O*/
> > 
> > values = C>O;
> > 
> > EnableScript("vbscript");
> > 
> > days = Day();
> > months = Month();
> > years = Year();
> > 
> > initialize = Status("stocknum") == 0;
> > 
> > <%
> > Name = "_WHITECD"
> > 
> > days = AFL("days")
> > months = AFL("months")
> > years = AFL("years")
> > values = AFL("values")
> > initialize = AFL("initialize")
> > 
> > 
> > Set oAB = CreateObject("Broker.Application")
> > 
> > If initialize Then
> > oAB.Stocks.Remove( Name )
> > End If
> > 
> > 
> > Set comp = oAB.Stocks.Add( Name )
> > 
> > For i = 0 To UBound( days )
> > 
> > Set qt = comp.Quotations.Add( years( i ) & "-" & months( i ) 
> & "-
> > " & days( i ) )
> > If values( i ) = 1 Then qt.Volume = qt.Volume + 1
> > 
> > Next
> > 
> > If initialize Then
> > oAB.RefreshAll()
> > End If
> > 
> > %>
> > 
> > Buy = 0;
> > /*end of code*/
> > 
> > Scan All Stocks for All quotations.
> > Now, in Ind. builder paste the
> > 
> > Graph0=Foreign("_WHITECD","V");
> > and you will see the graph of stocks with Close>Open per Day.
> > (I named the artificial ticker "_WHITECD", because your condition 
> is 
> > a white candle.)
> > The technique is described in
> > http://www.amibroker.com/newsletter/12-2001.html
> > 
> > Dimitris Tsokakis 
> > --- In amibroker@xxxx, "kbennett99" <kbennett@xxxx> wrote:
> > > I think I'm out of my depth, but is there any way I could 
> > accomplish 
> > > the following ?
> > > 
> > > By way of example only, could I count the number of Naz 100 
> stocks 
> > > which closed above the open each day, and plot this number over 
a 
> > > period of time ?
> > > 
> > > Keith B