PureBytes Links
Trading Reference Links
|
for some reason i cant get Sum() to work.
i have two arrays
z [0, 1, 1, 0, 1, 0, 0, 1, 1] p [1, 0, 1, 1, 1, 1, 0, 1, 0]
what i'm trying to do is calculate:
z/p
which should be 5/6 or 0.83
im trying it like this:
numberofcellsinarray = LastValue(BarIndex()) + 1; sumZ = Sum(z, numberofcellsinarray); sumP = Sum(p, numberofcellsinarray);
result = sumZ/sumP;
but this wont display anything in the automatic analysis window
can anyone suggest a good way to do this?
--- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@xxx> wrote: > > Sum() will give you the sum of all values. If you have ones and zeros, that > result will be same as number of ones. > > Lastvalue(BarIndex()) + 1 will give you the number of cells in array. > > ----- Original Message ----- > From: "bigitop" doctormuniz@xxx > To: amibroker@xxxxxxxxxxxxxxx > Sent: Tuesday, February 24, 2009 11:05 AM > Subject: [amibroker] counting values within an array > > > > > > i have an array that contains zeros and ones. what function can i use > > to count all the ones and zeros in the array? > > > > > > > > > > > > ------------------------------------ > > > > **** IMPORTANT PLEASE READ **** > > This group is for the discussion between users only. > > This is *NOT* technical support channel. > > > > TO GET TECHNICAL SUPPORT send an e-mail directly to > > SUPPORT {at} amibroker.com > > > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at > > http://www.amibroker.com/feedback/ > > (submissions sent via other channels won't be considered) > > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > http://www.amibroker.com/devlog/ > > > > Yahoo! Groups Links > > > > > > > > >
__._,_.___
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
__,_._,___
|