MetaTrader 4 Client Terminal build 604 - page 8

 
graziani:

I understood your problem correctly.

But in my experience, this was expected behaviour also before. for that reason, i have all necessary initializations in init().

Perhaps this difference comes from different behaviour of EA and indicator?

Indicators always initializes global variable in build 509 after TF change,but EA doesn't.
Now it would be initialized after TF change in build 604 so I have to recode my EA.
 
Sunaley: Now it would be initialized after TF change in build 604 so I have to recode my EA.
You have to recode your EA to match the expected behavior, code that you should already have. https://www.mql5.com/en/forum/146370
 

I have another problem in 509>604 conversion:

//test.mq4 In the (Indicators) folder

==============================

#property strict

//--------------------------

double init[16]; //(global)

//--------------------------

Server1(info);

==============================

//

//lib.mq4 subroutine in the (Libraries) folder

==============================

#property library

void Server1(double &infoX[]){

...

...

}

==============================

//

//inc.mqh subroutine in the (Include) folder

==============================

#import "lib.ex4"

void Server1(double &infoX[]);

==============================

//

//The above structure was working in 509

//Now in 604 it compiles without an error

//However, on the execution I get following error:

//unresolved import function call
//Cannot find 'Server1' in 'lib.ex4'

//

//Something new and I can't figure it out..... any idea?

 

Hi,

The following code with ArrayResize returns '4, 3, 2, 5' in MT4 build 604

int ARR[]={1,2,3,4,5};

ArraySetAsSeries(ARR,True);
Print("ARR as series:  ",ARR[0], ARR[1], ARR[2], ARR[3], ARR[4]);       // result: 5, 4, 3, 2, 1

ArrayResize(ARR,4);
Print("ARR resized:  ",ARR[0], ARR[1], ARR[2], ARR[3]);                 // result: 4, 3, 2, 5

I thought it should return '5, 4, 3, 2'.

Is this a bug or am I missing something?

 
darksamu:

Hi,

The following code with ArrayResize returns '4, 3, 2, 5' in MT4 build 604

I thought it should return '5, 4, 3, 2'.

Is this a bug or am I missing something?

One thing is for sure . . . it shouldn't return 4, 3, 2, 5

As far as I remember for a Series array elements are added and removed from the start of the array, index 0 end, so I think the result should be 4, 3, 2, 1

Please post complete test code that can be compiled and run so others can verify this issue.
 

Ok, here is a test code:

//+------------------------------------------------------------------+
//|                                                      Arrtest.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {

   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---

   int ARR[]={1,2,3,4,5};
   Print("ARR original:  ",ARR[0], ARR[1], ARR[2], ARR[3], ARR[4]);     // result: 1, 2, 3, 4, 5
   ArraySetAsSeries(ARR,True);
   Print("ARR as series:  ",ARR[0], ARR[1], ARR[2], ARR[3], ARR[4]);    // result: 5, 4, 3, 2, 1
   ArrayResize(ARR,4);
   Print("ARR resized:  ",ARR[0], ARR[1], ARR[2], ARR[3]);              // result: 4, 3, 2, 5  (this result looks strange)
   
   Comment("\n\n  Resized ARR set as series: ", ARR[0], ",", ARR[1], ",", ARR[2], ",", ARR[3]);

   return(rates_total);
  }
//+------------------------------------------------------------------+
 
RaptorUK:
One thing is for sure . . . it shouldn't return 4, 3, 2, 5

As far as I remember for a Series array elements are added and removed from the start of the array, index 0 end, so I think the result should be 4, 3, 2, 1

Please post complete test code that can be compiled and run so others can verify this issue.

I think you are right.

Reported to ServiceDesk.

 

Thanks.

I just tested with build 509 and it gives 5, 4, 3, 2 (as expected)

 

I reported a simple bug. The bug record reads - fixed on 2014.02.10 09:47, while the new 605 still contains the bug... is that OK?

EDIT:

Apologies, fixed. I did not realize the command was evaluated at compile time, so after re-compilation it is OK.

 
This was reported on another thread.
int ARR[]={1,2,3,4,5};  // ARR has a size of 5
:
ArrayResize(ARR,4);     // Doesn't work on 600+
Do not resize arrays with fixed size.
int ARR[];
ArrayResize(ARR,5);
for(int i=1; i <= 5; i++) ARR[i-1]=i;
:
ArrayResize(ARR,4);