Artyom Trishkin: The order is selected by ticket, and then, after one kilometre of code, you try to modify it. But it may already be closed at that time.
If the order was closed, then OrdersTotal()==0;; respectively, the OrderModify() would not happen at all.
If the order was closed, then OrdersTotal()==0;, respectively, OrderModify() would not take place at all
First, you check the quantity, then you check a lot of code where the position might have closed (but you're already handling a quantity condition greater than zero), and then you select and modify the closed one.
Orders can be closed 0.01 lots at a time if the order is a lot of 0.59 for example. A question arises. Is it possible to combine two orders into one? For example, an order with the lot 0.01 and you want to open another order with 0.02 lot. Can they be combined with 0.03 lots to avoid the piling up of orders, and if so, how?
I don't understand - WHY it happily modifies sell orders, but ignores modification of buy orders even when using incense tambourines and other irrational optimization tools.
if (ticket>0)
{
//set a Stop Loss and Take Profit for a Buy order//
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.
you have a summation
Thank you! Ran it through, and fixed it! Now it works.
The order is selected by ticket, and then, after one kilometre of code, you try to modify it. But it may already be closed at that time.
If the order was closed, then OrdersTotal()==0;; respectively, the OrderModify() would not happen at all.
If the order was closed, then OrdersTotal()==0;, respectively, OrderModify() would not take place at all
Orders can be closed 0.01 lots at a time if the order is a lot of 0.59 for example. A question arises. Is it possible to combine two orders into one? For example, an order with the lot 0.01 and you want to open another order with 0.02 lot. Can they be combined with 0.03 lots to avoid the piling up of orders, and if so, how?
install MT5 netting
no such thing in MT4?
Hello again everyone.
With all due respect to the pristine rectangles.
I don't understand - WHY it happily modifies sell orders, but ignores modification of buy orders even when using incense tambourines and other irrational optimization tools.
if (ticket>0)
{
//set a Stop Loss and Take Profit for a Buy order//
if(OrderSelect (ticket, SELECT_BY_TICKET, MODE_TRADES))
{
double sl,tp;
if (type==OP_BUY)
{
sl=OrderOpenPrice () - (StopLoss*_Point);
sl=NormalizeDouble (sl,_Digits);
tp=OrderOpenPrice () + (TakeProfit*_Point);
tp=NormalizeDouble (tp,_Digits);
}
if (type==OP_SELL)
{
sl=OrderOpenPrice () + (StopLoss*_Point);
sl=NormalizeDouble (sl,_Digits);
tp=OrderOpenPrice () - (TakeProfit*_Point);
tp=NormalizeDouble (tp,_Digits);
}
bool mod = false;
int count=0;
while (!mod)
{
mod=OrderModify (ticket, OrderOpenPrice (), sl, tp, 0, clrYellow);
count++;
if (count>=100)
{
mod=true;
break;
Figured it out!!!!!
Please help me, I'm just learning, if ZZ from one buffer was called from one buffer and ZZ from two buffers, how should I write it correctly?
I am not writing it correctly, how should it be written? Thank you
Didn't capture the piece at the top, it makes more sense that way. Please tell me the mistake.