Questions from Beginners MQL5 MT5 MetaTrader 5 - page 829
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
The multi-currency expert in the loop asks for data by symbol. There is such a fragment:
All symbols pass normally. During the first pass the time is about 120ms, because indicator buffers are filling. Starting with second pass time of calculation on current bar is less than 1 ms.
Peculiarity is that one well-known broker has EURRUR symbol, for which there is no data ("Wait for update"). Therefore the calculation is stuck on this line for 51 seconds. Error 4806. 51 seconds is unacceptable even for one (first) time, let alone a cycle.
Question. How do I quickly find out the fact that there is no data for a given character? I would then memorize it and on subsequent iterations just step over it and go on without losing pace.
Colleagues, please advise how to convert an array of type double to string. I need to write it to a file. Here is a general training code.
Info taken from article
Saving and loading arrays from a file
When saving and loading an array from a file, we should consider the difference in the first dimension of the array's size and the total number of its elements. When you save an array, you should first write the size of the array (the total number of elements determined by ArraySize()) into the file, then the entire array:
Hello, I am facing the following problem.
I have two EAs for the same instrument with different magiks respectively. I set my magik through CTrade and open a position through CTrade too. When I have an open position of the first EA, its magik is assigned to the second EA (I checked it after opening a position, see below), so the check for open positions does not see my magik and open many positions in the same direction. The account is on a demo, this cannot be detected in the tester. If the value of the magik is saved in the class, maybe it should be zeroed, but I don't know how.
Hello, I am facing the following problem.
I have two EAs for the same instrument with different magiks respectively. I set my magik through CTrade and open a position through CTrade too. When I have an open position of the first EA, its magik is assigned to the second EA (I checked it after opening a position, see below), so the check for open positions does not see my magik and I open many positions in one direction. The account is on a demo, this cannot be detected in the tester. If the value of the magik is saved in the class, maybe it needs to be zeroed, but I don't know how.
Pleasepaste the code correctly, not as a sheet of text.
As for the code: set the input parameters to each EA with its own magik. Let's say you set the first one to 10001, then the second one to 10002.
Pleaseinsert the code correctly, not as a sheet of text.
As for the code: set the input parameters to each EA with its own magic. Suppose you set the first one to 10001, then the second one to 10002.
Thank you for such a short answer. But that is the point, the magics are different. Thus, I have determined that the second robot opens positions with the first magician. I do not know how it happens and where he saves the first EA's magic number but I would like to find out.
Thanks for the quick response. But that's the thing, the magicians are different. So I found out that the second robot is opening positions with the first one's magic number. I do not know how it happens and where he saves the first magician number but I would like to find out.
In this case, it is better to set the magik
// выставляем магик m_trade.SetExpertMagicNumber(Magic);
before every opening of position /order instead of in OnInit.In this case, it is better to specify a magik
before each opening of position, not in OnInit.In this case, it's not "better", it's exactly what you need - it's a wrapper class for standard trading functions. It does not store multiple magiks. That's why it should be set a magik every time before and when you want to open a position with a new magik.
Generally the sequence is as follows:
etc...
In this case, it's better to set a magik
Before each opening of a position/order, and not in OnInit.Originally it was like this, it doesn't help. But in examples it is usually in OnInit so has moved. For a long time I've been messing around with this, owls on the test seem to be running smoothly, then suddenly I open the server and there are 20 positions in one direction. Can the fact that the check for open positions is not through classes?
Thanks for the quick response. But that's the thing, the magicians are different. So I found out that the second robot is opening positions with the first one's magic number. I don't know how it happens and where he saves first EA's magic number but I want to find out.
Since there is noGetExpertMagicNumber method in CTrade class, please print this code after the trade operation:
This way you can check if both EAs have different magics.