PureBytes Links
Trading Reference Links
|
for (i=1; i<=Lastvalue(Barindex()); i++)
{
newarray[i] = iif(myarray[i] ==0,myarray[i-1],myarray[i] + myarray[i-1]);
}
----- Original Message -----
From: "NickCivit" <nickcivit@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, February 18, 2007 4:23 AM
Subject: [amibroker] Re: Running total array help
> --- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@xxx> 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@xxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> 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.amibroker.com/devlog/
>> >
>> > For other support material please check also:
>> > http://www.amibroker.com/support.html
>> >
>> > Yahoo! Groups Links
>> >
>> >
>> >
>>
>
>
>
>
>
> 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
>
>
>
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
|