Big changes for MT4, in a few weeks - page 115

 

my terminal' s updated to 610 and the /portable switch dot work any more...

 
dasssi:
my terminal' s updated to 610 and the /portable switch dot work any more...

It must work

Check your shortcut. I am using build 610 and all is working correctly with /portable switch

 

well... it does not

i only changed the shortcut

theStrange language is Hebrew..

 
dasssi:
well... it does not

i only changed the shortcut

theStrange language is Hebrew..

dasssi,

If you are using windows 7 or windows 8 the simplest solution is to install the metatrader outside the "Program Files" folder and then use the /portable switch

 
mladen:
It is not a problem with array indexing that I am referring to.

I think I was one of the first cleaning the array access indexes (metatrader 5 has forced me to do so) and I think that I was one of the first ones warning that improper array elements addressing will cause problems in a new metatrader 4 (when using the strict directive in the beginning of beta tests was not necessary and when all code was compiled as if the "strict" directive was specified) so what I am talking about has nothing to do whatsoever with improper array elements addressing.

Improper arrays element addressing is a basic coding problem and I am not talking about coding problems of that type when I am telling that there is a bug with something related to metatrader and arrays

It is a problem with different treatment of fixed size arrays and dynamic arrays that are treated differently when they should be initialized. The first time you start such code it works OK. Any time frame change, symbol change or account change causes ex4 to "forget" to reinitialize the fixed size arrays

That is just another case of inconsistent "behavior" of the compiled code - ie a bug of a compiler that does not do the things the way as it should and no strict or ommition of strict directive changes what is happening in those cases

_____________________________

And I suspect that it is just the surface of the arrays problems - if fixed size arrays are not treated correctly (no arrays cleanup on deinitialize and initialize) just try to imagine what sort of problems can come if somene uses clases (which are, after all, nothing more than a fixed size arrays of variables and pointers to class elements, functions and procedures).

_____________________________

...

Looking at tradestation that has arrays that are 10 times more evolved than metatrader arrays (regarding the ease of use and realiability) I was expecting with this new metatrader to make that odds at least 5 to 1 not 10 to 1 as it was before. At a moment the relation could be only a 20 to 1 (in favor of tradestation, of course)....

Hi mladen, since days I have trouble passing data from different local function arrays to a global dynamic array (e.g. with my updated Goertzel browser). Your posting indicates that this could be a problem of the new MT4 environment. For explanation let me repeat some things.

