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

Reply via email to