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

[amibroker] Re: Running total array help



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "dbw451" <dbw451@xxx> 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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
On Behalf
> Of NickCivit
> Sent: 02/18/2007 7:24 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Running total array help
> 
>  
> 
> --- In amibroker@xxxxxxxxx <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: <amibroker@xxxxxxxxx <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
> > > 
> > > 
> > >
> >
>



Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.2/692 - Release Date: 2/18/2007 4:35 PM