iMA of a custom value

 

Hello all,

I need to calculate iMA from custom values, for instance Open-Close.

I was able to get this only by creating a separate indicator that calculates Open-Close values.

Partial code:

// open-close calculation handle
hoc = iCustom(_Symbol, _Period, "Custom\\oc");

// MA of open-close
hma = iMA(_Symbol, 0, per, 0, MODE_LWMA, hoc);

 

Is there a way to avoid using this former separated file?

 
aecioneto:

Hello all,

I need to calculate iMA from custom values, for instance Open-Close.

I was able to get this only by creating a separate indicator that calculates Open-Close values.

Partial code:

 

Is there a way to avoid using this former separated file?

Hello aecioneto,

please take a look at ENUM_APPLIED_PRICE.

After looking at it, please try, for instance, this:

hma = iMA(_Symbol, 0, per, 0, MODE_LWMA, PRICE_OPEN);

Regards,
Malacarne 

 
Malacarne:

Hello aecioneto,

please take a look at ENUM_APPLIED_PRICE.

After looking at it, please try, for instance, this:

Regards,
Malacarne 

Thanks for the reply, but this is different from what I need.

 Instead of just MA of PRICE_OPEN, I need MA of Open-Close (Open MINUS Close).

 
aecioneto:

Thanks for the reply, but this is different from what I need.

 Instead of just MA of PRICE_OPEN, I need MA of Open-Close (Open MINUS Close).

There is 2 solutions: 1° The one you used.

2° Use SimpleMAOnBuffer() or similar from MovingAverages.mqh.

 
Aecio de Feo Flora Neto:

Hello all,

I need to calculate iMA from custom values, for instance Open-Close.

I was able to get this only by creating a separate indicator that calculates Open-Close values.

Partial code:

 

Is there a way to avoid using this former separated file?

Thank you for posting this question. I am dealing with the same situation and now I see that I need to use a custom indicator.