Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1716

 
MakarFX #:

Interesting idea! Thank you.

No, it's not interesting(

Every time you change timeframes again, it's not nice to enter the settings(

So you should analyse the reason for deinitialisation, so that you don't ask for parameters when you shouldn't.
 
MakarFX #:

Worked like clockwork as you were looking for the last max_ticket order

Couldn't find another ticket.

Makar translate again

 
Sergey Gridnev #:
So analyse the reason for deinitialisation so that you don't ask for parameters when you shouldn't be asking for them.
I have no idea what you are talking about...
 
EVGENII SHELIPOV #:

Makar, translate again.

Post the code where you open the orders
 
MakarFX #:

It is possible to memorise a ticket before opening a new order.

Alas Makar my level of programming does not allow me to do this

 
MakarFX #:
I have no idea what we're talking about...
https://www.mql5.com/ru/docs/event_handlers/ondeinit
 
Thank you very much. I didn't know that.
 
EVGENII SHELIPOV #:

Alas Makar my level of programming does not allow to do it

MakarFX #:
Post the code where you open the orders

Where is the code?

 
MakarFX #:

Where's the code?

 if(CountTrade() < MaxOrders)
     {
      price = FindLastOrderInfo(2);
      lastlot = NormalizeDouble(GetMinLotOrder()*MathPow(MultiplierParameter, CountTrade()), 2);
      if(FindLastOrderInfo(1) == 0)
        {
         if(Ask<= price - Step()*Point)
           {
            if(OrderSend(Symbol(), OP_BUY, lastlot, Ask, slip, 0, 0, "Групповой ордер на покупку", Magic, 0, Blue))
               Print("Ордер на покупку открыт!");
            else
               Print("Ошибка открытия ордера на покупку! - ",GetLastError());
           }
        }
      if(FindLastOrderInfo(1) == 1)
        {
         if(Bid>= price + Step()*Point)
           {
            if(OrderSend(Symbol(), OP_SELL, lastlot, Bid, slip, 0, 0, "Групповой ордер на продажу", Magic, 0, Red))
               Print("Ордер на продажу открыт!");
            else
               Print("Ошибка открытия ордера на продажу! - ",GetLastError());
           }
        }
     }
 
MakarFX #:

This function cannot work correctly

Makar and it's exactly the same here because

OrderSelect

SELECT_BY_TICKET - the index parameter passes the ticket number.

Reason: