It sounds to me like you want to use a MA value as input to the MACD rather than, say, PRICE_CLOSE.
I would suggest looking at MACD.mq4 that comes with MT4 (if yours doesn't, then tell us & I'm sure someone can post a version)
Then you'll see how iMA and iMAOnArrray are used. Switch the iMA on bar price (e.g. PRICE_CLOSE) to iMAOnArray and use your own input value by, say, setting up a MA indicator & using that buffer.
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
Hi,
I was wondering if someone can help a newbie out here.
Basically what I would like to do is attach my MA to first Indicator's data which is MACD and cannot figure out how to do this the sample code I am using is as follow.
double MacdCurrent=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0); //MACD
double EMA5c = iMA(NULL,TimeFrame,5,0,MODE_EMA,PRICE_CLOSE,MacdCurrent);//First MA attaching to MACD
double EMA20c = iMA(NULL,TimeFrame,20,0,MODE_EMA,PRICE_CLOSE,MacdCurrent); //Second MA attaching to MACD
Thank you.