Features of the mql5 language, subtleties and tricks - page 239

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
SymbolInfoTick.
I tried this option. Unfortunately, it does not work. If a symbol is added to the [Market Watch] window for the first time, there is no data on it yet and SymbolInfoTick returns null values.
I've also tested the CopyXXX functions, but they don't have a timeout and the process of waiting for data from the server lasts about 45 seconds, which is too long.
Need a quick way to find out if a character is unusable. I am referring to cases like this:
//---
Such symbols don't have data on the server and need a way to identify them so that they are not added to the [Market Overview] window or removed from the list if they are.
P.S. Perhaps there is some way to remove the lock on removing symbols from the list in the[ Market Watch] window?
I tried that option. Unfortunately, it does not work. If a symbol is added to the [Market Watch] window for the first time, there is no data on it yet and SymbolInfoTick returns null values.
It is easy to get working symbols by hand.
I tried that option. Unfortunately, it does not work. If a symbol is added to the [Market Watch] window for the first time, there is no data on it yet and SymbolInfoTick returns null values.
I also tested the CopyXXX functions, but they have no timeout and the process of waiting for data from the server lasts about 45 seconds, which is too long.
Need a quick way to find out if a character is unusable. I am referring to cases like this:
//---
Such symbols have no data on the server and need a way to identify them so that they are not added to the [Market Watch] window or removed from the list if they are.
P.S. Perhaps there is some way to remove the lock on removing symbols from the list in the[Market Watch] window?
I've been fighting with this for about 6 years and I ask the developers to put things in order here.
Unfortunately, this problem has not been solved, and at the moment there are situations when the terminal hangs when anyone accesses a financial instrument for the first time.
How can I find out if a symbol has data, so that I don't leave it in the [Market Watch] window if it doesn't?
I use such a check in a loop:
But after that I cannot manually remove symbols from the [Market Watch] window either one by one or all at once, while the Expert Advisor is on the chart:
Try checking the time of the last quote.
If 0, there is no data.
I just checked by open charts.
It is possible to get additional data by switching between servers. I don't know if it is possible to implement it through the code.
If by "between servers" you mean "between brokers", then hardly, unless you try to play with profiles.
But if I really needed to switch between different servers of one broker (Open had many, Finam had two), I would do it via iptables/nftables and my bash scripts. But it's easier for me here, I have Linux.
If by "between servers" you mean "between brokers".
.
Yes, in principle, it is possible.
But, since there is no way to find out the name and ip of the server from the MQL-program, you will have to find them out manually by switching servers and checking which ip the connection is going to.
Then it is possible, making changes in the configuration of the firewall, to prohibit the connection to some server (here it is necessary to rejack packets, not drop them to avoid timeout), forcing MT to switch to another one.
Again, it's not hard for me to do this under Linux, but I can't imagine how to do it in Windows.
Try checking the time of the last quote.
if 0, there is no data.
I just checked against the open charts.
This also applies to a similar case:
If ticks come rarely, all such symbols will be excluded.
It is easy to get working symbols by hand.
No. You need a full automatic.
I've been fighting with it for 6 years already, and I ask developers to put order here.
Unfortunately, this problem is not solved, and at the moment there are situations when the terminal hangs up when anyone accesses a financial instrument for the first time.
I noticed it only when calling the following functions:
//---
Terminal developers:
1. exclude the possibility of adding symbols without data on the trade server.
2. Make it possible to disable symbol deletion blocking from the [Market Watch] window or fix it if it is a bug. Now it can be done only by restarting the terminal.
3. For functions like CopyXXX , add an additional optional parameter to set timeout (maximum time to wait for data from the server).
I can't reproduce this right now. So far it works without delay. But it seems that in some cases it can happen.
4. fix the bug with infinite waiting when using Bars(), iBars(), SeriesInfoInteger(symbol, PERIOD_M1, SERIES_BARS_COUNT) functions in cases when:
An attempt to delete the programme from the chart may cause the terminal to hang for several minutes.
5. Fix the bug with infinite waiting when using functions if there is no connection to the server:
In this case you can also add an additional optional parameter to set the timeout (maximum time to wait for data from the server).
//---
P.S. So far I have settled on the variant with checking for data with functions like CopyXXX. But I will watch whether the problem described above will appear again.
The most productive and shortest way to determine the day of the week by time:
returns a value between 1 and 7
1 - Monday
...
7 - Sunday