Errors, bugs, questions - page 2574

 
Aleksei Beliakov:
Banal if you print the results of these functions in ontick then it is for the time 1970.01.01 for price 0
It used to be bar time or price time.
So now it's like this.

Maybe you have a bug in your computer? I've got this code in build 1220.

 Print("iHigh ", iHigh(NULL, PERIOD_W1, 0));
 Print("iTime ", iTime(NULL, PERIOD_W1, 0));

prints

2019.09.23 09:41:27.560 00 EURUSD,M5: iTime 2019.09.22 00:00:00
2019.09.23 09:41:27.560 00 EURUSD,M5: iHigh 1.10245
 
Aleksei Beliakov:
If you print the results of these functions in ontick, it is for the time 1970.01.01 for price 0.
It used to be bar time or price time.
So now it is like this

What isthe error code?

What are the test parameters?

Are the data for weeks and months loaded? How many are there in total?

 
Slava:

What isthe error code?

What are the test parameters?

Is the data by weeks and months uploaded? How many are there in total?

I rechecked and everything is working now.

I downloaded the story.

Thank you.

 
I'm sure this topic has already been raised: It should be possible to coexist two different versions of MT5 on one desktop (disable auto-update and rollback). Or at least beta and release. Or it is possible (without virtualization).
 

Memory observation.

I have CopyRates executed about a thousand times in my code.

Then the array of quotes is somehow processed, and at the end of this I call:

ArrayRemove(ArrayQuotes,0,ArraySize);

ArrayFree(ArrayQuotes);

ArrayResize(ArrayQuotes,0);

ArrayFree(ArrayQuotes);

ZeroMemory(ArrayQuotes);

(just experimented differently)

Result - memory still grows geometrically and gets clogged, along with it load on processors - i7 processor gets clogged by 80% in total on all logical cores, memory is more than Giga.

So far I've managed to limit resource consumption with a third-party program - CPU not more than 15% and memory not more than Giga.

Question - is this a bug or a feature of the platform?

 
Is it possible to rigidly select source encoding? I know that when characters are only ascii, it is single byte, otherwise utf-16. Can utf-8?
 

By the way, strange meta-editor behaviour, should be corrected:

fn_call();/////////////////////

double-clicking on the slashes highlights the slashes with the previous character (if it's not a number/letter there).

Why inconvenient? Made a temporary edit in the code, highlighted the space this way, then need to quickly highlight and delete single slashes.

 

Still back to the question of passing strings from dll, wchar_t* as a pointer.
From Renat'sarticle on working with strings in dll, it is clear that mql type string takes a pointer to string wchar_t* from external dll.
In other words, we sendwchar_t* to the dll and receive it as string & in mql.
But the C function

wcscpy_s(wchar_t *dest, rsize_t  dest_size, const wchar_t *src);

does not work correctly, i.e. a pointer to the stringwchar_t* dest is received in mql, but fails and comes in and out.
Sometimes the terminal crashes and the program is terminated.

With the function

wcscpy(wchar_t *dest,  const wchar_t *src);

The terminal doesn't crash, but the strings arrive intermittently too.
Please correct in the next build.

ZS. I forgot to mention that thewchar_t* pointer is passed from another thread.
I.e. wcscpy_s or wcscpy function is called in a separate thread.

 
Roman:

Still back to the question of passing strings from the dll, wichar_t* as a pointer.
From Renat'sarticle about working with strings in dll, it is clear that mql type string takes a pointer to string wichar_t* from external dll.
In other words, we send wichar_t* to the dll and receive it as string & in mql.
But for some reason, the C function

does not work correctly, i.e. a pointer to the stringwichar_t* dest is received in mql but fails and comes in and out.
Sometimes the terminal crashes and the program is terminated.

With the function

The terminal doesn't crash, but the strings arrive intermittently too.
Please correct in the next build.

ZS. I forgot to mention that the wichar_t* pointer is passed from another thread.
I.e. wcscpy_s or wcscpy function is called in a separate thread.

And who will allocate the memory for string dest?
 
Vladimir Simakov:
And who will allocate the memory for string dest?

The memory is allocated in the mql code as

#import "Dll.dll"
   void Func(string task, string & out);
#import 

string оut;
StringInit(out, 165, 32);

out and passed as a pointer to the allocated memory, because string in mql is wchar_t* in dll

Func("Task", out);
Reason: