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.
// 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?
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);
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.