My trades getting rejected again and again.

 

I am facing a problem that when condition on my robot meet to open a trade, trade get rejected, please suggest what is the reason and how to fix it?


 
Perhaps you have set a very small slippage.
 
Vladimir Karputov #:
Perhaps you have set a very small slippage.

Thanks, but i have already tried this, what could be the other reason ?

 
Manpreet Singh #:

Thanks, but i have already tried this, what could be the other reason ?

Your EA should print the server error...
 
Manpreet Singh # :

Thanks, but i have already tried this, what could be the other reason ?

1. How exactly did you try? What exactly did you do?

2. You do not update prices before submitting a trade order.

 
Manpreet Singh:I am facing a problem … how to fix it?

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the source file.
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem

We can't see your broken code.

 
Vladimir Karputov #:

1. How exactly did you try? What exactly did you do?

2. You do not update prices before submitting a trade order.

I change the slippage in source code to 10, previously it was 3.

FYI, EA is running perfectly from past few weeks till today london session.

 
Carl Schreiber #:
Your EA should print the server error...

These are the errors it is showing.

 
Manpreet Singh #:

These are the errors it is showing.

So check your request: Buy, Sell, Bid, Ask, price, SL, TP, minimum distances .. and print that out.
 
Manpreet Singh #:I change the slippage in source code to 10, previously it was 3. FYI, EA is running perfectly from past few weeks till today london session.

Please be aware that the slippage/deviation parameter is in points. So a value of 10 is 1.0 pip and a value of 3 is 0.3 pips.

Also you are not printing the exact error code returned by the trade server. You are just printing out that the OrderSend was rejected.

Print that actual return code and see WHY it was rejected. See MqlTradeResult documentation for the "retcode_external" field.


Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Trade Request Result Structure
Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Trade Request Result Structure
  • www.mql5.com
Trade Request Result Structure - Data Structures - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
William Roeder #:

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the source file.
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem

We can't see your broken code.

trading some problem  buy or sell order is rejected
Reason: