Download MetaTrader 5

Difference between Script and EA

To add comments, please log in or register
Do you keep a blog? Place a link to MQL5.community there and make money!
och
485
och 2011.04.01 13:49 

Hi all,

Can someone explain me why the same peace of code executed in OnStart() of a script and OnTick() of an EA does not give the same result. And what should I do to retrieve indicator value in the EA?

Peace of code :

   int handle=iCustom(_Symbol,_Period,"TrendMagic_V2",50,5);

   double TM_Price[];

   ArraySetAsSeries(TM_Price,true);

   CopyBuffer(handle,0,D'2010.10.01 00:00:00',D'2010.10.01 04:00:00',TM_Price);

   for (int i=0;i<ArraySize(TM_Price)-1;i++)

     Print(" i = ", IntegerToString(i)," TM_Price = ", DoubleToString(TM_Price[i],Digits()));

 

 

     

Jacob Funk
92
Jacob Funk 2011.04.01 17:51  
This is odd, for some reason using a copy buffer for this indicator doesn't seem to work like for other indicators.
To add comments, please log in or register