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

RE: [amibroker] Calculate MA on array which doesn't have consecutive numbers?



PureBytes Links

Trading Reference Links

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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of pmxgs
Sent: Friday, July 25, 2008 10:27 AM
To: amibroker@xxxxxxxxxxxxxxx
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




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

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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/