Download MetaTrader 5

iMAOnArray gives different result when code in indicator and expert advisor (EA)

To add comments, please log in or register
calvincychin
11
calvincychin  

Hi seniors,

I come into a problem where by when I use the same code in creating indicator and expert advisor, the system give me different result.

In indicator, which the result is correct, the following code will give me:-

result = iMAOnArray(priceSeries,0,5,0,MODE_LWMA,0);

input = priceSeries = {100, 100, 100, 100, 86.492, 86.146}

result = 99.099


When I code the same code into expert advisor, it give me different result.

result = iMAOnArray(priceSeries,0,5,0,MODE_LWMA,0);

input = priceSeries = {100, 100, 100, 100, 86.492, 86.146}

result = 66.666


I am having a hard time to file out the root cause. Hope seniors will able to point some light to this problem.

Thank you.

whroeder1
17061
whroeder1  
calvincychin: I come into a problem where by when I use the same code in creating indicator and expert advisor, the system give me different result.
  1. MT5 has no such function. Why did you post your MT4 question in the Root / MT5 EA section instead of the MQL4 section (bottom of the Root page?) General rules and best pratices of the Forum. - General - MQL5 programming forum
  2. Post real code that compiles. There are no mind readers here
  3. Buffers are always as series. Make sure your array is before filling it.
calvincychin
11
calvincychin  
whroeder1:
  1. MT5 has no such function. Why did you post your MT4 question in the Root / MT5 EA section instead of the MQL4 section (bottom of the Root page?) General rules and best pratices of the Forum. - General - MQL5 programming forum
  2. Post real code that compiles. There are no mind readers here
  3. Buffers are always as series. Make sure your array is before filling it.
The set series solve the problem. Thanks
To add comments, please log in or register