I asked a similar question about nulls in a stdev calculation and received
Tomasz answer at
http://finance.groups.yahoo.com/group/amibroker/message/127041

Not detailed but will explain what has to be done.  Basically you have to
write a looped routine.

Ken 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of pmxgs
Sent: Friday, July 25, 2008 10:27 AM
To: [email protected]
Subject: [amibroker] Calculate MA on array which doesn't have consecutive
numbers?

Hi,

 I'm trying to calculate a moving average over a number of values which are
based on a certain condition.
For example (if close > 20 period MA, return range of bar, otherwise don't
get the value):

array=IIF(C>MA(C,20),(H-L),0); 

What I would now like is to have a 20 period moving average of only the
numbers obtained in the previously calculated array, because the array also
has zeros (when IIF condition is false), and I don't want the zeros to be
included in the MA caculation.
In other words, the problem is that, since that the IIF condition isn't
allways true, the array doesn't have consecutive numbers, so if I choose to
calculate the MA like this: MA(array,20) I won't get the correct MA (because
the zeros are included).

Can anyone give an hint on how to solve this

Thanks


------------------------------------

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



Reply via email to