MetaTrader 4 Build 600 with Updated MQL4 Language and Market of Applications Released - page 16

 
alexvd:

Remove or comment the line

#property show_inputs



It is property of scripts so the new compiler decides that it is a script



Hello,

I've removed the property line. It works now as expert.

Thanks for your help.

Oliwand

 
Freeka:

Hi there

I have an indicator which is not compiling after the new build. Can anyone help?

There is a lot of little errors to correct. Please this post https://www.mql5.com/en/forum/149271 and try to correct them.

If you can't please create your own topic, some people will help you.

 

Hi all,

First post from me, but can anyone tell me if ArrayCopy() has altered. It just doesn't seem to make any sense to me anymore.

// declare arrays

double i[][4];

double j[][4];

// Size and fill i[] with some data

ArrayResize(i, 2);

i[0][0] = 1;

i[0][1] = 2;

i[0][2] = 3;

i[0][3] = 4;

i[1][0] = 5;

i[1][1] = 6;

i[1][2] = 7;

i[1][3] = 8;

// resize array j[] - is this required?, cant find any documentation on this but experementation seems to show it is not.

ArrayResize(j, 2);

// Copy from i to j, starting at 0 for both and copy the first 4 elements

Print(ArrayCopy(j,i,0,0,4)); // Output: 2 - Surely 4 should be returned?

Print(j[0][0]); // Output: 1 - ok

Print(j[0][1]); // Output: 2 - ok

Print(j[0][2]); // Output: 3 - ok

Print(j[0][3]); // Output: 4 - ok

Print(j[1][0]); // Output: 5 - wrong?

Print(j[1][1]); // Output: 6 - wrong?

Print(j[1][2]); // Output: 7 - wrong?

Print(j[1][3]); // Output: 8 - wrong?

// Populate i[] with new data

i[1][0] = 9;

i[1][1] = 10;

i[1][2] = 11;

i[1][3] = 12;


// copy from i[] to j[], to the 5th element of j[] from the 5th element of i[] for a count of 4 elements

Print(ArrayCopy(j,i,4,4,4)); //2014.02.06 19:34:29.868 Access violation write to 0x06D86000 in 'C:\Users\.....'; ... and crash.


// following doesn't now execute

Print(j[0][0]);

Print(j[0][1]);

Print(j[0][2]);

Print(j[0][3]);

Print(j[1][0]);

Print(j[1][1]);

Print(j[1][2]);

Print(j[1][3]);

 
To create new programs which way should be followed? I could not understand
 
pascalboy:
To create new programs which way should be followed? I could not understand
How is this related to the new build 600 of MT4 ?
 
mfp:

Hi all,

First post from me, but can anyone tell me if ArrayCopy() has altered. It just doesn't seem to make any sense to me anymore.


Please use the SRC button when you post code.

Have you read the first post of the topic ?

Changed ArrayCopyRates() behavior - in the old MQL4 version, this function copied price series to double[][6] array. Now, the array from MqlRates structure elements should be used in order to receive time series:

//Structure for storing data on prices, volumes and spread.
struct MqlRates
  {
   datetime time;         // period start time
   double   open;         // Open price
   double   high;         // High price for the period
   double   low;          // Low price for the period
   double   close;        // Close price
   long     tick_volume;  // tick volume
   int      spread;       // spread
   long     real_volume;  // exchange volume
  };

The new format of the function also performs virtual copying. In other words, the actual copying is not performed. When the copied values are appealed to, the price data is accessed directly.

int  ArrayCopyRates(
   MqlRates&  rates_array[],   // MqlRates array passed by reference
   string     symbol=NULL,     // symbol
   int        timeframe=0      // timeframe
   );

In order to maintain compatibility with old MQL4 applications, the old call format is also preserved. However, a real copying of data to double type array is now performed.

int  ArrayCopyRates(
   void&     dest_array[][],    // array passed by reference
   string    symbol=NULL,       // symbol
   int       timeframe=0        // timeframe
   );
This means that the necessary data should be copied to dest_array[][] again when changing values in time series (adding new bars, restructuring or updating the last bar's Close price). In this case, the receiver array will be automatically distributed according to the necessary amount of the copied bars even if it has been declared statically.
 
ferenci84:

I have noticed some bugs in the compiler. It sometimes shows wrong line numbers in the include files, so that the error is very hard to find, but I also doubt that there is an error at all, because one error has been eliminated by removing an unused variable and this shouldn't generate any error.

...If someone from MetaQuotes development team is interested, I can send the full code in a private email. It has been working in MT4 quite well.

Please use the SRC button when posting code.

Can you please send code that compiles, I can try to help you ? (I am not from Metaquotes dev. team though).

 
angevoyageur:

Please use the SRC button when you post code.

Have you read the first post of the topic ?




Thanks angevoyageur - i will use the SRC button in the future.

Regarding the ArrayCopy(), I dont see how ArrayCopyRates() is relevant. If I have got this wrong, then please point me in the right direction.

Kind regards - mfp

 

All these changes for developers, why can't you add more timeframes like MT5 has for the user. I must run extra charts/resources just to get 8 and 12 hour charts which is such a pain and cumbersome.

Why not switch to MT5?? - because my my indicators do not work in MT5 and there is no halfway house, MT4.5 one day ?

Sigh...

PG

 
mfp:

Thanks angevoyageur - i will use the SRC button in the future.

Regarding the ArrayCopy(), I dont see how ArrayCopyRates() is relevant. If I have got this wrong, then please point me in the right direction.

Kind regards - mfp

Oops, my apologies. So many posts today that I misread your post.