jojocash: I use MT4 this code was work well, but it can't work on MT5. Please teach me. Thank you. I just get MagicNumber.
Please read the MQL5 documentation! In MQL5, trade functions are completely different and not compatible to MQL4. Also, please learn to use the search function on this site.
MT4Orders
- votes: 27
- 2016.10.10
- fxsaber
- www.mql5.com
Parallel use of the MetaTrader 4 and MetaTrader 5 order systems.
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
I use MT4 this code was work well, but it can't work on MT5. Please teach me. Thank you.
I just get MagicNumber.
{
int Maggic;
for(int i=0;i<OrdersTotal();i++)
{
if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
continue;
if(OrderSymbol()==Symbol() && ((OrderType() == OP_BUY && OrderMagicNumber() == MagicNumber) || (OrderType() == OP_SELL && OrderMagicNumber() == MagicNumber+77)))
Maggic=OrderMagicNumber();
}
return(Maggic);
}