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

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



PureBytes Links

Trading Reference Links

Assuming I understand your query Yuki, you can add conditions to the
cum function or subtract current from a previous event
eg for buy event only in first part of day, say less than midday (time
would need to be changed depending on the time stamp of your bars.
cum( buy and hour()<12)
this will add all the buy signals from every day when the hour is less than 12.

or for each day resetting to zero without resorting to loops
eg intraday
cum( buy )  - valuewhen( datenum()!=ref(datenum(),1), cum(buy) )
Note I use the look forward Ref to use the last bar of previous day
instead of first bar of the current day
an equivalent Sum for this
sum( buy, barssince( datenum()!=ref(datenum(),1) );

or other time periods, eg monthly
cum( buy )  - valuewhen( month()!=ref(month(),1), cum(buy) )

Remember Cum just keeps adding to the previous cum value from the
first bar to the last. You need to create some mathematics and logic
to make it provide what you want.  In these examples the value to be
added is one each time as conditions only have 0 or 1. An example of
conditions not haivng just 0/1 values is the Sell condition when you
have Applystops and have used the Equity(1) to assign sell values for
the applystops. In this case you would use Sell>0 instead of Sell


--
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, Yuki Taga <yukitaga@xxxxxxxxxxxxx> wrote:
> Hi Graham,
>
> Is there a way to do this so that maximum buys (on any given day over
> the period) can be rendered?
>
> Yuki
>
> Thursday, December 29, 2005, 8:22:27 AM, you wrote:
>
> G> I assume you mean the number for each symbol individually
> G> Cum(buy) will add the signals and give the progressive answer in an exploration
>
> G> filter = buy or sell;
> G> addcolumn(cum(buy),"buys",1);
> G> addcolumn(cum(sell),"sells",1);
>
> G> If you explore over all quotations you will see the numbers
>
> G> If you were wanting to count them for all of a group of stocks
> G> combined then you need to use addtocomposite
>
> G> AddToComposite( Buy, "~Signals", "O");
> G> AddToComposite( Sell>0, "~Signals", "C");
>
> G> I use the sell>0 in case you have applystop exits, also you will need
> G> to add equity(1) before the lines to give the stops a sell number
>
>
>
>
>
>
>
> 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/