- Either remember the ticket when you opened the order.
- Or, use a select loop and find it.
Magic number only allows an EA to identify its trades from all others. Using OrdersTotal/OrdersHistoryTotal (MT4) or PositionsTotal (MT5), directly and/or no Magic number/symbol filtering on your OrderSelect / Position select loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum (2013)
PositionClose is not working - MQL5 programming forum (2020.02.21)
MagicNumber: "Magic" Identifier of the Order - MQL4 Articles (2006)
Orders, Positions and Deals in MetaTrader 5 - MQL5 Articles 2011You need one Magic Number for each symbol/timeframe/strategy. Trade current timeframe, one strategy, and filter by symbol requires one MN.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want know how to modify my open orders,whether buy or sell order. i have an EA that trades for me and i make use of Buy() and Sell() function to enter my trades
So i want to know how to identify each order and modify it, for example if i make a buy order where price = 1.5, SL = 1.2 and TP = 2.0. i want to move my SL to 1.5 and TP to 2.5 when current price get to 1.9
I know about orderModify() function but i don't know how to get ticket number of an open order so i cannot even try this function.
How can i do this please i need help