Download MetaTrader 5

how to get the value of iMACD for a given bar in mql5?

To add comments, please log in or register
Format text in the messages editor. It is convenient!
acman
7
acman 2016.06.14 08:37 

Hi

I searched for a simple way to calc the macd (iMACD) for the last bar (or for a given bar number) but couldn't find a clear solution for that. The documentation got me confused.

Can someone show me one simple example please?

thanks
Ernst Van Der Merwe
4733
Ernst Van Der Merwe 2016.06.14 10:01  
int handle;
double MACD[1];

int OnInit()
  {
   handle=iMACD(NULL,0,12,26,9,PRICE_CLOSE);
   
   
void OnTick()
  {
   if(CopyBuffer(handle,0,5,1,MACD)>0)
      printf("Value of iMACD index[5] = %f",MACD[0]);
To add comments, please log in or register