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 -----
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@xxx> 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@xxx> >> 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 > > <*> 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.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
SPONSORED LINKS
__,_._,___
|