iMAOnArray : Where's the bug?

 
void OnStart()
  {
  double tab[]= { 1.0, 2.0, 3.0, 5.0, 9.0, 15.0, 32.0 };
  Print(iMAOnArray(tab, 0, 3, 0, MODE_SMA, 0));
  }

Result : 0.0 !!

Thanks!
 
ccou:

Result : 0.0 !!

Thanks!
  double tab[]= { 1.0, 2.0, 3.0, 5.0, 9.0, 15.0, 32.0 };
  double ima=iMAOnArray(tab, 0, 3, 0, MODE_SMA, 0);
  Print("iMA = "+DoubleToString(ima,4));

I got 18.6667

 

Whaooooo!!!

I copied/pasted your source code in my MetaEditor 5.0 Build 2143 compiled it and executed in MT 4.0 Build 1220. Guess what ? different result !!!!

2019.10.24 21:06:37.698 Script _test AUDUSD,M1: removed
2019.10.24 21:06:37.693 _test AUDUSD,M1: uninit reason 0
2019.10.24 21:06:37.693 _test AUDUSD,M1: iMA = 0.0000
2019.10.24 21:06:37.693 _test AUDUSD,M1: initialized
2019.10.24 21:06:37.683 Script _test AUDUSD,M1: loaded successfully

What's wrong???  Is there a bug in MT4 ??

What result do you have if you execute my ".ex4"  ???

Thanks!

Files:
_test.mq4  1 kb
 
ccou:

Whaooooo!!!

I copied/pasted your source code in my MetaEditor 5.0 Build 2143 compiled it and executed in MT 4.0 Build 1220. Guess what ? different result !!!!

What's wrong???  Is there a bug in MT4 ??

What result do you have if you execute my ".ex4"  ???

Thanks!

That's an mql4 compiler bug. If you declare your array globally it works, locally the array is empty and iMAOnArray() returns error 4029 (Invalid array).
 
Merci Alain. I'm going to report this bug.
Reason: