The advisor will not close an order on time if there is another order on the symbol opened at an earlier time than the advisor's own order. order. If someone else's order is open later or if there are no other orders, the OrderClose function works correctly. Please advise where the error is
The error is that you just take the order with index 0 and do not look for it among open orders.
for(int i=OrdersTotal()-1;i>=0;i--)
И еще, не понял, что за элемент в функции (подчеркнуто красным)?
OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),NormalizeDouble((Ask - Bid) * Point,Digits), DodgerBlue);
for ( Expression_1; ; Expression_2) // No Condition { // Opening curly bracket Operator block, // The loop body may consist of ... making up the loop body //... of several operators } // Closing curly bracket
Can you tell me what is a condition to exit a loop like this? Or a loop like this
For ( ; ; ) // Absent. Expression and Condition { // Opening curly bracket A block of operators, // A loop body can consist of // ... several operators making up the loop body } // Closing curly bracket
NormalizeDouble((Ask - Bid) * Point,Digits) is Slippage for symbols with large spreads, e.g. XAUUSD.
So, can you imagine that it is 0? Firstly, the slippage should be a positive integer, secondly, the difference should be divided by Point, not multiplied.
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.
The advisor will not close an order on time if there is another order on the symbol opened at an earlier time than the advisor's own order.
order. If someone else's order is open later or if there are no other orders, the OrderClose function works correctly. Please advise where the error is
The error is that you just take the order with index 0 and do not look for it among open orders.
the error is that you simply take an order with index 0 instead of looking for it among the open orders.
I beg your pardon, but the situation is similar in THAT variant. Would you be so kind as to provide the correct solution to the problem?
How to output a beep in an indicator from the following expression:
if (num1 == 9) {
ObjectCreate(""+i, OBJ_TEXT, 0, Time[i+1],High[i+1]+10*Point );
ObjectSetText(""+i, ""+DoubleToStr(num1,0), 16, "Arial", RoyalBlue);
}
If you can be more detailed than "You can use OBJ_SICICOCI and look at the details in the MQL4 documentation, it has everything!"
I managed to solve this issue myself:
ObjectCreate(""+i, OBJ_TEXT, 0, Time[i+1],High[i+1]+10*Point );ObjectSetText(""+i, ""+DoubleToStr(num1,0), 18, "Arial", RoyalBlue);
PlaySound("havecall.wav"); }
I beg your pardon, but in THIS scenario the situation is similar. Would you be so kind as to provide a proper solution to the problem?
Well, also, replace
to
for ( Expression_1; ; Expression_2) // No Condition { // Opening curly bracket Operator block, // The loop body may consist of ... making up the loop body //... of several operators } // Closing curly bracketCan you tell me what is a condition to exit a loop like this? Or a loop like this
For ( ; ; ) // Absent. Expression and Condition { // Opening curly bracket A block of operators, // A loop body can consist of // ... several operators making up the loop body } // Closing curly bracketCan you tell me what is the condition for exiting such a cycle? Or one of these
break
Vinin, Roger - thanks, it helped.
NormalizeDouble((Ask - Bid) * Point,Digits) is Slippage for symbols with large spreads, e.g. XAUUSD.
Vinin, Roger - thanks, it helped.
NormalizeDouble((Ask - Bid) * Point,Digits) is Slippage for symbols with large spreads, e.g. XAUUSD.
So, can you imagine that it is 0? Firstly, the slippage should be a positive integer, secondly, the difference should be divided by Point, not multiplied.