iMAOnArray returns to me strange values

Back to topics list To post a new topic, please log in or register
avatar
31
leourb_ 2015.09.09 22:18
 

Hi,

I am trying to build an indicator and I need an MA on a Buffer I am calculating. For this reason I used the iMAOnArray function. Buffer's field of existence is [0;1]  and it also usually never comes above .5. 

When trying to get this MA set as:

double temp = 0.0;
temp = iMAOnArray(ExtUpProb /*(one of indicators buffer)*/, 200 /*(I want to take in account only the last 200 buffer elements)*/, 14 /*(MA Period)*/, 0,1,0);

but it returns to me 0 or BILLIONS in value! (at most a constant value sometimes).

I have declared the container variable, I have initialized it but result is always the same. How could I configure it?

In the indicator's for loop it should be:

for (int i = Bars-1; i>=0; i--)
{
//...
ExtUpProb[i] = // stuff
iMAOnArray(ExtUpProb,200,14,0,1,0); or iMAOnArray(ExtUpProb,200,14,0,1,i); with "i" shift to let it dynamic? }

 

Thank you very much! 

avatar
Moderator
3408
GumRai 2015.09.10 01:16 #
 
for (int i = Bars-1; i>=0; i--)
 {
  //Fill buffers
 }

for (int i = Bars-1; i>=0; i--)
 {
 IMAOnArray()
 }
Fill the buffers before calling IMAOnArray
avatar
31
leourb_ 2015.09.10 17:43 #
 

Done, that was the problem.

Many thanks! 

Back to topics list  

To add comments, please log in or register