I think if you change your filter to Filter = 1; and do an exploration, I think you will find that the "Rise" shows a 1 for each time the condition is true and that the "#Rise" (totalrise) adds the "1's" as you are expecting.
--- mpmafma <[EMAIL PROTECTED]> wrote: > 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 [email protected], "wavemechanic" > <[EMAIL PROTECTED]> 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" <[EMAIL PROTECTED]> > > To: <[email protected]> > > 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 [email protected], "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: <[email protected]> > > >> 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 > > > > > > > > > > > Rick Osborn
