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

 

Reported problem that some might experience :

If you get the following message : "cannot create interface of MQL compiler" then check if your antivirus have blocked mql.dll (or blocked that it can be written to destination folder). Seems that metatrader has problems with some antiviruses again. Metaquotes people are assuring that it is not a virus, so ...

 

Yes, it seems that some anti virus programs are identifying metatrader as a virus (several reports already). Metquotes should clarify that with the antivirus apps developers

 

A possible problem :

New metatrader 4 compiles depending on the folder name. For example : if you take an ea, copy it to indicators folder and compile it, it will add indicator_separate_window and compile it as if it was an EA (try that wit any EA and you will get an "indicator" that can be started from indicators folder, but can not trade). Same goes for scripts and indicators. So do not be surprised that it starts to work as you never expected it to work.

This is a rather strange error and we have to pay attention (and users must know) what exactly are we copying where, otherwise the results will be unpredictable

 

Hi mladen,

Has there been a discussion somewhere about the ArrayCopyRates being broken and what the possible workarounds there are for getting dll's working?

You are right about things working oddly. I can now only edit in SciTE....my last working 509 is on the way out. Oh well!

I am sure you are having an unusually busy weekend.

regards,

Alex

 
hughesfleming:
Hi mladen,

Has there been a discussion somewhere about the ArrayCopyRates being broken and what the possible workarounds there are for getting dll's working?

You are right about things working oddly. I can now only edit in SciTE....my last working 509 is on the way out. Oh well!

I am sure you are having an unusually busy weekend.

regards,

Alex

Alex

According to their help file, the ArrayCopyRates() still works. This is the description of it (the form that is interesting to us)

Copies rates data to the RateInfo[][6] two-dimensional array of double type and returns the amount of bars copied.

[TABLE] int ArrayCopyRates(

void& dest_array[][], // destination array, passed by reference

string symbol=NULL, // symbol

int timeframe=0 // timeframe

); [/TABLE]

In that case, simply do the following (just a simple example):

#property indicator_chart_window

int init() { return(0); }

int deinit() { return(0); }

int start()

{

double rates[][6]; int bars = ArrayCopyRates(rates,_Symbol,_Period);

Comment(TimeToStr(rates[0][0],TIME_DATE|TIME_MINUTES)," open ",rates[0][1]," low ",rates[0][2]," high ",rates[0][3]," close ",rates[0][4]," volume ",rates[0][5]," bars ",bars);

return(0);

Just pay attention that element 0 is the current (in case if dlls were using it differently)

 

Fantastic...I will look into it right away. Thank you so much!

Alex

 
hughesfleming:
Fantastic...I will look into it right away. Thank you so much! Alex

There is a new format sample for dlls too (in the scripts\example\dll folder)

 

And to close this subject : it seems that the old format of CopyRates() and dll calls is working

Here is an example that is built in the new metatrader 4 and uses old dll (that expects those rates array elements that were valid before this mql new rates format - and it seems to be working with no problem (tested it in backtest today)

Will have to test some more (in runtime)

Files:
 

Thanks mladen,

I will have to see what is happening. I am using a dll to return a period value. It works fine in 509 but in the build I have which is still 574, there is a problem somewhere. It appears to work but returns a some fixed value regardless of time frame which is obviously not correct. I only discovered that it was not working when I changed time frame and the value remained the same. I glanced through the metaquotes forum and there was some mention that the CopyRates had changed in some way and that dlls would not work.

Thanks for your help. I will try and figure it out.

Kind regards,

Alex

 
hughesfleming:
Thanks mladen,

I will have to see what is happening. I am using a dll to return a period value. It works fine in 509 but in the build I have which is still 574, there is a problem somewhere. It appears to work but returns a some fixed value regardless of time frame which is obviously not correct. I only discovered that it was not working when I changed time frame and the value remained the same. I glanced through the metaquotes forum and there was some mention that the CopyRates had changed in some way and that dlls would not work.

Thanks for your help. I will try and figure it out.

Kind regards,

Alex

Alex

If you have the source for the dll all you need to change is the time part type in the dll source. Old version was going like this :

#pragma pack(push,1)

struct RateInfo

{

unsigned int time;

double open;

double low;

double high;

double close;

double vol;

};

#pragma pack(pop)

[/PHP]

now simply change it to this :

[PHP]#pragma pack(push,1)

struct RateInfo

{

double time;

double open;

double low;

double high;

double close;

double vol;

};

#pragma pack(pop)

PS: this way you are ignoring the value of time variable, but all the rest works OK

PPS: posted one example here https://www.mql5.com/en/forum/183798