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

Re: [amibroker] Re: Summation within exploration



PureBytes Links

Trading Reference Links

cum() counts from the beginning of the data, as described in the function's description, but the display reflects the AA setting (e.g., last 20 bars).  I gather that this is a problem and you only want true/false values for the last xxx bars.  One way is to modify the code as follows:
 
lookback = param("lookback", 10, 1, 1000, 1);
barsincum = barcount - 1 - lookback;
trueresult = c > o and barindex() > barsincum;
falseresult = c <= o and barindex() > barsincum;
 
AA's parameter box provides control of param().  The number of AA rows displayed is controlled by AA's range setting.  However, only trueresult and falseresult are evaluated when the bars are in the barsincum range and will be displayed in the last "barsincum" rows.  The rows between barsincum and the range setting will all be 0.
 
Bill
 
 
 
 
----- Original Message -----
From: "mpmafma" <mpmafma@xxxxxxxxxxx>
Sent: Thursday, June 14, 2007 7:38 PM
Subject: [amibroker] Re: Summation within exploration

> Bill,
>
> Thanks for your reply. I tried this and it works when in AA the date
> range
> is "all quotations".
> But something is still puzzling me. When I choose another range, lets
> say last 20 days or a date range within AA, the cum() statement still
> counts alle quotations.
> This list is from your code
> Ticker Date/Time trueresult falseresul
> tottrue totfalse
> AEX 14-6-2006 18:02:00 0.00 1.00 387.00
> 389.00
> AEX 15-6-2006 18:01:00 1.00 0.00 388.00
> 389.00
> AEX 16-6-2006 18:02:00 0.00 1.00 388.00
> 390.00
> AEX 19-6-2006 18:02:00 1.00 0.00 389.00
> 390.00
> AEX 20-6-2006 18:02:00 1.00 0.00 390.00
> 390.00
> AEX 21-6-2006 18:02:00 0.00 1.00 390.00
> 391.00
>
> As you can see the tottrue and totfalse start counting from 387 and
> 389
>
> I changed the code to:
> Filterdate = 1060101;
> Filter =1;
> trueresult = C > O AND DateNum() > filterdate;
> falseresult = C <= O AND DateNum() > Filterdate;
> tottrue = Cum(trueresult);
> totfalse = Cum(falseresult);
> AddColumn(trueresult, "trueresult");
> AddColumn(falseresult, "falseresult");
> AddColumn(tottrue, "tottrue");
> AddColumn(totfalse, "totfalse");
>
> The correct values are now displayed but also it shows, of course,
> all quotations. Then I changed the code to:
> Filterdate = 1060101;
> Filter =1 AND DateNum() > Filterdate;
> trueresult = C > O;
> falseresult = C <= O;
> tottrue = Cum(trueresult);
> totfalse = Cum(falseresult);
> AddColumn(trueresult, "trueresult");
> AddColumn(falseresult, "falseresult");
> AddColumn(tottrue, "tottrue");
> AddColumn(totfalse, "totfalse");
>
> Now AA shows the correct daterange but also the wrong tottrue and
> totfalse values.
> It seems that this is not logical or am I missing something?
>
> regards,
>
> Frans
>
>
>
>
> --- In
amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <fimdot@xxx> wrote:
>>
>> This is going in circles.  The following gives you true, false, and
> totals.  If you want something else then tell us in simple terms what
> that is.
>>
>> filter = 1;
>> trueresult = c > o;
>> falseresult = c <= o;
>> tottrue = cum(trueresult);
>> totfalse = cum(falseresult);
>> addcolumn(trueresult, "trueresult");
>> addcolumn(falseresult, "falseresult");
>> addcolumn(tottrue, "tottrue");
>> addcolumn(totfalse, "totfalse");
>>
>> Bill
>>
>>
>> ----- Original Message -----
>> From: "mpmafma" <mpmafma@xxx>
>> To: <
amibroker@xxxxxxxxxxxxxxx>
>> Sent: Thursday, June 14, 2007 3:20 PM
>> Subject: [amibroker] Re: Summation within exploration
>>
>>
>> > Bill,
>> >
>> > My programmings skills are very limited.
>> > I tried defining trueresult and falseresult. But when you define
> this
>> > value to zero it starts counting from zero.
>> > This is the code I use.
>> >
>> > Filter = DayOfWeek()==1;
>> > Rise = IIf( Close > Open,1,0); //this gives results of 0 or 1
>> > TotalRise = Cum(Rise);
>> > AddColumn( Close-Open, "Close", 1.2,colorYellow,colorBlue );
>> > AddColumn(Rise,"Rise",1,1);
>> > AddColumn(TotalRise,"# Rise",1.0);
>> >
>> > The totalrise value counts all records in stead of the
> conditionals.
>> >
>> > regards,
>> >
>> > Frans.
>> >
>> > --- In
amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <fimdot@> wrote:
>> >>
>> >> As far as the error goes, did you look it up in the Users Guide
>> > where it is explained?
>> >>
>> >> To count true and false results, one way to go is to define
>> > trueresult and falseresult and put them into individual columns,
>> > e.g.,
>> >>
>> >> filter = 1;
>> >> trueresult = ...
>> >> falseresult = ...
>> >> addcolumn(trueresult, ...
>> >> addcolumn(falseresult, ...
>> >>
>> >> You can also incorporate cum(), sum(), lastvalue() with
> trueresult
>> > and falseresult to produce what you want.
>> >>
>> >> Bill
>> >>
>> >> ----- Original Message -----
>> >> From: "mpmafma" <mpmafma@>
>> >> To: <
amibroker@xxxxxxxxxxxxxxx>
>> >> Sent: Thursday, June 14, 2007 1:33 PM
>> >> Subject: [amibroker] Re: Summation within exploration
>> >>
>> >>
>> >> > Hi Bill,
>> >> >
>> >> > Thansk for the reply.
>> >> > It works fine within a chart formula. What I try to do is
> count
>> > the
>> >> > number a condition is true within an exploration. When I use
>> > the "cum
>> >> > ()" function all records are counted.
>> >> > When I try:
>> >> >
>> >> > Filter=1;
>> >> > result = IIf(Close > Open,1,0);
>> >> > totalresults = totalresults+result;
>> >> > AddColumn(totalresults,"tot",1,1);
>> >> >
>> >> > AB gives an error, totalresults is not defined.
>> >> > So how do I create a counter in an exploration counting the
>> > number of
>> >> > true of false conditions?
>> >> >
>> >> > kind regards,
>> >> >
>> >> > Frans.
>> >> >
>> >> > --- In
amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <fimdot@>
> wrote:
>> >> >>
>> >> >> Why do you say not working?  Works for me.  How are you
> viewing
>> >> > results?  Try
>> >> >>
>> >> >> result = ....
>> >> >> totalresults = ....
>> >> >> plot(totalresults, "totalresults", colorred);
>> >> >>
>> >> >> Click on any point and totalresults info is displayed in
> title.
>> >> >>
>> >> >> Bill
>> >> >>
>> >> >>
>> >> >> ----- Original Message -----
>> >> >> From: "mpmafma" <mpmafma@>
>> >> >> To: <
amibroker@xxxxxxxxxxxxxxx>
>> >> >> Sent: Thursday, June 14, 2007 9:04 AM
>> >> >> Subject: [amibroker] Summation within exploration
>> >> >>
>> >> >>
>> >> >> > OK, I tried to do this myself but after extensive searching
>> > this
>> >> > forum
>> >> >> > and the AFL database my last hope is to put my question on
>> > this
>> >> > forum.
>> >> >> >
>> >> >> > What I try to do is to count the number of occurrences. For
>> >> > instance
>> >> >> > Result = Open > ref(high,-1);
>> >> >> >
>> >> >> > TotalResults = cum(Result);
>> >> >> > is not working.
>> >> >> >
>> >> >> > There must be a way, anyone?
>> >> >> >
>> >> >> > kind regards,
>> >> >> >
>> >> >> > Frans.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > 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 NEW RELEASE ANNOUNCEMENTS and other news always check
>> > DEVLOG:
>> >> >> >
http://www.amibroker.com/devlog/
>> >> >> >
>> >> >> > For other support material please check also:
>> >> >> >
http://www.amibroker.com/support.html
>> >> >> >
>> >> >> > Yahoo! Groups Links
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > No virus found in this incoming message.
>> >> >> > Checked by AVG Free Edition.
>> >> >> > Version: 7.5.472 / Virus Database: 269.8.15/848 - Release
>> > Date:
>> >> > 6/13/2007 12:50 PM
>> >> >> >
>> >> >> >
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > 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 NEW RELEASE ANNOUNCEMENTS and other news always check
> DEVLOG:
>> >> >
http://www.amibroker.com/devlog/
>> >> >
>> >> > For other support material please check also:
>> >> >
http://www.amibroker.com/support.html
>> >> >
>> >> > Yahoo! Groups Links
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > No virus found in this incoming message.
>> >> > Checked by AVG Free Edition.
>> >> > Version: 7.5.472 / Virus Database: 269.8.15/848 - Release
> Date:
>> > 6/13/2007 12:50 PM
>> >> >
>> >> >
>> >>
>> >
>> >
>> >
>> >
>> > 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> >
http://www.amibroker.com/devlog/
>> >
>> > For other support material please check also:
>> >
http://www.amibroker.com/support.html
>> >
>> > Yahoo! Groups Links
>> >
>> >
>> >
>> >
>> >
>> > --
>> > No virus found in this incoming message.
>> > Checked by AVG Free Edition.
>> > Version: 7.5.472 / Virus Database: 269.8.15/848 - Release Date:
> 6/13/2007 12:50 PM
>> >
>> >
>>
>
>
>
>
> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>
http://www.amibroker.com/devlog/
>
> 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/
>
> <*> Your email settings:
>    Individual Email | Traditional
>
> <*> To change settings online go to:
>   
http://groups.yahoo.com/group/amibroker/join
>    (Yahoo! ID required)
>
> <*> To change settings via email:
>   
mailto:amibroker-digest@xxxxxxxxxxxxxxx
>   
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
>
> <*> 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/

>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.472 / Virus Database: 269.8.16/849 - Release Date: 6/14/2007 12:44 PM
>
>
__._,_.___

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___