Having challenges as how to use "SimpleMA", "ExponentialMA" and "LinearWeightedMA" function from MovingAverages.mqh
use CHATGPT 4.o together with the metaEditor for MQL5. You will have got a clever combination at solving challenges in your coding endeavours.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello ALL
I have created CIndicatorBase, CiMA.mqh and iMA.mq5.
The challenge I am facing is as how to use Moving Average Functions for calculating MA on a single Index. I have populated custom price array (for input to the function) for required number of bars needed for MAPeriod.
I have tried to use price_CLOSE and MODE_LWMA and created CustomFunction: CiMA::GetLinearWeightedMA(int pPosition,int pMAPeriod,double &pPrice[]), as I found at some index price returned was zero, and MQL function was averaging including zero values.
The Blue line in the png file represents Indicator plotted by Custom iMA.mq5 where as the Red line represent MQL5 iMA Indicator plot with same settings.
As clear from it, blue line is lagging behind, and I am just wondering if I am using MA Functions correctly or some other error I am not able to realize.
The purpose of this exercise is important for me as I have quite a few custom indicators to create with custom price data, and averaging is integral part of it.
Support from experts are highly appreciated.
Thanks in Advance.
CODE FOR CIndicatorBase.mqh [Could not paste here as message exceeded 64000 characters limit. Hence attached as file]
CODE FOR CiMA.mqh
CODE FOR Custom CiMA.mql INDICATOR