New on MQL 5/ MA problem

 

Hi ,


today i migrated from MQL4 to MQL5.

And nothing is working anymore, atleast thats what i am experiencing.

I tried to plot a simple MA and print its numbers out but the number remains static.

Normally it should give me the value of the MA for example for US500 it should give me something like " MA 2964.1234".

But i get "MA 11.00"

what am i missing ?


thanks in advance :)


#property copyright "PAOM"

#property link      ""

#property version   "1.00"




//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

//---

   

//---

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

//---

   

  }

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {

   

   double MovingAverage = iMA(NULL,0,25,0,MODE_EMA,PRICE_CLOSE);

   

   Print("MA", MovingAverage);

   

  }

 

Solved my Problem with an Array.

void OnTick()

  {

   

      // MA Array

      double Ma25Array[];

      

      int MaDefinition = iMA(_Symbol,_Period,25,0,MODE_SMA,PRICE_CLOSE);

      

      // Definierter EA eine Linie von Kerze 0 3 Kerzen im Array speichern

      CopyBuffer(MaDefinition,0,0,3,Ma25Array);

      

      //Moving Average fuer Kerze 1 berechnen

      float myMovingAverage25 = Ma25Array[1];

      Comment("MA25 ",myMovingAverage25);

  }

Reason: