Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1443

 
MrBrooklin pending order and then follows the price. After the price "caught" the pending order, it opens a SELL position with a specified stop loss and take profit. There are no problems up to this point. Then the price moves in the direction I want and by idea it should work on take profit, which is 50 points. But it didn't. Despite the fact that the current price fell below the level of the price at which the position was opened plus the size of the spread, i.e. 50 + 14 pips, the position closed with the size of 36 pips from the opening price. And so it repeats from time to time, from deal to deal. I run the robot on the tester and see that all closed positions have the size of 50 pips, as it should be.

Is there really a constant deviation, and with the same size, approximately equal to the size of the spread of 14 pips. Something strange, don't you think? Here is the transaction log.

Regards, Vladimir.

Maybe I am missing something, but I think you need to understand what bid and ask are.

 
Vladimir Deryagin #:

Maybe I'm missing something, but I think you need to figure out what bid and ask are

I also started to doubt and thought that the problem is in the code. But then I would have the same problems in the strategy tester. But everything is fine in the strategy tester! I have highlighted the execution time in red in the process of closing a trade. Maybe this is the problem?

Regards, Vladimir.

P.S. Today I had 3 trades and they closed with deviation of 10, 14 and 15 points. It looks like deviation. ((

 
Hi, a spread of 15 - 20 pips at a five digit price is normal. And 50 pips is not enough for a take. If the profit is of the same order as the spread, you will not be lucky. Although it depends on who you are.
 
Aleksei Stepanenko #:
Hi, a spread of 15 - 20 pips at a five digit price is normal. And 50 pips is not enough for a take. If the profit is of the same order as the spread, you will not be lucky. Although it depends on who you are.

Hello Alexey, I agree that this is not the most ideal strategy for a robot, but as long as it gives a stable profit, let it work. Less is better, but better.

Now about my question. I looked through all the logs and noticed that starting from the 1st of February the time of closing trades has increased sharply - from 50-70 msk to 330-450 msk. I will find out from my forex-dealer what happened.

Regards, Vladimir.


 

Could you please tell me if it is possible to change the ID of an Expert Advisor in the "Trade" table?

Or let's say there is a script that sets SellLimit orders,

trade.BuyLimit(1,10.75,NULL,0,0,0,0,0,0,0,NULL);

how and where to specify the ID number in the command so that this order can be picked up by an Expert Advisor with a similar ID?

 
BOBEF #:

Could you please tell me if it is possible to change the ID of an Expert Advisor in the "Trade" table?

Or let's say there is a script that places SellLimit orders,

trade.BuyLimit(1,10.75,NULL,0,0,0,0,0,0,0,NULL);

how and where to specify the ID number in the command so that this order can be picked up by an Expert Advisor with a similar ID?

 trade.SetExpertMagicNumber(magic);
 trade.BuyLimit(1,10.75,NULL,0,0,0,0,NULL);
 
Alexey Viktorov #:

Thank you
 

What can be wrong

int aaa = StringFind(Set, txt);

Set - the string we are looking for.

txt - what we're looking for.

why aaa = -1 ???

And in general, a string variable can be somehow different from the same string variable.

string a = "A";

string c = "A";

In what cases is it possible that a!=c ?

 

Is there any way to cancel the output of database connection errors?
For example, the DatabaseOpen() function prints an error every time the database is locked and the function cannot access it.
But this is a normal working situation for me, I will catch this error myself and output it if necessary.

As a result, the whole log is full of messages about locked base.

2023.02.13 18:57:21.917 database error, database is locked
 

Hello, Aleksandr Slavskii.

Did the Russian letter M happen to be in one of the lines?

Reason: