--- In [email protected], "dbw451" <[EMAIL PROTECTED]> wrote: > > Nick, > > > > The following logic should work: > > > > newarray[0] = myarray[0]; > > for (i=1; i<BarCount; i++) > > { > > newarray[i] = newarray[i-1] + myarray[i]; > > } > > > > > Regards, > > > > David > > This worked great! Thanks Dave
> Nick > _____ > > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf > Of NickCivit > Sent: 02/18/2007 7:24 AM > To: [email protected] > Subject: [amibroker] Re: Running total array help > > > > --- In [EMAIL PROTECTED] <mailto:amibroker%40yahoogroups.com> ps.com, "Ara > Kaloustian" <ara1@> wrote: > >Hi Ara, this worked great but I had left out a part that the loop did > not address. I have some zero values in array. So it looks like this: > > MyArray = (30,40,-20,0,0,-10); > The results I would like are: > Results = (30,70,50,50,50,40); > > The Results I'm getting are > Results = (30,70,50,-20,0,-10); > > Would be greatful if you have a solution. > > Nick C. > > have to do it in a loop > > > > for (i=1; i<=Lastvalue(Barindex()); i++) > > { > > newarray[i] = myarray[i] + myarray[i-1]; > > } > > > > ----- Original Message ----- > > From: "NickCivit" <nickcivit@> > > To: <[EMAIL PROTECTED] <mailto:amibroker%40yahoogroups.com> ps.com> > > Sent: Friday, February 16, 2007 8:30 AM > > Subject: [amibroker] Running total array help > > > > > > > Hi, I am new to programing and would like to create a running > total of > > > some numbers in an array. Example: > > > > > > MyArray = (30,40,-20,-10); > > > Result =(30,70,50,40); > > > > > > AddColumn(Result,"Result "); > > > > > > Would appreciate any help, > > > > > > Nick C. > > > > > > > > > > > > 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.amibroke <http://www.amibroker.com/devlog/> r.com/devlog/ > > > > > > For other support material please check also: > > > http://www.amibroke <http://www.amibroker.com/support.html> > r.com/support.html > > > > > > Yahoo! Groups Links > > > > > > > > > > > >
