Download MetaTrader 5

iMA of a custom value

To add comments, please log in or register
Search in documentation is available via MetaTrader 5. Search and learn!
Aecio de Feo Flora Neto
5521
Aecio de Feo Flora Neto 2014.10.03 13:10 

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?

Rodrigo Malacarne
Moderator
9888
Rodrigo Malacarne 2014.10.03 13:30  
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 

Aecio de Feo Flora Neto
5521
Aecio de Feo Flora Neto 2014.10.03 19:26  
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).

Alain Verleyen
Moderator
30688
Alain Verleyen 2014.10.03 20:08  
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.

To add comments, please log in or register