Why does this "trawl" get the error "OrderModify error 1" in the tester every second and in large quantities? Logs just swell to gigabytes... What needs to be fixed?
void Stop() {
int i, o=OrdersTotal();
for (i=0; i<o; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderType()==OP_BUY) {
if (OrderOpenPrice()>OrderStopLoss()&&OrderOpenPrice()-OrderStopLoss()>StopLoss*Point) {
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-StopLoss*Point,OrderTakeProfit(),0,CLR_NONE);
}
}
if (OrderType()==OP_SELL) {
if (OrderOpenPrice()<OrderStopLoss()&&OrderStopLoss()-OrderOpenPrice()>StopLoss*Point) {
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+StopLoss*Point,OrderTakeProfit(),0,CLR_NONE);
}
}
}
}
return(0);
}
Google: the speed of complex conditions site:mql4.com
Of course, there is some common sense in hints about search, but you could have just written: yes, there is. And explain in a nutshell that the use of logical comparison in 4 is not organized optimally.
artmedia70: There is, of course, some common sense in the search hints, but you could have just written: yes, there is. And explain in a nutshell that the use of logical comparison in 4 is not organised optimally.
Why does this "trawl" get the error "OrderModify error 1" in the tester every second and in large quantities? Logs just swell to gigabytes... What needs to be fixed?
You should not try to modify the same value. If, for example, Stop is at 1.2300 and you modify it to 1.2300, you'll make a mistake - there is nothing to modify. Check for the equality of modified values
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I found the file. I had to give the program administrator rights so that it could save to the file.
Now I have another question.
How to determine the last operation number to insert in OrderSelect()?
I'm doing this
It says that total = 322
But there are zeros in the file
I did the following
OrderSelect(total-1,SELECT_BY_POS,MODE_HISTORY);
And everything worked )))
Is this correct or it may cause an error in time?
I.e., may it accidentally return the value not of the last order in the history but of some other one?
Can you tell me if it makes a difference if you write
or
if(условие && условие && условие) { ... }Why does this "trawl" get the error "OrderModify error 1" in the tester every second and in large quantities? Logs just swell to gigabytes... What needs to be fixed?
the speed of complex conditions site:mql4.com
There is, of course, some common sense in the search hints, but you could have just written: yes, there is. And explain in a nutshell that the use of logical comparison in 4 is not organised optimally.
Why does this "trawl" get the error "OrderModify error 1" in the tester every second and in large quantities? Logs just swell to gigabytes... What needs to be fixed?
Does Google want to be a moderator?