can anyone help me with this bit of coding...
From what i understand... i can use the ExponentialMAOnBuffer() but im not so clear as to how
I really don't understand what you want or need. The link of ExponentialMAOnBuffer() points to MathExp(value) which calculate e^value.
But the MACD is the difference of two ema and the ema of that difference.
You can find the code of the MACD already on your pc here: ...\MQL5\Indicators\Examples\MACD.mq5.
BTW an ema is simple to calculate it yourself: newEma = ((newValue-prvEma)*c + prvEma) ; and c = 2/(n+1) with n being the periods on the moving average.
To get that values on any indicator use iCustom() - there is an example.
- www.mql5.com
I really don't understand what you want or need. The link of ExponentialMAOnBuffer() points to MathExp(value) which calculate e^value.
But the MACD is the difference of two ema and the ema of that difference.
You can find the code of the MACD already on your pc here: ...\MQL5\Indicators\Examples\MACD.mq5.
BTW an ema is simple to calculate it yourself: newEma = ((newValue-prvEma)*c + prvEma) ; and c = 2/(n+1) with n being the periods on the moving average.
To get that values on any indicator use iCustom() - there is an example.
Im trying to calculate for an EMA signal line... even if i cant get the line, just the values would do
i check the MACD code and i found this
/--- int limit; if(prev_calculated==0) limit=0; else limit=prev_calculated-1; //--- calculate MACD for(int i=limit;i<rates_total && !IsStopped();i++) ExtMacdBuffer[i]=ExtFastMaBuffer[i]-ExtSlowMaBuffer[i]; //--- calculate Signal SimpleMAOnBuffer(rates_total,prev_calculated,0,InpSignalSMA,ExtMacdBuffer,ExtSignalBuffer); //--- OnCalculate done. Return new prev_calculated. return(rates_total);
would it just do the change the last line of coding
//--- calculate Signal ExponentialMAOnBuffer(rates_total,prev_calculated,1,InpSignalSMA,ExtMacdBuffer,ExtSignalBuffer); //--- OnCalculate done. Return new prev_calculated. return(rates_total);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
can anyone help me with this bit of coding...
From what i understand... i can use the ExponentialMAOnBuffer() but im not so clear as to how