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

[amibroker] Re: How can you sum events when using Explore or Scan and get a progressive count?



PureBytes Links

Trading Reference Links

Thanks Graham,

I didn't give you enough info on what I am trying to do. Your code 
gives the same results as what I had coded. The problem is that  
cums seems to look at all the bars of a stock and sums them all. 
What I want is the number of buys and sells for each stock on a 
specific date.  

What I am trying to do is find out how many buys, sells and holds 
there are on a specific day. I set the analyzer to use all symbols 
but set the date range to and from = 12/28/05, just one day. 

To test it out I wrote a simple function to see what the results 
would be. 

myCCI = CCI(14);
Buy = IIf(myCCI > 50, 1, 0);
Sell = IIf(myCCI < -50, 1, 0);
myHold = IIf(myCCI >= -50 AND myCCI <= 50, 1, 0);
Filter = Buy OR Sell OR myHold ;
AddColumn(Cum(Buy),"#Buys",1);
AddColumn(Cum(Sell),"#Sells",1);
AddColumn(Cum(myHold ),"#Holds",1);

I ran explore and this is part of what I got. 

Ticker	Date/Time	#Buys	#Sells	#Holds	
A	12/28/2005	578	559	385	
AA	12/28/2005	4197	3834	3029	
AAA	12/28/2005	339	294	261	
AABC	12/28/2005	730	568	721	
AACC	12/28/2005	195	128	129	

What I want is a running total of the buys, sells and holds. So this 
is what I wanted to see for 12/28/05.

Ticker	Date/Time	#Buys	#Sells	#Holds	
A	12/28/2005	1	0	0	// a buy
AA	12/28/2005	2	0	0	// a buy
AAA	12/28/2005	2	1	0	// a sell
AABC	12/28/2005	2	1	1	// a hold
AACC	12/28/2005	3	1	1	// a buy

When I complete the Explore I will see the total number of buys, 
sells and holds at the bottom. How do you tell cum to only look at 
the last bar? Or is there another way to total each condition?

Thanks,
Barry


--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
>
> I assume you mean the number for each symbol individually
> Cum(buy) will add the signals and give the progressive answer in 
an exploration
> 
> filter = buy or sell;
> addcolumn(cum(buy),"buys",1);
> addcolumn(cum(sell),"sells",1);
> 
> If you explore over all quotations you will see the numbers
> 
> If you were wanting to count them for all of a group of stocks
> combined then you need to use addtocomposite
> 
> AddToComposite( Buy, "~Signals", "O");
> AddToComposite( Sell>0, "~Signals", "C");
> 
> I use the sell>0 in case you have applystop exits, also you will 
need
> to add equity(1) before the lines to give the stops a sell number
> 
> 
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
> 
> 
> 
> On 12/29/05, Barry Scarborough <razzbarry@xxxx> wrote:
> > I am scanning with a specific criteria and I want to find how 
many
> > stocks give a buy signal and how many a sell signal. I have 
tried to
> > use sum and cum but the results seem to be wrong. As explore
> > progresses through the database I see the buys and sells but I 
added a
> > column in explore and tried to watch the number of events 
accumulate
> > but the number never changes. I know there must be an easy way 
to do
> > this but it alludes me. How would I count the events and then 
put it
> > in the output column so I can see the number rise with each 
signal?
> >
> > Thanks,
> > Barry
> >
> >
> >
> >
> >
> >
> > 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
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/