Download MetaTrader 5

iMA of a custom value

To add comments, please log in or register
Aecio de Feo Flora Neto
15363
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:

// 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
9597
Rodrigo Malacarne  
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
15363
Aecio de Feo Flora Neto  
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
29866
Alain Verleyen  
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