Download MetaTrader 5
To add comments, please log in or register
No time to learn MQL5? Order your application from a developer!
theripper
16
theripper 2014.04.22 09:21 

Hi all,

I have an EA that worked fine in MT4 version 600 and previous, not working anymore. There are no errors in the journal, it simply does not open trades.

When I compile the code I get a warning (but no errors), apparently there is an issue with the function OrderSellect and OrderModify:

  for (OrderCount = OrdersTotal() - 1; OrderCount >= 0; OrderCount--) {
             OrderSelect(OrderCount, SELECT_BY_POS, MODE_TRADES);
                if (OrderSymbol() != Symbol() || OrderMagicNumber() != MN1) continue;
                if (OrderSymbol() == Symbol() && OrderMagicNumber() == MN1) OrderModify(OrderTicket(), 0, 0, PriceTarget, 0, Yellow);
  }

Please, help me in the two issues: EA not opening any trade and the Function issue.

Best,

honest_knave
969
honest_knave 2014.04.22 09:26  
Regarding the functions - you are not checking if the OrderSelect and OrderModify actually worked. See here for more info https://www.mql5.com/en/forum/139592
theripper
16
theripper 2014.04.22 10:29  

Hi "honest knave",

In fact I been using this functions for years in the MT4 and had never an issue, what does build 625 have changed so they don't work anymore ?

Thanks

honest_knave
969
honest_knave 2014.04.22 10:45  

They do still work without checking the return values, which is why it is a warning not an error. MetaQuotes is just telling you that it isn't a good idea to not check the return values.

You'll need to post more of your code if you need people to help with why it isn't opening trades.

Is AutoTrading enabled?

Is the EA allowed to trade? (Press F7 to open this dialog)

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.04.22 10:46  
theripper:

Hi "honest knave",

In fact I been using this functions for years in the MT4 and had never an issue, what does build 625 have changed so they don't work anymore ?

Thanks


There is missing code which is crucial. I think it is better you show us the full code.
whroeder1
13644
whroeder1 2014.04.22 12:29  
theripper: In fact I been using this functions for years in the MT4 and had never an issue,, what does build 625 have changed so they don't work anymore ?
  1. Every day you get in your car, turn the key, and drive away. Just because you've been doing it for years, doesn't mean tomorrow you won't have a dead battery. You say "never an issue" but you don't know that because you never checked. What are Function return values ? How do I use them ? - MQL4 forum
  2. You have a compile warning. That isn't an error and doesn't mean "they don't work anymore." Ignore the warning, keep your head in the sand, or check them. Your choice, your money.
/
To add comments, please log in or register