[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

Hi Graham,

Thanks much!

Yuki

Thursday, December 29, 2005, 10:50:21 AM, you wrote:

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

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

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

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


G> --
G> Cheers
G> Graham
G> AB-Write >< Professional AFL Writing Service
G> Yes, I write AFL code to your requirements
G> http://e-wire.net.au/~eb_kavan/ab_write.htm



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




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