[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 4
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
How do you determine which is which of the two?
https://book.mql4.com/ru/trading/orderclose
And filter by symbol if necessary, fully working example
https://book.mql4.com/ru/trading/ordermodify
I am using the following example to determine, but it closes only the last pending order instead of the first one, although all conditions are met for the first pending order. Help me find an error!!!!!!!!!!!!!
I am using the following example to determine, but it closes only the last pending order instead of the first one, although all conditions are met for the first pending order. Help me find an error!!!!!!!!!!!!!
The easiest way to determine which order of the two to close is by the magic number. Assign them different numbers when you set them up. The example you showed above lacks this check. Also write OrderTicket() instead of ticket.
The easiest way to determine which order of the two to close is by the magic number. Assign them different numbers when you set them up. The example you showed above lacks this check. Also write OrderTicket() instead of ticket.
Thanks for the reply! I have already been advised a magic number, but where to put it when defining a pending order and how to relate it to a ticket - I don't understand.
Thanks for the reply! I have already been advised to use magic number, but I do not understand where to place it when defining a pending order and how to relate it to a ticket.
magic should be set when opening an order, but we must make sure that the number of different orders is different, otherwise it will not make sense. below is a link to a full description of the OrderSend function where all variables that can be set when opening an order, it is YOU who should be interested in the magic variable, but to work correctly, all variables before it must be filled in, all variables after - as you see fit
https://docs.mql4.com/ru/trading/OrderSend
magic should be set when opening an order, but make sure that the number of different orders is different, otherwise it makes no sense, below is a link to a full description of the OrderSend function where all variables that can be set when opening an order, YOU should be interested in the magic variable, but to work correctly all variables before it should be filled in, all variables after - as you see fit
https://docs.mql4.com/ru/trading/OrderSend
Why do different orders need different magic?
Please give me the correct code. I wrote an EA and it generates only two errors during compilation - I don't know how to get rid of them.
these errors 1) 'SL' - variable already defined C:\Program Files\MetaTrader Finam\experts\$.mq4 (43, 11)
and 2) 'TP' - variable already defined C:³ Files\MetaTrader Finam\experts\$.mq4 (45, 11)
The code of the Expert Advisor below:
And why different warrants need different magik?
Apparently for that - a few posts above :-))) - "The easiest way to determine which order of the two to close is by the magic number. Assign them different numbers when you set them up. The example you showed above lacks this check. Also write OrderTicket() instead of ticket".
The easiest way to determine which order of the two to close is by the magic number. Assign them different numbers when you set them up. The example you showed above lacks this check. Also, write OrderTicket() instead of ticket.
Remember the time of setting orders, then compare the time in the loop and delete the oldest one.
I am using the following example to determine, but it closes only the last pending order instead of the first one, although all conditions are met for the first pending order. Help me find an error!!!!!!!!!!!!!
Don't exclude the variant of transformation of the first order into a market order, and, as consequence, impossibility of its removal by this cycle on limit orders?