So far I understand we have 3 possibilities to define local arrays (unfortunately not mentioned/explained explicitly in any MQL4 guide I've seen)

1. Defined in the function itself: array range must be explicitly sized or resized to make it work. Array is only valid in the function itself.

2. Defined as stand-alone function next to other functions: can be used by various neighbored functions. Must be explicitly sized or resized in the first using function to make it work. If resized and filled, the array can be used by other neighbored functions without explicitly passing the array to the other function. Further resizing is not necessary but can be executed if necessary.

3. Defined as pass-back array in a function:

e.g. void function_name (double& MyArray [], double var){ …

Array must (can?) not be resized ! Default size seems to be defined by the higher level array (?). It is only valid in the function itself. Issue: can such an array be resized ? E.g. resizing smaller than the higher level array is not possible.

I try to pass back different local arrays with fixed size to a global dynamic array which creates problems. I thought when passing back a local array with a fixed size, the size of the dynamic array is defined by the passing array. This seems to be wrong. How can I use one dynamic array for various local pass-back arrays with varying size ? Is it necessary to resize the dynamic array every time I am changing the passing array ? I would appreciate a feedback, thanks.

 
Boxter:
Hi mladen, since days I have trouble passing data from different local function arrays to a global dynamic array (e.g. with my updated Goertzel browser). Your posting indicates that this could be a problem of the new MT4 environment. For explanation let me repeat some things.

So far I understand we have 3 possibilities to define local arrays (unfortunately not mentioned/explained explicitly in any MQL4 guide I've seen)

1. Defined in the function itself: array range must be explicitly sized or resized to make it work. Array is only valid in the function itself.

2. Defined as stand-alone function next to other functions: can be used by various neighbored functions. Must be explicitly sized or resized in the first using function to make it work. If resized and filled, the array can be used by other neighbored functions without explicitly passing the array to the other function. Further resizing is not necessary but can be executed if necessary.

3. Defined as pass-back array in a function:

e.g. void function_name (double& MyArray [], double var){ …

Array must (can?) not be resized ! Default size seems to be defined by the higher level array (?). It is only valid in the function itself. Issue: can such an array be resized ? E.g. resizing smaller than the higher level array is not possible.

I try to pass back different local arrays with fixed size to a global dynamic array which creates problems. I thought when passing back a local array with a fixed size, the size of the dynamic array is defined by the passing array. This seems to be wrong. How can I use one dynamic array for various local pass-back arrays with varying size ? Is it necessary to resize the dynamic array every time I am changing the passing array ? I would appreciate a feedback, thanks.

Boxter

Here is one example that I have tried and it works (for single dimension arrays as well as for two dimension arrays). I could resize the arrays from within the called functions

#property indicator_chart_window

int init() { return(0); }

int deinit() { return(0); }

double array1[];

double array2[][3];

int start()

{

testArray1(array1);

testArray2(array2); Comment(ArraySize(array1)," ",ArrayRange(array2,0));

return(0);

}

//

//

//

//

//

void testArray1(double& tarray[])

{

if (ArraySize(tarray)!=Bars) ArrayResize(tarray,Bars);

}void testArray2(double& tarray[][3])

{

if (ArrayRange(tarray,0)!=Bars) ArrayResize(tarray,Bars);

}
Files:
 

I agree that buttons and tings like that look nice, but my question is : how is it going to add to our trading reliability? Tools built using high level coding languages (as mql) are slow compared to dlls, and we do not have a possibility to create tools using dlls. Same things (buttons, graphics, ....) just made metatrader 5 terribly slow

 

Hi mladen,

its not working for testArray1 anymore if I am adding SetIndexBuffer - why ?

#property indicator_chart_window

double array1[];

double array2[][3];

int init() {

IndicatorBuffers(1);

SetIndexBuffer(0, array1);

return(0);

}

int deinit() { return(0); }

int start()

{

testArray1(array1);

testArray2(array2); Comment(ArraySize(array1)," ",ArrayRange(array2,0));

return(0);

}

//

//

void testArray1(double& tarray[]) {

if (ArraySize(tarray)!=400) ArrayResize(tarray,400);

}

void testArray2(double& tarray[][3]){

if (ArrayRange(tarray,0)!=400) ArrayResize(tarray,400);

}

 
Boxter:
Hi mladen,

its not working for testArray1 anymore if I am adding SetIndexBuffer - why ?

#property indicator_chart_window

double array1[];

double array2[][3];

int init() {

IndicatorBuffers(1);

SetIndexBuffer(0, array1);

return(0);

}

int deinit() { return(0); }

int start()

{

testArray1(array1);

testArray2(array2); Comment(ArraySize(array1)," ",ArrayRange(array2,0));

return(0);

}

//

//

void testArray1(double& tarray[]) {

if (ArraySize(tarray)!=400) ArrayResize(tarray,400);

}

void testArray2(double& tarray[][3]){

if (ArrayRange(tarray,0)!=400) ArrayResize(tarray,400);

}

Boxter

You can not resize the buffer the same way as an array. Buffers are handled by metatrader terminal and you can not interfere with their handling (whatever you do with it (except assigning values and setting them as series or not), metatrader will prevent it) The size of a buffer will always be equal to the number of bars on chart

 
checkin:
I agree that buttons and tings like that look nice, but my question is : how is it going to add to our trading reliability? Tools built using high level coding languages (as mql) are slow compared to dlls, and we do not have a possibility to create tools using dlls. Same things (buttons, graphics, ....) just made metatrader 5 terribly slow

Same thing is done and this time they are hoping that it will succeed. It can succeed only if the kill metatrader 4 - that is the next step. The real question that will be answered only when they do it : will the rest of metaquotes survive then